Ejemplo n.º 1
0
        public HijriCalendar(Context context)
        {
            _mcontext          = context;
            _gregorianCalendar = new GregorianCalendar(context);
            _hijriCalendar     = new UmAlQuraCalendar();
            _monthNames        = new[]
            {
                context.Resources.GetString(Resource.String.January),
                context.Resources.GetString(Resource.String.February),
                context.Resources.GetString(Resource.String.March), context.Resources.GetString(Resource.String.April),
                context.Resources.GetString(Resource.String.May),
                context.Resources.GetString(Resource.String.June),
                context.Resources.GetString(Resource.String.July),
                context.Resources.GetString(Resource.String.August),
                context.Resources.GetString(Resource.String.September),
                context.Resources.GetString(Resource.String.October),
                context.Resources.GetString(Resource.String.November),
                context.Resources.GetString(Resource.String.December)
            };
            var y = _hijriCalendar.GetYear(DateTime.Now);
            var m = _hijriCalendar.GetMonth(DateTime.Now);
            var d = _hijriCalendar.GetDayOfMonth(DateTime.Now);

            _currentHijriDateTime = new DateTime(y, m, d, _hijriCalendar);

            _currentDateTime = DateTime.UtcNow;

            _countMonth   = _hijriCalendar.GetMonth(DateTime.Now);
            _countYear    = _hijriCalendar.GetYear(DateTime.Now);
            _currentMonth = _countMonth;
            _currentYear  = _countYear;
        }
Ejemplo n.º 2
0
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    public static string GrnToHij(DateTime pGdate)
    {
        int year  = Umq.GetYear(pGdate);
        int month = Umq.GetMonth(pGdate);
        int day   = Umq.GetDayOfMonth(pGdate);

        return(fd(day.ToString()) + "/" + fd(month.ToString()) + "/" + year.ToString());
    }
Ejemplo n.º 3
0
 private string GetHijriDateString(DateTime gregDate)
 {
     return(string.Format("{0}-{1:00}-{2:00}",
                          umalqura.GetYear(gregDate),
                          umalqura.GetMonth(gregDate),
                          umalqura.GetDayOfMonth(gregDate)
                          ));
 }
Ejemplo n.º 4
0
    public static string GetHijriDateString(DateTime gregDate)
    {
        if (gregDate == DateTime.MinValue)
        {
            return("");
        }


        return(string.Format("{0}-{1:00}-{2:00}",
                             umalqura.GetYear(gregDate),
                             umalqura.GetMonth(gregDate),
                             umalqura.GetDayOfMonth(gregDate)
                             ));
    }
        public static string RevDate(string DateText)
        {
            string           yr, mon, dy, date, Revdate;
            CultureInfo      arCI = new CultureInfo("ar-SA");
            UmAlQuraCalendar ul   = new UmAlQuraCalendar();
            DateTime         convertedDate;

            if (CheckDate(DateText))
            {
                convertedDate = Convert.ToDateTime(DateText, arCI.DateTimeFormat);
                convertedDate.Kind.ToString();
                yr      = (ul.GetYear(convertedDate)).ToString();       // 1436
                mon     = (ul.GetMonth(convertedDate)).ToString();      // 12
                dy      = (ul.GetDayOfMonth(convertedDate)).ToString(); // 19
                date    = yr + "/" + mon + "/" + dy;
                Revdate = dy + "/" + mon + "/" + yr;
                if (date == DateText || Revdate == DateText)
                {
                    return(date);
                }
                else
                {
                    return(date);
                }
            }
            else
            {
                return(DateText);
            }
        }
        private static Boolean Is_Hijri(string DateText)
        {
            CultureInfo      arCI = new CultureInfo("ar-SA");
            UmAlQuraCalendar ul   = new UmAlQuraCalendar();
            DateTime         convertedDate;

            try
            {
                convertedDate = Convert.ToDateTime(DateText, arCI.DateTimeFormat);
                string yr, mon, dy, date, Revdate;
                convertedDate.Kind.ToString();

                yr      = (ul.GetYear(convertedDate)).ToString();       // 1436
                mon     = (ul.GetMonth(convertedDate)).ToString();      // 12
                dy      = (ul.GetDayOfMonth(convertedDate)).ToString(); // 19
                date    = yr + "/" + mon + "/" + dy;
                Revdate = dy + "/" + mon + "/" + yr;
                if (date == DateText || Revdate == DateText)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception)
            {
                return(false);

                throw;
            }
        }
Ejemplo n.º 7
0
        public static int GetUmAlQuraYear(DateTime TheDate)
        {
            UmAlQuraCalendar cal = new UmAlQuraCalendar();
            int year             = cal.GetYear(TheDate);

            return(year);
        }
Ejemplo n.º 8
0
    public static void Main()
    {
        Calendar cal     = new UmAlQuraCalendar();
        DateTime minDate = cal.MinSupportedDateTime;
        DateTime maxDate = cal.MaxSupportedDateTime;

        Console.WriteLine("Range of the Um Al Qura calendar:");
        // Is UmAlQuraCalendar the current calendar?
        if (DateTimeFormatInfo.CurrentInfo.Calendar.ToString().Contains("UmAlQura"))
        {
            Calendar greg = new GregorianCalendar();
            Console.WriteLine("   Minimum: {0:d2}/{1:d2}/{2:d4} {3:HH:mm:ss} Gregorian, {3:MM/dd/yyyy HH:mm:ss} Um Al Qura",
                              greg.GetMonth(minDate), greg.GetDayOfMonth(minDate),
                              greg.GetYear(minDate), minDate);
            Console.WriteLine("   Maximum: {0:d2}/{1:d2}/{2:d4} {3:HH:mm:ss} Gregorian, {3:MM/dd/yyyy HH:mm:ss} Um Al Qura",
                              greg.GetMonth(maxDate), greg.GetDayOfMonth(maxDate),
                              greg.GetYear(maxDate), maxDate);
        }
        // Is Gregorian the current calendar?
        else if (DateTimeFormatInfo.CurrentInfo.Calendar.ToString().Contains("Gregorian"))
        {
            Console.WriteLine("   Minimum: {0:d} {0:HH:mm:ss} Gregorian, {1:d2}/{2:d2}/{3:d4} {0:HH:mm:ss} Um Al Qura",
                              minDate, cal.GetMonth(minDate), cal.GetDayOfMonth(minDate),
                              cal.GetYear(minDate));
            Console.WriteLine("   Maximum: {0:d} {0:HH:mm:ss} Gregorian, {1:d2}/{2:d2}/{3:d4} {0:HH:mm:ss} Um Al Qura",
                              maxDate, cal.GetMonth(maxDate), cal.GetDayOfMonth(maxDate),
                              cal.GetYear(maxDate));
        }
        // Display ranges if some other calendar is current.
        else
        {
            GregorianCalendar greg = new GregorianCalendar();
            Console.WriteLine("   Minimum: {1:d2}/{2:d2}/{3:d4} {0:HH:mm:ss} " +
                              "Gregorian, {4:d2}/{5:d2}/{6:d4} {0:HH:mm:ss} Um Al Qura",
                              minDate, greg.GetMonth(minDate), greg.GetDayOfMonth(minDate),
                              greg.GetYear(minDate), cal.GetMonth(minDate), cal.GetDayOfMonth(minDate),
                              cal.GetYear(minDate));
            Console.WriteLine("   Maximum: {1:d2}/{2:d2}/{3:d4} {0:HH:mm:ss} " +
                              "Gregorian, {4:d2}/{5:d2}/{6:d4} {0:HH:mm:ss} Um Al Qura",
                              maxDate, greg.GetMonth(maxDate), greg.GetDayOfMonth(maxDate),
                              greg.GetYear(maxDate), cal.GetMonth(maxDate), cal.GetDayOfMonth(maxDate),
                              cal.GetYear(maxDate));
        }
    }
Ejemplo n.º 9
0
        public static string GetUmAlQuraDate(DateTime TheDate)
        {
            UmAlQura = new UmAlQuraCalendar();
            string day          = Convert.ToString(UmAlQura.GetDayOfMonth(TheDate)).Length == 1 ? "0" + Convert.ToString(UmAlQura.GetDayOfMonth(TheDate)) : Convert.ToString(UmAlQura.GetDayOfMonth(TheDate));
            string month        = Convert.ToString(UmAlQura.GetMonth(TheDate)).Length == 1 ? "0" + Convert.ToString(UmAlQura.GetMonth(TheDate)) : Convert.ToString(UmAlQura.GetMonth(TheDate));
            string year         = UmAlQura.GetYear(TheDate).ToString();
            string UmAlQuraDate = year.ToString() + "-" + month.ToString() + "-" + day.ToString();

            return(UmAlQuraDate);
        }
Ejemplo n.º 10
0
    public static void Main()
    {
        Calendar cal         = new UmAlQuraCalendar();
        int      currentYear = cal.GetYear(DateTime.Now);

        for (int year = currentYear; year <= currentYear + 9; year++)
        {
            Console.WriteLine("{0:d4}: {1} days {2}", year,
                              cal.GetDaysInYear(year, UmAlQuraCalendar.UmAlQuraEra),
                              cal.IsLeapYear(year, UmAlQuraCalendar.UmAlQuraEra) ?
                              "(Leap Year)" : "");
        }
    }
Ejemplo n.º 11
0
        public void CanUseDateInCalendar()
        {
            var dt = new Date(2015, 1, 1);

            var calendar = new UmAlQuraCalendar();
            var year     = calendar.GetYear(dt);
            var month    = calendar.GetMonth(dt);
            var day      = calendar.GetDayOfMonth(dt);

            Assert.Equal(1436, year);
            Assert.Equal(3, month);
            Assert.Equal(10, day);
        }
Ejemplo n.º 12
0
        public static string GregToHijriMonthandYear(DateTime dtTime)
        {
            if (dtTime == DateTime.MinValue)
            {
                return("");
            }
            UmAlQuraCalendar calHijri = new UmAlQuraCalendar();
            string           weekday  = Convert.ToString(calHijri.GetDayOfWeek(dtTime));
            int CurrDayOfMonth        = calHijri.GetDayOfMonth(dtTime);
            int CurrMonth             = calHijri.GetMonth(dtTime);
            int Curryear = calHijri.GetYear(dtTime);

            return(Curryear.ToString() + " - " + CurrMonth.ToString());
        }
Ejemplo n.º 13
0
    public static void Main()
    {
        Calendar cal         = new UmAlQuraCalendar();
        int      currentYear = cal.GetYear(DateTime.Now);

        Console.WriteLine("Era     Year     Days\n");
        foreach (int era in cal.Eras)
        {
            for (int year = currentYear; year <= currentYear + 9; year++)
            {
                Console.WriteLine("{0}{1}      {2}      {3}",
                                  ShowCurrentEra(cal, era), era, year,
                                  cal.GetDaysInYear(year, era));
            }
        }
        Console.WriteLine("\n   * Indicates the current era.");
    }
Ejemplo n.º 14
0
        public static string GregToHijriTime(DateTime dtTime)
        {
            if (dtTime == DateTime.MinValue)
            {
                return("");
            }
            UmAlQuraCalendar calHijri = new UmAlQuraCalendar();
            CultureInfo      info     = new CultureInfo("ar-sa");

            info.DateTimeFormat.Calendar = calHijri;
            string weekday        = Convert.ToString(calHijri.GetDayOfWeek(dtTime));
            int    CurrDayOfMonth = calHijri.GetDayOfMonth(dtTime);
            int    CurrMonth      = calHijri.GetMonth(dtTime);
            int    Curryear       = calHijri.GetYear(dtTime);

            return(dtTime.ToString("hh:mm tt", info));
        }
Ejemplo n.º 15
0
        public static string GregToHijriCompleteWithDay(DateTime dtTime)
        {
            if (dtTime == DateTime.MinValue)
            {
                return("");
            }
            UmAlQuraCalendar calHijri = new UmAlQuraCalendar();
            CultureInfo      info     = new CultureInfo("ar-sa");

            info.DateTimeFormat.Calendar = calHijri;
            string weekday        = Convert.ToString(calHijri.GetDayOfWeek(dtTime));
            int    CurrDayOfMonth = calHijri.GetDayOfMonth(dtTime);
            int    CurrMonth      = calHijri.GetMonth(dtTime);
            int    Curryear       = calHijri.GetYear(dtTime);

            return(string.Format("{0} {3}/{2}/{1}  هـ ", dtTime.ToString("dddd", info), CurrDayOfMonth.ToString(), CurrMonth.ToString(), Curryear.ToString()));
        }
Ejemplo n.º 16
0
    public static void Main()
    {
        UmAlQuraCalendar cal    = new UmAlQuraCalendar();
        List <string>    months = new List <string>();
        string           output = String.Empty;

        // Get the current year in the UmAlQura calendar.
        int startYear = cal.GetYear(DateTime.Now);

        // Display the number of days in each month for the next five years.
        Console.WriteLine("          Days in Each Month, {0} to {1}\n",
                          startYear, startYear + 4);

        Console.WriteLine("Month     {0}     {1}     {2}     {3}     {4}",
                          startYear, startYear + 1, startYear + 2, startYear + 3,
                          startYear + 4);
        for (int year = startYear; year <= startYear + 4; year++)
        {
            int days;
            for (int month = 1; month <= cal.GetMonthsInYear(year, UmAlQuraCalendar.UmAlQuraEra);
                 month++)
            {
                days = cal.GetDaysInMonth(year, month,
                                          UmAlQuraCalendar.UmAlQuraEra);
                output = String.Format("{0}     ", days);
                if (months.Count < month)
                {
                    months.Add(String.Format("{0,4}        {1}",
                                             month, output));
                }
                else
                {
                    months[month - 1] += "  " + output;
                }
            }
        }

        foreach (var item in months)
        {
            Console.WriteLine(item);
        }
    }
Ejemplo n.º 17
0
        /// <summary>
        /// لتحويل التاريخ  من ميلادي الى هجري
        /// </summary>
        /// <param name="TempDateTime">المراد تحويل *برامتر*</param>
        /// <returns>
        /// التاريخ الهجري
        ///
        /// </returns>
        public static String ConvertToHijri(String Greg)
        {
            try
            {
                UmAlQuraCalendar umm = new UmAlQuraCalendar();
                if (int.Parse(umm.GetYear(DateTime.Parse(Greg)).ToString()) < 1600)
                {
                    return(Greg);
                }



                UmAlQuraCalendar um   = new UmAlQuraCalendar();
                String           Temp = "";
                HijriCalendar    H    = new HijriCalendar();


                GregorianCalendar Gr       = new GregorianCalendar(GregorianCalendarTypes.USEnglish);
                DateTime          DateTemp = new DateTime(int.Parse(GetYears(Greg)), int.Parse(GetMonths(Greg)), int.Parse(GetDays(Greg)), new GregorianCalendar());
                Temp = (um.GetYear(DateTemp)).ToString() + "/" + um.GetMonth(DateTemp).ToString() + "/" + um.GetDayOfMonth(DateTemp).ToString();
                //System.Windows.MessageBox.Show(Temp);
                //Temp = H.GetYear(DateTemp).ToString() + "/" + H.GetMonth(DateTemp).ToString() + "/" + H.GetDayOfMonth(DateTemp).ToString();
                //DateTime FinallConv = Convert.ToDateTime(Temp);
                //Temp = FinallConv.ToString("yyyy/MM/dd");

                return(Temp);
            }
            catch (Exception ex)
            {
                var HelperTSC = new HelperToSaveConvert();
                Greg = HelperTSC.LastSloution(Greg);
                UmAlQuraCalendar  um       = new UmAlQuraCalendar();
                String            Temp     = "";
                HijriCalendar     H        = new HijriCalendar();
                GregorianCalendar Gr       = new GregorianCalendar(GregorianCalendarTypes.USEnglish);
                DateTime          TempDate = Convert.ToDateTime(Greg);
                DateTime          DateTemp = new DateTime(int.Parse(GetYears(Greg)), int.Parse(GetMonths(Greg)), int.Parse(GetDays(Greg)), new GregorianCalendar());
                Temp = (um.GetYear(DateTemp)).ToString() + "/" + um.GetMonth(DateTemp).ToString() + "/" + um.GetDayOfMonth(DateTemp).ToString();
                return(Temp);
            }
        }
Ejemplo n.º 18
0
        public static List <string> GetYears()
        {
            UmAlQuraCalendar um = new UmAlQuraCalendar();
            var dt = new DataTable();
            var GetDateFromDatabase = new ModelMega();

            GetDateFromDatabase.show(dt);
            var Result    = new List <string>();
            var WholeDate = new List <string>();

            foreach (DataRow item in dt.Rows)
            {
                WholeDate.Add((DateTime.Parse(item.Field <string>("datrec")).Year.ToString()).Contains("143") || DateTime.Parse(item.Field <string>("datrec")).Year.ToString().Contains("144") ?
                              DateTime.Parse(item.Field <string>("datrec")).Year.ToString() :
                              um.GetYear(DateTime.Parse(item.Field <string>("datrec"))).ToString());
            }



            return(WholeDate);
        }
Ejemplo n.º 19
0
    public static void Main()
    {
        // Make Arabic (Egypt) the current culture
        // and Umm al-Qura calendar the current calendar.
        CultureInfo arEG = CultureInfo.CreateSpecificCulture("ar-EG");
        Calendar    cal  = new UmAlQuraCalendar();

        arEG.DateTimeFormat.Calendar        = cal;
        Thread.CurrentThread.CurrentCulture = arEG;

        // Display information on current culture and calendar.
        DisplayCurrentInfo();

        // Instantiate a date object.
        DateTime date1 = new DateTime(2011, 7, 15);

        // Display the string representation of the date.
        Console.WriteLine("Date: {0:d}", date1);
        Console.WriteLine("Date in the Invariant Culture: {0}",
                          date1.ToString("d", CultureInfo.InvariantCulture));
        Console.WriteLine();

        // Compare DateTime properties and Calendar methods.
        Console.WriteLine("DateTime.Month property: {0}", date1.Month);
        Console.WriteLine("UmAlQura.GetMonth: {0}",
                          cal.GetMonth(date1));
        Console.WriteLine();

        Console.WriteLine("DateTime.Day property: {0}", date1.Day);
        Console.WriteLine("UmAlQura.GetDayOfMonth: {0}",
                          cal.GetDayOfMonth(date1));
        Console.WriteLine();

        Console.WriteLine("DateTime.Year property: {0:D4}", date1.Year);
        Console.WriteLine("UmAlQura.GetYear: {0}",
                          cal.GetYear(date1));
        Console.WriteLine();
    }
        public void Edit()
        {
            while (true)
            {
                if (String.IsNullOrEmpty(name_edit.Text))
                {
                    DXMessageBox.Show(null, "لم يتم  تحديد اسم العميل لتحديث البيانات", "خطأ", MessageBoxButton.OK, MessageBoxImage.Error);
                    break;
                }

                else if (String.IsNullOrEmpty(price_edit.Text))
                {
                    DXMessageBox.Show(null, "لم يتم  تحديد السعر لتحديث البيانات", "خطأ", MessageBoxButton.OK, MessageBoxImage.Error);
                    break;
                }
                else if (String.IsNullOrEmpty(date_edit.Text))
                {
                    DXMessageBox.Show(null, "لم يتم  تحديد التاريخ لتحديث البيانات", "خطأ", MessageBoxButton.OK, MessageBoxImage.Error);
                    break;
                }
                else if (String.IsNullOrEmpty(content_Prou_edit.Text))
                {
                    MessageBoxResult resultmsg = DXMessageBox.Show(null, @"لم يتم تحديد وصف للمشكلة, هل تريد  مواصلة  العملية؟", "خطأ", MessageBoxButton.YesNo, MessageBoxImage.Error);
                    if (resultmsg == MessageBoxResult.No)
                    {
                        break;
                    }
                    else if (resultmsg == MessageBoxResult.Yes)
                    {
                        content_Prou_edit.Text = "لايوجد";
                    }
                }
                else if (String.IsNullOrEmpty(KIND_EDIT.Text))
                {
                    DXMessageBox.Show(null, "لم يتم  تحديد نوع الصنف لتحديث البيانات", "خطأ", MessageBoxButton.OK, MessageBoxImage.Error);
                    break;
                }



                var data_21     = new System.Data.DataTable();
                var ModelMegaa2 = new ModelMega();
                ModelMegaa2.show(data_21);
                var lis     = new List <string>();
                var lisDate = new List <string>();

                foreach (System.Data.DataRow item in data_21.Rows)
                {
                    lis.Add(item.Field <String>("ID"));
                    lisDate.Add(item.Field <String>("datrec"));
                }
                if (IsComplete_edit.IsChecked == true)
                {
                    string           price       = int.Parse(price_edit.Text.Replace("SAR ", "")).ToString("N0");
                    UmAlQuraCalendar um          = new UmAlQuraCalendar();
                    String           CurrentDate = (int.Parse(DateTime.Now.Year.ToString()) < 1600) ? DateTime.Now.Year.ToString() + "/" + DateTime.Now.Month.ToString() + "/" + DateTime.Now.Day.ToString() :
                                                   um.GetYear(DateTime.Parse(DateTime.Now.ToString())).ToString() + "/" + um.GetMonth(DateTime.Parse(DateTime.Now.ToString())).ToString() + "/" + um.GetDayOfMonth(DateTime.Parse(DateTime.Now.ToString())).ToString();

                    String CurrentDatee = (int.Parse(date_edit.DateTime.Year.ToString()) < 1600) ? date.DateTime.Year.ToString() + "/" + date_edit.DateTime.Month.ToString() + "/" + date_edit.DateTime.Day.ToString() :
                                          um.GetYear(date_edit.DateTime).ToString() + "/" + um.GetMonth(date_edit.DateTime).ToString() + "/" + um.GetDayOfMonth(date_edit.DateTime).ToString();
                    if (int.Parse(DateTime.Now.Year.ToString()) < 2000)
                    {
                        String CurrentDateee =
                            um.GetYear(DateTime.Parse(CurrentDatee)).ToString() + "/" + um.GetMonth(DateTime.Parse(CurrentDatee)).ToString() + "/" + um.GetDayOfMonth(DateTime.Parse(CurrentDatee)).ToString();
                        HelperRepair.Edit(ID1.Text, name_edit.Text, "SAR " + price, (int.Parse(DateTime.Parse(CurrentDateee).Year.ToString()) < 1600) ? CurrentDateee : DateConverter.ConvertToHijri(CurrentDateee), lisDate[lis.IndexOf(ID1.Text)], content_Prou_edit.Text, KIND_EDIT.Text, (string.IsNullOrEmpty(discounts_Edit.Text) ? "لايوجد" : discounts_Edit.Text), false, data);
                    }
                    else
                    {
                        HelperRepair.Edit(ID1.Text, name_edit.Text, "SAR " + price, (int.Parse(DateTime.Parse(CurrentDatee).Year.ToString()) < 1600) ? CurrentDatee : DateConverter.ConvertToHijri(CurrentDatee), lisDate[lis.IndexOf(ID1.Text)], content_Prou_edit.Text, KIND_EDIT.Text, (string.IsNullOrEmpty(discounts_Edit.Text) ? "لايوجد" : discounts_Edit.Text), false, data);
                    }
                }
                else
                {
                    //id = Guid.NewGuid();
                    //ID1.Text = id.ToString().Substring(id.ToString().IndexOf('-'), 10).Replace("-", "");
                    int    Price         = int.Parse(double.Parse(price_edit.Text.Replace("SAR", "")).ToString());
                    String CurrentDateee = "";

                    UmAlQuraCalendar um          = new UmAlQuraCalendar();
                    String           CurrentDate = (int.Parse(DateTime.Now.Year.ToString()) < 1600) ? DateTime.Now.Year.ToString() + "/" + DateTime.Now.Month.ToString() + "/" + DateTime.Now.Day.ToString() :
                                                   um.GetYear(DateTime.Parse(DateTime.Now.ToString())).ToString() + "/" + um.GetMonth(DateTime.Parse(DateTime.Now.ToString())).ToString() + "/" + um.GetDayOfMonth(DateTime.Parse(DateTime.Now.ToString())).ToString();
                    String CurrentDatee = (int.Parse(date_edit.DateTime.Year.ToString()) < 1600) ? date.DateTime.Year.ToString() + "/" + date_edit.DateTime.Month.ToString() + "/" + date_edit.DateTime.Day.ToString() :
                                          um.GetYear(date_edit.DateTime).ToString() + "/" + um.GetMonth(date_edit.DateTime).ToString() + "/" + um.GetDayOfMonth(date_edit.DateTime).ToString();
                    if (int.Parse(CurrentDatee.Split('/')[0]) > 2000)
                    {
                        CurrentDateee =
                            um.GetYear(DateTime.Parse(CurrentDatee)).ToString() + "/" + um.GetMonth(DateTime.Parse(CurrentDatee)).ToString() + "/" + um.GetDayOfMonth(DateTime.Parse(CurrentDatee)).ToString();
                        string Price_ = "SAR " + Price.ToString("N0");



                        HelperRepair.Edit(ID1.Text, name_edit.Text, Price_, (int.Parse(DateTime.Parse(CurrentDateee).Year.ToString()) < 1600) ? CurrentDateee : DateConverter.ConvertToHijri(CurrentDateee), lisDate[lis.IndexOf(ID1.Text)], content_Prou_edit.Text, KIND_EDIT.Text, (String.IsNullOrEmpty(discounts_Edit.Text)) ? "لايوجد" : discounts_Edit.Text, true, data);
                    }
                    else
                    {
                        string Price_ = "SAR " + Price.ToString("N0");



                        HelperRepair.Edit(ID1.Text, name_edit.Text, Price_, (int.Parse(DateTime.Parse(CurrentDatee).Year.ToString()) < 1600) ? CurrentDatee : DateConverter.ConvertToHijri(CurrentDatee), lisDate[lis.IndexOf(ID1.Text)], content_Prou_edit.Text, KIND_EDIT.Text, (String.IsNullOrEmpty(discounts_Edit.Text)) ? "لايوجد" : discounts_Edit.Text, true, data);
                    }
                }
                break;
            }
        }
Ejemplo n.º 21
0
        private void Print_Click(object sender, RoutedEventArgs e)
        {
            var SumPricee = new FunctionsOfSum();

            var Fa_delete = new Assest.OrcDataAcess();
            var FA        = new Assest.OrcDataAcess();

            try
            {
                double afo      = 0;
                var    Filtring = new List <string>();
                foreach (string item in PriceList)
                {
                    Filtring.Add(item.Replace("SAR", ""));
                }

                var           accc = new Assest.OrcDataAcess();
                List <string> L0   = new List <string>();
                List <string> L1   = new List <string>();
                List <string> L2   = new List <string>();
                List <string> L3   = new List <string>();
                List <string> L4   = new List <string>();
                List <string> L5   = new List <string>();
                List <string> L6   = new List <string>(); //
                List <string> L7   = new List <string>(); //dis
                List <string> L8   = new List <string>(); //pricef
                List <string> L9   = new List <string>(); //dat


                /*
                 *
                 *
                 *
                 */



                DataTable tt = new DataTable();
                accc.Show(tt);

                //                Finall_Price = (Double)((Price * Discount) / 100) - Price;

                foreach (DataRow r in tt.Rows)
                {
                    L1.Add(r.Field <string>("NAME"));
                    L2.Add(r.Field <string>("BARCODE"));
                    L3.Add(r.Field <string>("PRICE_A"));
                    L4.Add(r.Field <string>("PRICE"));
                    L5.Add(r.Field <string>("ID"));
                    L6.Add(r.Field <string>("QUANTITY"));
                    L7.Add(r.Field <string>("Dis"));
                    L8.Add(r.Field <string>("Price_F"));
                }
                tt.Clear();
                accc.show3(tt);
                foreach (DataRow r in tt.Rows)
                {
                    L0.Add(r.Field <String>("NUMF"));
                }
                foreach (string asf in Filtring)
                {
                    afo += double.Parse(asf);
                }
                PriceList.Add(afo.ToString());
                Pricce.Text = "SAR " + afo.ToString();

                var RepHelper = new ReportHelper();
                var ILIST     = new List <ReportHelper>();
                ILIST.Add(new ReportHelper()
                {
                    Getprice_ = Pricce.Text
                });
                XtraReport3 report            = new XtraReport3();
                SQLiteConnectionParameters FF = new SQLiteConnectionParameters();
                FF.FileName = System.Windows.Forms.Application.StartupPath + "\\dbPascal.db";
                ((SqlDataSource)report.DataSource).ConnectionParameters = FF;
                XtraReportPreviewModel model   = new XtraReportPreviewModel(report);
                DocumentPreviewWindow  windoww = new DocumentPreviewWindow()
                {
                    Model = model
                };
                report.CreateDocument(true);
                windoww.ShowDialog();

                string id_3 = "";
                //int finalprice = int.Parse(SumPricee.sumPrice().Replace("SAR", "").Replace(",", ""));
                //double Ristt = double.Parse(afo.ToString().Replace("SAR", "").Replace(",", ""));
                //double FInaal = finalprice + Ristt;
                for (int i = 0; i < L1.Count; i++)
                {
                    if (L1[i] == Name.Text)
                    {
                        id_3 = L5[i];
                    }
                }
                List <int> sawf = new List <int>();

                foreach (string d in L0)
                {
                    sawf.Add(int.Parse(d));
                }
                #region Convert Days to arabic language
                string dayoftheweek = "";
                switch (DateTime.Now.DayOfWeek)
                {
                case DayOfWeek.Sunday:
                {
                    dayoftheweek = ".الاحد";
                    break;
                }

                case DayOfWeek.Monday:
                {
                    dayoftheweek = ".الاثنين";
                    break;
                }

                case DayOfWeek.Thursday:
                {
                    dayoftheweek = ".الخميس";
                    break;
                }

                case DayOfWeek.Saturday:
                {
                    dayoftheweek = ".السبت";
                    break;
                }

                case DayOfWeek.Friday:
                {
                    dayoftheweek = "الجمعة.";
                    break;
                }

                case DayOfWeek.Tuesday:
                {
                    dayoftheweek = "الثلاثاء.";
                    break;
                }

                case DayOfWeek.Wednesday:
                {
                    dayoftheweek = "الاربعاء.";
                    break;
                }
                }
                #endregion
                if (L0.Count == 0)
                {
                    //null
                }

                else
                {
                    numfa = sawf.Max() + 1;
                }
                if (sawf.Count == 0)
                {
                    UmAlQuraCalendar um          = new UmAlQuraCalendar();
                    String           CurrentDate = (int.Parse(DateTime.Now.Year.ToString()) < 1600) ? DateTime.Now.Year.ToString() + "/" + DateTime.Now.Month.ToString() + "/" + DateTime.Now.Day.ToString() :
                                                   um.GetYear(DateTime.Parse(DateTime.Now.ToString())).ToString() + "/" + um.GetMonth(DateTime.Parse(DateTime.Now.ToString())).ToString() + "/" + um.GetDayOfMonth(DateTime.Parse(DateTime.Now.ToString())).ToString();

                    for (int i = 0; i < L1.Count; i++)
                    {
                        double Price        = 0;
                        double Discount     = 0;
                        double Finall_Price = 0;
                        string Result       = "";

                        DateTime dtttt = new DateTime();
                        for (int ii = 0; ii < asdf.Count; ii++)
                        {
                            if (L1[i] == asdf[ii])
                            {
                                accc.insert3(CurrentDate, L1[i], getwholeprice(i, L4, L7), L5[i], L6[i], L3[i], L2[i], numfa.ToString(), dayoftheweek, Pricce.Text);

                                Price        = (String.IsNullOrEmpty(L4[i].Replace("SAR", ""))) ? 0 : (Double)Double.Parse(double.Parse(L4[i].Replace("SAR", "")).ToString().Replace("SAR", ""));
                                Discount     = (String.IsNullOrEmpty(L7[i].Replace("%", ""))) ? 0 : (Double)Double.Parse(double.Parse(L7[i].Replace("%", "")).ToString().Replace("%", ""));
                                Finall_Price = (Double)((Price * Discount) / 100) - Price;
                                Finall_Price = Finall_Price * int.Parse(L6[i]);
                                Result       = "SAR " + Finall_Price.ToString("N2").Replace("-", "");
                                var mainwi = new MainWindow(L1[i], L4[i], L6[i], L2[i], L3[i], L5[i], L7[i], Result);
                                mainwi.EDIT_MAX();
                            }

                            /*
                             *
                             * L1.Add(r.Field<string>("NAME"));
                             * L2.Add(r.Field<string>("BARCODE"));
                             * L3.Add(r.Field<string>("PRICE_A"));
                             * L4.Add(r.Field<string>("PRICE"));
                             * L5.Add(r.Field<string>("ID"));
                             * L6.Add(r.Field<string>("QUANTITY"));
                             * L7.Add(r.Field<string>("Dis"));
                             * L8.Add(r.Field<string>("Price_F"));
                             */
                        }
                    }

                    if (GID.Count > 0)
                    {
                        for (int i = 0; i < GID.Count; i++)
                        {
                            FA.Delete(GID[i]);
                        }
                    }
                }
                else
                {
                    #region Date

                    UmAlQuraCalendar um          = new UmAlQuraCalendar();
                    String           CurrentDate = (int.Parse(DateTime.Now.Year.ToString()) < 1600) ? DateTime.Now.Year.ToString() + "/" + DateTime.Now.Month.ToString() + "/" + DateTime.Now.Day.ToString() :
                                                   um.GetYear(DateTime.Parse(DateTime.Now.ToString())).ToString() + "/" + um.GetMonth(DateTime.Parse(DateTime.Now.ToString())).ToString() + "/" + um.GetDayOfMonth(DateTime.Parse(DateTime.Now.ToString())).ToString();

                    #endregion


                    for (int i = 0; i < L1.Count; i++)
                    {
                        double Price        = 0;
                        double Discount     = 0;
                        double Finall_Price = 0;
                        string Result       = "";

                        DateTime dtttt = new DateTime();
                        for (int ii = 0; ii < asdf.Count; ii++)
                        {
                            if (L1[i] == asdf[ii])
                            {
                                accc.insert3(CurrentDate, L1[i], getwholeprice(i, L4, L7), L5[i], L6[i], L3[i], L2[i], numfa.ToString(), dayoftheweek, Pricce.Text);
                                Price        = (String.IsNullOrEmpty(L4[i].Replace("SAR", ""))) ? 0 : (Double)Double.Parse(double.Parse(L4[i].Replace("SAR", "")).ToString().Replace("SAR", ""));
                                Discount     = (String.IsNullOrEmpty(L7[i].Replace("%", ""))) ? 0 : (Double)Double.Parse(double.Parse(L7[i].Replace("%", "")).ToString().Replace("%", ""));
                                Finall_Price = (Double)((Price * Discount) / 100) - Price;
                                Finall_Price = Finall_Price * int.Parse(L6[i]);
                                Result       = "SAR " + Finall_Price.ToString("N2").Replace("-", "");
                                var mainwi = new MainWindow(L1[i], L4[i], L6[i], L2[i], L3[i], L5[i], L7[i], Result);
                                mainwi.EDIT_MAX();
                            }
                        }
                    }

                    if (GID.Count > 0)
                    {
                        for (int i = 0; i < GID.Count; i++)
                        {
                            FA.Updating_QUa("0", GID[i].ToString());
                        }
                    }
                }
                asdf.Clear();



                for (int i = 0; i < PriceList.Count; i++)
                {
                    Fa_delete._Delete(double.Parse(PriceList[i].Replace("SAR", "").Replace(",", "")));
                }
            }
            catch (Exception ex) { System.Windows.MessageBox.Show(ex.Message + ":" + ex.HResult.ToString()); }
            DD.ItemsSource = "";
            Observ.Clear();
            NameList.Clear();
            PriceList.Clear();
        }
Ejemplo n.º 22
0
    public static string getHijriMonth(DateTime dt)
    {
        UmAlQuraCalendar umAlQura = new UmAlQuraCalendar();

        return(" هـ " + umAlQura.GetYear(dt) + ", " + HijriMonths[umAlQura.GetMonth(dt)] + ", " + umAlQura.GetDayOfMonth(dt) + ", " + arabicDays[getDayIndex(dt.DayOfWeek.ToString())]);
    }
        public void GenerateData()
        {
            var      bclCalendar = new UmAlQuraCalendar();
            DateTime minDateTime = bclCalendar.MinSupportedDateTime;

            // Work out the min and max supported years, ensuring that we support complete years.
            var minYear = bclCalendar.GetYear(minDateTime);

            if (bclCalendar.GetMonth(minDateTime) != 1 || bclCalendar.GetDayOfMonth(minDateTime) != 1)
            {
                minYear++;
            }

            DateTime maxDateTime = bclCalendar.MaxSupportedDateTime;
            var      maxYear     = bclCalendar.GetYear(maxDateTime);

            if (bclCalendar.GetMonth(maxDateTime) != 12 || bclCalendar.GetDayOfMonth(maxDateTime) != bclCalendar.GetDaysInMonth(maxYear, 12))
            {
                maxYear--;
            }

            // This is two elements longer than it needs to be, but it's simpler this way.
            var monthLengths = new ushort[maxYear - minYear + 3];

            for (int year = minYear; year <= maxYear; year++)
            {
                int    yearIndex = year - minYear + 1;
                ushort monthBits = 0;
                for (int month = 1; month <= 12; month++)
                {
                    if (bclCalendar.GetDaysInMonth(year, month) == 30)
                    {
                        monthBits |= (ushort)(1 << month);
                    }
                }
                monthLengths[yearIndex] = monthBits;
            }
            byte[] data = monthLengths.SelectMany(value => new[] { (byte)(value >> 8), (byte)(value & 0xff) }).ToArray();

            // Assume every 10 years before minDateTime has exactly 3544 days... it doesn't matter whether or not that's
            // correct, but it gets roughly the right estimate. It doesn't matter that startOfMinYear isn't in UTC; we're only
            // taking the Ticks property, which doesn't take account of the Kind.
            DateTime startOfMinYear = bclCalendar.ToDateTime(minYear, 1, 1, 0, 0, 0, 0);
            var      computedDaysAtStartOfMinYear = (int)((startOfMinYear.Ticks - NodaConstants.BclTicksAtUnixEpoch) / NodaConstants.TicksPerDay);

            Console.WriteLine($"private const int ComputedMinYear = {minYear};");
            Console.WriteLine($"private const int ComputedMaxYear = {maxYear};");
            Console.WriteLine($"private const int ComputedDaysAtStartOfMinYear = {computedDaysAtStartOfMinYear};");
            Console.WriteLine("private const string GeneratedData =");

            // Adapted from PersianCalendarSystemTest. If we do this any more, we should
            // put it somewhere common.
            var base64     = Convert.ToBase64String(data);
            var lineLength = 80;

            for (int start = 0; start < base64.Length; start += lineLength)
            {
                var line = base64.Substring(start, Math.Min(lineLength, base64.Length - start));
                var last = start + lineLength >= base64.Length;
                Console.WriteLine($"    \"{line}\"{(last ? ";" : " +")}");
            }
            Console.WriteLine();
        }
Ejemplo n.º 24
0
 public int GetYear()
 {
     return(_hijriCalendar.GetYear(_currentDateTime));
 }
Ejemplo n.º 25
0
        private static string convertFromGrtoHij(String input)
        {
            UmAlQuraCalendar um = new UmAlQuraCalendar();

            return(um.GetYear(DateTime.Parse(input)).ToString() + "/" + um.GetMonth(DateTime.Parse(input)).ToString() + "/" + um.GetDayOfMonth(DateTime.Parse(input)).ToString());
        }
        static UmAlQuraYearMonthDayCalculator()
        {
            // Try to initialize. If anything fails, YearLengths will still be null, so IsSupported will return false.
            Calendar bclCalendar;

#if PCL
            // Can't refer to the BCL calendar by name, but it *might* be available anyway. Let's try to instantiate
            // it with reflection. If we can't, that's fair enough.
            try
            {
                var type = typeof(Calendar).Assembly.GetType("System.Globalization.UmAlQuraCalendar");
                if (type == null)
                {
                    return;
                }
                bclCalendar = (Calendar)Activator.CreateInstance(type);
            }
            catch
            {
                // Don't really care what went wrong here. We'll assume it's not supported.
                return;
            }
#else
            bclCalendar = new UmAlQuraCalendar();
#endif

            DateTime minDateTime = bclCalendar.MinSupportedDateTime;

            // Check if this looks like a sensible implementation, with a limited time range.
            // (The .NET implementation only runs from 1900-2077, for example.)
            // Mono is unfortunately broken - it advertises a large range, but then is inconsistent:
            // Year 2 (for example) either has 354 or 355 days depending on how you ask.
            if (minDateTime.Year < 1800 || minDateTime.Year > 3000)
            {
                YearLengths   = null;
                MonthLengths  = null;
                YearStartDays = null;
                return;
            }

            // Work out the min and max supported years, ensuring that we support complete years.
            ComputedMinYear = bclCalendar.GetYear(minDateTime);
            if (bclCalendar.GetMonth(minDateTime) != 1 || bclCalendar.GetDayOfMonth(minDateTime) != 1)
            {
                ComputedMinYear++;
            }

            DateTime maxDateTime = bclCalendar.MaxSupportedDateTime;
            ComputedMaxYear = bclCalendar.GetYear(maxDateTime);
            if (bclCalendar.GetMonth(maxDateTime) != 12 || bclCalendar.GetDayOfMonth(maxDateTime) != bclCalendar.GetDaysInMonth(ComputedMaxYear, 12))
            {
                ComputedMaxYear--;
            }

            // For year lengths, we need to handle 1 year beyond the boundaries, too.
            // We don't need MonthLengths to be quite as long, but it's simpler to be consistent.
            YearLengths   = new int[ComputedMaxYear - ComputedMinYear + 3];
            YearStartDays = new int[ComputedMaxYear - ComputedMinYear + 3];
            MonthLengths  = new int[ComputedMaxYear - ComputedMinYear + 3];
            int totalDays = 0;
            for (int year = ComputedMinYear; year <= ComputedMaxYear; year++)
            {
                int yearIndex = year - ComputedMinYear + 1;
                YearLengths[yearIndex]   = bclCalendar.GetDaysInYear(year);
                YearStartDays[yearIndex] = totalDays;
                totalDays += YearLengths[yearIndex];
                int monthBits = 0;
                for (int month = 1; month <= 12; month++)
                {
                    if (bclCalendar.GetDaysInMonth(year, month) == 30)
                    {
                        monthBits |= 1 << month;
                    }
                }
                MonthLengths[yearIndex] = monthBits;
            }
            // Fill in the cache with dummy data for before/after the min/max year, pretending
            // that both of the "extra" years were 354 days long.
            YearStartDays[0] = -354;
            YearStartDays[YearStartDays.Length - 1] = totalDays;
            YearLengths[0] = 354;
            YearLengths[YearStartDays.Length - 1] = 354;

            // Assume every 10 years before minDateTime has exactly 3544 days... it doesn't matter whether or not that's
            // correct, but it gets roughly the right estimate. It doesn't matter that startOfMinYear isn't in UTC; we're only
            // taking the Ticks property, which doesn't take account of the Kind.
            DateTime startOfMinYear = bclCalendar.ToDateTime(ComputedMinYear, 1, 1, 0, 0, 0, 0);
            ComputedDaysAtStartOfMinYear = (int)((startOfMinYear.Ticks - NodaConstants.BclTicksAtUnixEpoch) / NodaConstants.TicksPerDay);
            ComputedDaysAtStartOfYear1   = ComputedDaysAtStartOfMinYear + (int)(((1 - ComputedMinYear) / 10.0) * AverageDaysPer10Years);
        }
        void add()
        {
            //repair_state==False ==>Update
            // Repair_state=True  ==>Add


            while (true)
            {
                if (String.IsNullOrEmpty(name.Text))
                {
                    DXMessageBox.Show(null, "لم يتم  تحديد اسم العميل لتحديث البيانات", "خطأ", MessageBoxButton.OK, MessageBoxImage.Error);
                    break;
                }

                else if (String.IsNullOrEmpty(price.Text))
                {
                    DXMessageBox.Show(null, "لم يتم  تحديد السعر لتحديث البيانات", "خطأ", MessageBoxButton.OK, MessageBoxImage.Error);
                    break;
                }
                else if (String.IsNullOrEmpty(date.Text))
                {
                    DXMessageBox.Show(null, "لم يتم  تحديد التاريخ لتحديث البيانات", "خطأ", MessageBoxButton.OK, MessageBoxImage.Error);
                    break;
                }
                else if (String.IsNullOrEmpty(content_Prou.Text))
                {
                    MessageBoxResult resultmsg = DXMessageBox.Show(null, @"لم يتم تحديد وصف للمشكلة, هل تريد  مواصلة  العملية؟", "خطأ", MessageBoxButton.YesNo, MessageBoxImage.Error);
                    if (resultmsg == MessageBoxResult.No)
                    {
                        break;
                    }
                    else if (resultmsg == MessageBoxResult.Yes)
                    {
                        content_Prou.Text = "لايوجد";
                    }
                }
                else if (String.IsNullOrEmpty(KIND.Text))
                {
                    DXMessageBox.Show(null, "لم يتم  تحديد نوع الصنف لتحديث البيانات", "خطأ", MessageBoxButton.OK, MessageBoxImage.Error);
                    break;
                }



                if (RepAir_State)
                {
                    if (IsComplete.IsChecked == true)
                    {
                        UmAlQuraCalendar um          = new UmAlQuraCalendar();
                        String           CurrentDate = (int.Parse(DateTime.Now.Year.ToString()) < 1600) ? DateTime.Now.Year.ToString() + "/" + DateTime.Now.Month.ToString() + "/" + DateTime.Now.Day.ToString() :
                                                       um.GetYear(DateTime.Parse(DateTime.Now.ToString())).ToString() + "/" + um.GetMonth(DateTime.Parse(DateTime.Now.ToString())).ToString() + "/" + um.GetDayOfMonth(DateTime.Parse(DateTime.Now.ToString())).ToString();

                        String CurrentDatee = (int.Parse(date.DateTime.Year.ToString()) < 1600) ? date.DateTime.Year.ToString() + "/" + date.DateTime.Month.ToString() + "/" + date.DateTime.Day.ToString() :
                                              um.GetYear(date.DateTime).ToString() + "/" + um.GetMonth(date.DateTime).ToString() + "/" + um.GetDayOfMonth(date.DateTime).ToString();

                        id      = Guid.NewGuid();
                        ID.Text = id.ToString().Substring(id.ToString().IndexOf('-'), 10).Replace("-", "");
                        int    Price  = int.Parse(price.Text);
                        string Price_ = "SAR " + Price.ToString("N0");
                        HelperRepair.Add(ID.Text, name.Text, Price_,



                                         (int.Parse(DateTime.Parse(CurrentDatee).Year.ToString()) < 1600)? CurrentDatee : DateConverter.ConvertToHijri(CurrentDatee)

                                         ,


                                         (int.Parse(DateTime.Parse(CurrentDate).Year.ToString()) < 1600) ? CurrentDate : DateConverter.ConvertToHijri(CurrentDate), content_Prou.Text, KIND.Text, (string.IsNullOrEmpty(discounts.Text) ? "لايوجد" : discounts.Text), false, data);
                        obsrepairview.Add(new Models.RepairVieww()
                        {
                            ID        = ID.Text,
                            NAME      = name.Text,
                            PRICE     = Price_,
                            conprou   = KIND.Text,
                            DAT       = (int.Parse(DateTime.Parse(CurrentDate).Year.ToString()) < 1600) ? CurrentDate : DateConverter.ConvertToHijri(CurrentDate),
                            datrec    = (int.Parse(DateTime.Parse(CurrentDatee).Year.ToString()) < 1600)? CurrentDatee : DateConverter.ConvertToHijri(CurrentDatee),
                            typeprou  = content_Prou.Text,
                            discounts = (string.IsNullOrEmpty(discounts.Text) ? "لايوجد" : discounts.Text)
                        });



                        Data_Add.ItemsSource = obsrepairview;
                        DXMessageBox.Show("تم اضافة طلبكم بنجاح", "!تنبيه", MessageBoxButton.OK, MessageBoxImage.Information);
                    }
                    else
                    {
                        UmAlQuraCalendar um          = new UmAlQuraCalendar();
                        String           CurrentDate = (int.Parse(DateTime.Now.Year.ToString()) < 1600) ? DateTime.Now.Year.ToString() + "/" + DateTime.Now.Month.ToString() + "/" + DateTime.Now.Day.ToString() :
                                                       um.GetYear(DateTime.Parse(DateTime.Now.ToString())).ToString() + "/" + um.GetMonth(DateTime.Parse(DateTime.Now.ToString())).ToString() + "/" + um.GetDayOfMonth(DateTime.Parse(DateTime.Now.ToString())).ToString();

                        String CurrentDatee = (int.Parse(date.DateTime.Year.ToString()) < 1600) ? date.DateTime.Year.ToString() + "/" + date.DateTime.Month.ToString() + "/" + date.DateTime.Day.ToString() :
                                              um.GetYear(date.DateTime).ToString() + "/" + um.GetMonth(date.DateTime).ToString() + "/" + um.GetDayOfMonth(date.DateTime).ToString();

                        id      = Guid.NewGuid();
                        ID.Text = id.ToString().Substring(id.ToString().IndexOf('-'), 10).Replace("-", "");
                        int Price = int.Parse(price.Text);


                        string Price_ = "SAR " + Price.ToString("N0");

                        HelperRepair.Add(ID.Text, name.Text, Price_, (int.Parse(DateTime.Parse(CurrentDatee).Year.ToString()) < 1600)? CurrentDatee : DateConverter.ConvertToHijri(CurrentDatee), (int.Parse(DateTime.Parse(CurrentDate).Year.ToString()) < 1600)? CurrentDate: DateConverter.ConvertToHijri(CurrentDate), content_Prou.Text, KIND.Text, (string.IsNullOrEmpty(discounts.Text) ? "لايوجد" : discounts.Text), true, data);



                        // var obsrepairview = new ObservableCollectionCore<Models.RepairView>();

                        obsrepairview.Add(new Models.RepairVieww()
                        {
                            ID        = ID.Text,
                            NAME      = name.Text,
                            PRICE     = Price_,
                            conprou   = KIND.Text,
                            DAT       = (int.Parse(DateTime.Parse(CurrentDate).Year.ToString()) < 1600) ? CurrentDate : DateConverter.ConvertToHijri(CurrentDate),
                            datrec    = (int.Parse(DateTime.Parse(CurrentDatee).Year.ToString()) < 1600)? CurrentDatee : DateConverter.ConvertToHijri(CurrentDatee),
                            typeprou  = content_Prou.Text,
                            discounts = (string.IsNullOrEmpty(discounts.Text) ? "لايوجد" : discounts.Text)
                        });


                        Data_Add.ItemsSource = obsrepairview;
                        DXMessageBox.Show("تم اضافة طلبكم بنجاح", "!تنبيه", MessageBoxButton.OK, MessageBoxImage.Information);
                    }
                }
                else
                {
                }

                break;
            }

            // ModelMega_Add.add();
        }