示例#1
0
        private string getprice()
        {
            DataTable data = new DataTable();
            var       moe  = new ModelMega();

            moe.show(data);
            var sum = new FunctionsOfSum();

            result = sum.sumPrice(data);
            return(result);
        }
示例#2
0
        private void Make()
        {
            DataTable data = new DataTable();
            var       moe  = new ModelMega();

            moe.show(data);
            foreach (DataRow item in data.Rows)
            {
                a.Add((item.Field <Int64>("isdone") == 0)?0:-1);
            }
        }
示例#3
0
        public MainWindowView()
        {
            var datatable = new DataTable();
            var modelmega = new ModelMega();

            modelmega.show(datatable);
            foreach (DataRow item in datatable.Rows)
            {
                if (item.Field <Int64>("isdone") == -1)
                {
                    flag += 1;
                }
            }
        }
        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;
            }
        }