Title: myfinger                                 If you need copy same format use firefox or chrome or safari but iexplorer not work


Preview of Code
using System.Drawing;
using System;
using System.Collections.Generic;
using System.Data;
 
using System.Globalization;
using System.Linq;
using System.Threading;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
 
 
public partial class myfinger : System.Web.UI.Page
{  DataSetTableAdapters.DataTable1TableAdapter adpw = new DataSetTableAdapters.DataTable1TableAdapter();
    DataSet.DataTable1DataTable dt = new DataSet.DataTable1DataTable();
    
    //DataSetTableAdapters.T_HRGV_EVENT_LOGSTableAdapter adp = new DataSetTableAdapters.T_HRGV_EVENT_LOGSTableAdapter();
    //DataSet. dt = new DataSet.T_HRGV_EVENT_LOGSDataTable();
 
    DataSet myds = new DataSet();
    public void CultureToArabic()
    {
        CultureInfo mycultureinfo = new CultureInfo("ar-SA");
        mycultureinfo.DateTimeFormat.Calendar = new UmAlQuraCalendar();
        Thread.CurrentThread.CurrentCulture = mycultureinfo;
    }
    public void CultureToEnglish()
    {
        CultureInfo mycultureinfo = new CultureInfo("en-US");
        mycultureinfo.DateTimeFormat.Calendar = new GregorianCalendar();
        Thread.CurrentThread.CurrentCulture = mycultureinfo;
    }
    public string hijriConverterLBL(DateTime date1)
    {
        string strDateLBL;
        DateTimeFormatInfo DTFormat;
        DTFormat = new CultureInfo("ar-SA", false).DateTimeFormat;
        DTFormat.Calendar = new UmAlQuraCalendar();
        DTFormat.ShortDatePattern = "yyyy-MM-dd";
        strDateLBL = date1.Date.ToString(DTFormat.ShortDatePattern.ToString(), DTFormat);
        return strDateLBL;
    }
    public string hijriConverterGregorian(DateTime date1)
    {
        string strDateLBL;
        DateTimeFormatInfo DTFormat;
        DTFormat = new CultureInfo("en-US", false).DateTimeFormat;
        CultureInfo mycultureinfo = new CultureInfo("en-US");
        mycultureinfo.DateTimeFormat.Calendar = new GregorianCalendar();
        Thread.CurrentThread.CurrentCulture = mycultureinfo;
        DTFormat.ShortDatePattern = "yyyy-MM-dd";
        strDateLBL = date1.Date.ToString(DTFormat.ShortDatePattern.ToString(), DTFormat);
        return strDateLBL;
    }
 
    protected void Page_Load(object sender, EventArgs e)
    {
        //DateTimeFormatInfo DTFormat = new CultureInfo("ar-sa", false).DateTimeFormat;
        //DTFormat.Calendar = new HijriCalendar();
        //DTFormat.ShortDatePattern = "dd/mm/yyyy";
        //string myDate = DateTime.Today.Date.ToString("f", DTFormat);
        ////     07/ربيع الثاني/1427 12:00 ص
 
        if (!Page.IsPostBack)
        {
           
 
 
            DateTime dt_9 = DateTime.Now.AddDays(-11);
            DateTime dtday = DateTime.Now;
            // txttodate.Text = //dt.ToString("yyyy/MM/dd", new CultureInfo("ar-sa"));
            string txt1 = hijriConverterDB(dt_9);
            string txt2 = hijriConverterDB(dtday);
            // txtfromdate.Text = txt1.ToString();
            txttodate0.Text = txt2.ToString();
            CultureToArabic();
            string sdate = txtfromdate0.Text.Trim();// "10/04/1439";//TextBox1.Text;
            DateTime sdateGreg = Convert.ToDateTime(sdate);
             mysdateGreg = hijriConverterGregorian(sdateGreg);
            lblsdateGreg.Text = mysdateGreg.ToString();
            greg();
 
 
        }
    }
    public string mysdateGreg;
    public string myedateGreg;
 
    public string hijriConverterDB(DateTime date1)
    {
        string strDateDB;
        DateTimeFormatInfo DTFormat;
        DTFormat = new CultureInfo("ar-sa",false).DateTimeFormat;
        DTFormat.Calendar = new UmAlQuraCalendar();
        DTFormat.ShortDatePattern = "yyyy-MM-dd";
        strDateDB = date1.Date.ToString(DTFormat.ShortDatePattern.ToString(), DTFormat);
        return strDateDB;
    }
    protected string Convertdev(string dev)
    {  //sunday   saturday monday   tuesday  wednesday thursday  friday
        switch (dev.Trim())
        {
            case "172.16.51.5": return "الوثائق";//1
            case "172.16.52.5": return "الحركة";  //2
            case "172.16.46.5": return "الترفيعات";//3
            case "172.16.48.5": return "الزراعة";//4
            case "172.16.49.5": return "التجهيزات";//5
            case "172.16.53.5": return "الاسواق";//6
            case "172.16.47.5": return "المختبر";//7
            case "172.16.45.5": return "الصناعية";//8
 
            case "172.16.23.7": return "البلاغات"; //9
            case "172.16.33.2": return "المشاريع";//10
            case "172.16.24.3": return "النسائي";//11
            case "172.16.24.2": return "صحة البيئة";//12
            case "172.16.31.2": return "العمراني";//13
            case "172.16.32.2": return "التشييد";//14
            case "172.16.23.8": return "الاراضي";//15
            case "172.16.29.4": return "الحاسب";//16
            case "172.16.32.6": return "الخدمات";//17
            case "172.16.21.16": return "البوابة";//18
            case "172.16.23.9": return "المصعد";//19
            case "172.16.21.5": return "الفنية";//20
            case "172.16.33.9": return "الموظفيين";//21
            case "172.16.32.4": return "الامين";//22
            case "172.16.28.11": return "مدير الخدمات";//23
            case "172.16.25.9": return "البوابة1";//23
 
            case "1801B15B0016A700": return "3D_الامين"; //24
            case "D201B15A00163A00": return "3D_بوابة2"; //25
            case "0601B17900169400": return "3D_تجهيزات"; //26
            case "5901B15200161600": return "3D_الحاسب"; //27
            case "0F01B15B00167900": return "3D_الحركة"; //28
            case "1C01B15A0016B600": return "3D_مالية"; //29
            case "FB01B15A00161A00": return "3D_مصعد"; //30
            case "5501B18200163500": return "3D_موظفيين"; //32
            case "F901B15200164A00": return "3D_الخدمات"; //33
            case "EA01DFEE00170800": return "3D_صحة"; //34
            case "1F01DF7A00173900": return "3D_الاراضي"; //35
            case "1301DFD500171800": return "3D_صيانة";//36
            case "0601DFEF00179100": return "3D_نسائي"; //34
           // case "1801DF7A0017BC00": return "3D_مشاريع"; //34
            case "2901DFA400179A00": return "3D_الفنية"; //34
            case "A501DF9100175B00": return "3D_عمراني"; //34
            case "8901DF8300176F00": return "3D_البلديات"; //34
            case "C101DF9100174400": return "3D_المختبر"; //34
            case "1401DFEF0017A400": return "3D_الاسواق"; //34
            case "7701DFC200172A00": return "3D_الترفيعات"; //34
            case "0A01DFCE0017D900": return "3D_الزراعة"; //34
            case "172.16.33.6": return "الحمدي"; //34
            case "172.16.32.17": return "ناجي"; //34
            case "9701DF910017D800": return "3D_صناعية"; //34
           
            case "172.16.27.20": return "OrbitGis"; //34
            case "1801DF7A0017BC00": return "3D_بلاغات"; //34
            case "FE01DFB30017F600": return "3D_معلومات"; //34
            case "D201B15200160400": return "3D_engineer"; //34
            case "AC01DF910017CD00": return "القادسية"; //34
            //املج
            case "6601677A0018E500": return "املج_نسائي"; //34
            case "8E0129580018E300": return "املج_مبنى2"; //34
            case "6401295800180500": return "املج_مبنى1"; //34
            case "EE0128F900185100": return "املج_مجلس"; //34
            default: return "";
 
        }
    }
    protected string ConvertArDay(string dev)
    {  //sunday   saturday monday   tuesday  wednesday thursday  friday
        switch (dev.Trim())
        {
            case "Sunday": return "الاحد";//1
            case "Monday": return "الاثنين";  //2
            case "Tuesday": return "الثلاثاء";//3
            case "Wednesday": return "الاربعاء";//4
            case "Thursday": return "الخميس";//5
           
            default: return "";
        }
    }
    protected void OnRowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e)
    {
    //    if (e.Row.RowType == DataControlRowType.DataRow)
    //    {
            
    //    }
 
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            TableCell statusCell = e.Row.Cells[9];
            if (statusCell.Text == "False")
            {
                statusCell.Text = "";
                statusCell.BackColor = Color.White;
            }
            if (statusCell.Text == "True")
            {
                statusCell.Text = "";
                statusCell.BackColor = Color.Red;
            }
            e.Row.Attributes["onclick"] = Page.ClientScript.GetPostBackClientHyperlink(mygv, "Select$" + e.Row.RowIndex);
            e.Row.ToolTip = "Click to select this row.";
        }
    }
 
    protected void OnSelectedIndexChanged(object sender, EventArgs e)
    {
        foreach (GridViewRow row in mygv.Rows)
        {
            if (row.RowIndex == mygv.SelectedIndex)
            {
                row.BackColor = ColorTranslator.FromHtml("#A1DCF2");
                row.ToolTip = string.Empty;
            }
            else
            {
                row.BackColor = ColorTranslator.FromHtml("#FFFFFF");
                row.ToolTip = "Click to select this row.";
            }
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        try
        {
        //    DateTime dt = Convert.ToDateTime(txtfromdate0.Text.ToString());
            //  string mysdate = hijriConverterDB(dt);
          //  string mysdate = ConvertDateCalendar(Calendar1.SelectedDate, "Gregorian", "en-US");
         //   DateTime dt2 = Convert.ToDateTime(txttodate0.Text.ToString());
           // string myedate = hijriConverterDB(dt2);
            long myempno = long.Parse(txtempid0.Text.ToString());
            greg2();
            greg();
            //   myds.DataTable1.Clear();
            try
            {
                  adpw.Fill_work(myds.DataTable1, lblsdateGreg.Text.ToString(), lbledateGreg.Text.ToString(), myempno);
 
            }
            catch (Exception)
            {
 
               
            }
           
 
 
            // aa.FillBy_minMax2(myds.access_event_logs, DateTime.ParseExact(txtfromdate.Text.ToString(), "dd-MM-yyyy", System.Globalization.CultureInfo.InvariantCulture), DateTime.ParseExact(aa.ScalarQuery_maxdate().ToString(), "dd-MM-yyyy", System.Globalization.CultureInfo.InvariantCulture), txtuserid.Text);
            if (myds.DataTable1.Count > 0)
            {
                Session["ds"] =myds.DataTable1;
                mygv.DataSource = myds.DataTable1.DefaultView;
                mygv.DataBind();
 
                lblmsg.Text = String.Empty;
 
            }
            else
            {
                lblmsg.Text = "تأكد كتابة التاريخ ";
                myds.DataTable1.Clear();
                mygv.DataSource = myds;
                mygv.DataBind();
 
            }
        }
        catch (Exception ex)
        {
            lblmsg.Text = ex.Message;// "حدث خطا اثناء التنفيذ";
            // lblmsg.Text = "يوجد مشكله";
        }
    }
    public string ConvertDateCalendar(DateTime DateConv, string Calendar, string DateLangCulture)
    {
        System.Globalization.DateTimeFormatInfo DTFormat;
        DateLangCulture = DateLangCulture.ToLower();
        /// We can`t have the hijri date writen in English. We will get a runtime error - LAITH - 11/13/2005 1:01:45 PM -
 
        if (Calendar == "Hijri" && DateLangCulture.StartsWith("en-"))
        {
            DateLangCulture = "ar-sa";
        }
 
        /// Set the date time format to the given culture - LAITH - 11/13/2005 1:04:22 PM -
        DTFormat = new System.Globalization.CultureInfo(DateLangCulture, false).DateTimeFormat;
 
        /// Set the calendar property of the date time format to the given calendar - LAITH - 11/13/2005 1:04:52 PM -
        switch (Calendar)
        {
            case "Hijri":
                DTFormat.Calendar = new System.Globalization.HijriCalendar();
                break;
 
            case "Gregorian":
                DTFormat.Calendar = new System.Globalization.GregorianCalendar();
                break;
 
            default:
                return "";
        }
 
        /// We format the date structure to whatever we want - LAITH - 11/13/2005 1:05:39 PM -
        DTFormat.ShortDatePattern = "dd/MM/yyyy";
        return (DateConv.Date.ToString("f", DTFormat));
    }
    protected void mygv_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        mygv.PageIndex = e.NewPageIndex;
        mygv.DataSource = (DataSet.DataTable1DataTable) Session["ds"];
        mygv.DataBind();
    }
 
    protected void txttodate0_TextChanged(object sender, EventArgs e)
    {
        greg();
    }
    private void greg()
    {
        CultureToArabic();
        string edate = txttodate0.Text.Trim();// "10/04/1439";//TextBox1.Text;
        DateTime edateGreg = Convert.ToDateTime(edate);
        myedateGreg = hijriConverterGregorian(edateGreg);
        lbledateGreg.Text = myedateGreg.ToString();
    }
 
    protected void txtfromdate0_TextChanged(object sender, EventArgs e)
    {
        greg2();
    }
    private void greg2()
    {
        CultureToArabic();
        string sdate = txtfromdate0.Text.Trim();// "10/04/1439";//TextBox1.Text;
        DateTime sdateGreg = Convert.ToDateTime(sdate);
        mysdateGreg = hijriConverterGregorian(sdateGreg);
        lblsdateGreg.Text = mysdateGreg.ToString();
    }
}