コード例 #1
0
        private static void InsertDataIntoDataTable()
        {
            CountingisNotDone = 0;
            CountingAll       = 0;
            Countingisdone    = 0;
            var datatable = new DataTable();
            var modelmega = new ModelMega();

            modelmega.show(datatable);
            foreach (DataRow item in datatable.Rows)
            {
                //  Regestir_.Add((item.Field<Int64>("isdone")));
                if (item.Field <Int64>("isdone") == -1)
                {
                    Countingisdone += 1;
                }
                else if (item.Field <Int64>("isdone") != -1)
                {
                    CountingisNotDone += 1;
                }

                //Countingisdone += (item.Field<Int64>("isdone")==true) ? Countingisdone++ :0;
                //CountingisNotDone += (item.Field<Int64>("isdone")==false) ? CountingisNotDone++ : 0;

                CountingAll += 1;
            }
        }
コード例 #2
0
        public ObservableCollectionCore <Models.RepairView> Sales_2(string name)
        {
            var ID       = new List <string>();
            var NAME     = new List <string>();
            var PRICE    = new List <string>();
            var conprou  = new List <string>();
            var DAT      = new List <string>();
            var datrec   = new List <string>();
            var typeprou = new List <string>();
            var discouns = new List <string>();
            var isdone   = new List <bool>();

            DataTable dt      = new DataTable();
            var       Getdata = new ModelMega();

            Getdata.show(dt);
            foreach (DataRow item in dt.Rows)
            {
                NAME.Add(item.Field <String>("NAME"));
                PRICE.Add(item.Field <String>("PRICE"));
                ID.Add(item.Field <String>("ID"));
                DAT.Add(item.Field <String>("DAT"));
                datrec.Add(item.Field <String>("datrec"));
                typeprou.Add(item.Field <String>("typeprou"));
                discouns.Add(item.Field <String>("discounts"));
                conprou.Add(item.Field <String>("conprou"));
                isdone.Add(item.Field <Int64>("isdone") == -1?true:false);
            }

            ObservableCollectionCore <Models.RepairView> sales = new ObservableCollectionCore <Models.RepairView>();

            for (int i = 0; i < NAME.Count; i++)
            {
                if (NAME[i].Contains(name))
                {
                    sales.Add(new Models.RepairView()
                    {
                        conprou   = conprou[i],
                        DAT       = DAT[i],
                        datrec    = datrec[i],
                        discounts = discouns[i],
                        ID        = ID[i],
                        NAME      = NAME[i],
                        PRICE     = PRICE[i],
                        typeprou  = typeprou[i],
                        isdone    = isdone[i] ?false:true
                    });
                }
            }
            return(sales);
        }
        public static void Edit(string id, string name, string price, string date, string darec, string conprou, string typeprou, string discounts, bool isdone, DataTable data)
        {
            var ModelMega = new ModelMega();
            int Booolint  = (isdone) ? -1 : 0;

            if (isdone)
            {
                ModelMega.Edit(id, name, price, date, darec, conprou, typeprou, discounts, Booolint);
            }

            else
            {
                ModelMega.Edit(id, name, price, date, darec, conprou, typeprou, discounts, Booolint);
            }

            ModelMega.show(data);
        }
コード例 #4
0
        public static List <string> GetMonths()
        {
            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")).Month.ToString() :
                              um.GetMonth(DateTime.Parse(item.Field <string>("datrec"))).ToString());
            }


            return(WholeDate);
        }
コード例 #5
0
        public DataTable GetAllItemsHasSold2()
        {
            var Datatable = new DataTable();//target DataTable

            #region Columns
            Datatable.Columns.Add("ID", typeof(string));
            Datatable.Columns.Add("NAME", typeof(string));
            Datatable.Columns.Add("PRICE", typeof(string));
            Datatable.Columns.Add("DAT", typeof(string));
            Datatable.Columns.Add("discounts", typeof(string));
            Datatable.Columns.Add("datrec", typeof(string));
            Datatable.Columns.Add("conprou", typeof(string));
            Datatable.Columns.Add("typeprou", typeof(string));
            Datatable.Columns.Add("isdone", typeof(bool));
            #endregion
            var datatable = new DataTable();
            var HData     = new ModelMega();
            HData.show1(datatable);
            foreach (DataRow item in datatable.Rows)
            {
                if (item.Field <Int64>("isdone") == -1)
                {
                    Datatable.Rows.Add
                        (item.Field <String>("ID"),
                        item.Field <String>("NAME"),
                        item.Field <String>("PRICE"),
                        item.Field <String>("DAT"),
                        item.Field <String>("discounts"),
                        item.Field <String>("datrec"),
                        item.Field <String>("conprou"),
                        item.Field <String>("typeprou"),
                        -1
                        );
                }
            }
            return(Datatable);
        }
コード例 #6
0
        private void Delete_click(object sender, RoutedEventArgs e)
        {
            ///
            if (DD.Visibility == Visibility.Visible)
            {
                #region DataGrid #1
                DD.BeginSelection();
                string index    = "";
                var    acc      = new Assest.OrcDataAcess();
                int    counting = 0;

                foreach (int handle in DD.GetSelectedRowHandles())
                {
                    if (counting == 0)
                    {
                        MessageBoxResult a = DXMessageBox.Show("سيتم حذف جميع الفواتير المحدد عليها, هل ترغب بمواصلة العملية؟", "تنبيه", MessageBoxButton.YesNo, MessageBoxImage.Information);
                        switch (a)
                        {
                        case MessageBoxResult.None:
                            break;

                        case MessageBoxResult.OK:
                        {
                            break;
                        }

                        case MessageBoxResult.Cancel:
                            break;

                        case MessageBoxResult.Yes:
                        {
                            index = (string)DD.GetCellValue(handle, "id");
                            acc.Delete3(index);

                            break;
                        }

                        case MessageBoxResult.No:
                            break;

                        default:
                            break;
                        }
                    }
                    else if (counting >= 1)
                    {
                        index = (string)DD.GetCellValue(handle, "id");
                        acc.Delete3(index);
                    }



                    counting++;
                }
                if (counting == 0)
                {
                    MessageBoxResult a = DXMessageBox.Show("سيتم حذف جميع الفواتير, هل ترغب بمواصلة العملية؟", "تنبيه", MessageBoxButton.YesNo, MessageBoxImage.Information);
                    switch (a)
                    {
                    case MessageBoxResult.None:
                        break;

                    case MessageBoxResult.OK:
                    {
                        break;
                    }

                    case MessageBoxResult.Cancel:
                        break;

                    case MessageBoxResult.Yes:
                    {
                        acc.Delete3();
                        break;
                    }

                    case MessageBoxResult.No:
                        break;

                    default:
                        break;
                    }
                }
                DD.EndSelection();
                var datatablee = new DataTable();
                show.show3(datatablee);

                System.Windows.Forms.BindingSource BindS = new System.Windows.Forms.BindingSource();
                BindS.DataSource = datatablee;
                DD.ItemsSource   = BindS;

                Resultpri.Text   = Fos.sumPrice();
                Resultpri_a.Text = Fos.sumPrice_a();
                #endregion
            }
            else if (DDR.Visibility == Visibility.Visible)
            {
                #region Datagrid #2
                DDR.BeginSelection();
                var listU = new List <string>();
                listU = SaveDelete();

                string iindex    = "";
                int    countingg = 0;
                var    megav     = new ModelMega();

                foreach (int handle in DDR.GetSelectedRowHandles())
                {
                    if (countingg == 0)
                    {
                        MessageBoxResult a = DXMessageBox.Show("سيتم حذف جميع البيانات المحدد عليها, هل ترغب بمواصلة العملية؟", "تنبيه", MessageBoxButton.YesNo, MessageBoxImage.Information);
                        switch (a)
                        {
                        case MessageBoxResult.None:
                            break;

                        case MessageBoxResult.OK:
                        {
                            break;
                        }

                        case MessageBoxResult.Cancel:
                            break;

                        case MessageBoxResult.Yes:
                        {
                            iindex = (string)DDR.GetCellValue(handle, "رمز المنتج");
                            megav.Delete(iindex);

                            break;
                        }

                        case MessageBoxResult.No:
                            break;

                        default:
                            break;
                        }
                    }
                    else if (countingg >= 1)
                    {
                        iindex = (string)DDR.GetCellValue(handle, "رمز المنتج");
                        megav.Delete(iindex);
                    }



                    countingg++;
                }
                if (countingg == 0)
                {
                    MessageBoxResult a = DXMessageBox.Show("سيتم حذف جميع البيانات, هل ترغب بمواصلة العملية؟", "تنبيه", MessageBoxButton.YesNo, MessageBoxImage.Information);
                    switch (a)
                    {
                    case MessageBoxResult.None:
                        break;

                    case MessageBoxResult.OK:
                    {
                        break;
                    }

                    case MessageBoxResult.Cancel:
                        break;

                    case MessageBoxResult.Yes:
                    {
                        ///Need To Fix_+_+_+_+__++_+_+__+_+_++_+_+_+__+_+__+_
                        megav.Delete();

                        break;
                    }

                    case MessageBoxResult.No:
                        break;

                    default:
                        break;
                    }
                }
                DDR.EndSelection();
                var obr      = new ObservableCollectionCore <Models.RepairView>();
                var megaView = new MegaView();
                foreach (DataRow item in megaView.GetAllItemsHasSold().Rows)
                {
                    obr.Add(new Models.RepairView()
                    {
                        ID        = item.Field <string>("ID"),
                        conprou   = item.Field <string>("conprou"),
                        PRICE     = item.Field <string>("PRICE"),
                        DAT       = item.Field <string>("DAT"),
                        NAME      = item.Field <string>("NAME"),
                        datrec    = item.Field <string>("datrec"),
                        discounts = item.Field <string>("discounts"),
                        typeprou  = item.Field <string>("typeprou"),
                        isdone    = (item.Field <Int64>("isdone") == -1?true:false)
                    });
                }
                DDR.ItemsSource = obr; Resultpri_a.Text = Fos.sumPrice_a();

                #endregion
            }
        }
コード例 #7
0
        /*
         *
         * ID = item.Field<string>("ID"),
         *          conprou = item.Field<string>("conprou"),
         *          PRICE = item.Field<string>("PRICE"),
         *          DAT = item.Field<string>("DAT"),
         *          NAME = item.Field<string>("NAME"),
         *          datrec = item.Field<string>("datrec"),
         *          discounts = item.Field<string>("discounts"),
         *          typeprou = item.Field<string>("typeprou"),
         *          isdone = (item.Field<Int64>("isdone")) ? GetImage(@"/images/ionicons_2-0-1_ios-timer_23_0_27ae60_none.png") : GetImage(@"/images/material-icons_3-0-1_done_23_0_27ae60_none.png")
         *
         *
         */
        public void Create(TypeSearch Type, ObservableCollectionCore <Models.RepairView> data)
        {
            var ID        = new List <string>();
            var conprou   = new List <string>();
            var PRICE     = new List <string>();
            var DAT       = new List <string>();
            var NAME      = new List <string>();
            var datrec    = new List <string>();
            var discounts = new List <string>();
            var typeprou  = new List <string>();
            var isdone    = new List <bool>();

            var           ID_        = new List <string>();
            var           conprou_   = new List <string>();
            var           PRICE_     = new List <string>();
            var           DAT_       = new List <string>();
            var           NAME_      = new List <string>();
            var           datrec_    = new List <string>();
            var           discounts_ = new List <string>();
            var           typeprou_  = new List <string>();
            var           isdone_    = new List <bool>();
            BindingSource bind       = new BindingSource();


            if (Type == TypeSearch.Day)
            {
                DataTable dt        = new DataTable();
                var       gettables = new ModelMega();
                gettables.show(dt);
                foreach (DataRow item in dt.Rows)
                {
                    ID.Add(item.Field <string>("ID"));
                    conprou.Add(item.Field <string>("conprou"));
                    PRICE.Add(item.Field <string>("PRICE"));
                    DAT.Add(item.Field <string>("DAT"));
                    NAME.Add(item.Field <string>("NAME"));
                    datrec.Add(item.Field <string>("datrec"));
                    discounts.Add(item.Field <string>("discounts"));
                    typeprou.Add(item.Field <string>("typeprou"));
                    isdone.Add(item.Field <Int64>("isdone") == -1);
                }


                var daylist = new List <string>();
                foreach (var item in GetDays())
                {
                    daylist.Add(item);
                }
                for (int i = 0; i < daylist.Count; i++)
                {
                    if (SealsFunction.ExtractDaysFromDate() == daylist[i])
                    {
                        ID_.Add(ID[i]);
                        conprou_.Add(conprou[i]);
                        PRICE_.Add(PRICE[i]);
                        DAT_.Add(DAT[i]);
                        NAME_.Add(NAME[i]);
                        datrec_.Add(datrec[i]);
                        discounts_.Add(discounts[i]);
                        typeprou_.Add(typeprou[i]);
                        isdone_.Add(isdone[i]);
                    }
                }

                var modelmega = new ModelMega();
                for (int ii = 0; ii < NAME_.Count; ii++)
                {
                    //ID_.Add(ID[i]);
                    //conprou_.Add(conprou[i]);
                    //PRICE_.Add(PRICE[i]);
                    //DAT_.Add(DAT[i]);
                    //NAME_.Add(NAME[i]);
                    //datrec_.Add(datrec[i]);
                    //discounts_.Add(discounts[i]);
                    //typeprou_.Add(typeprou[i]);
                    //isdone_.Add(isdone[i]);

                    if (isdone_[ii])
                    {
                        data.Add(new Models.RepairView()
                        {
                            ID        = ID_[ii],
                            conprou   = conprou_[ii],
                            DAT       = DAT_[ii],
                            datrec    = datrec_[ii],
                            discounts = discounts_[ii],
                            isdone    = isdone_[ii]
                            ,
                            NAME     = NAME_[ii],
                            PRICE    = PRICE_[ii],
                            typeprou = typeprou_[ii]
                        });

                        modelmega.add1(ID_[ii], NAME_[ii], PRICE_[ii], DAT[ii], datrec_[ii], conprou_[ii], typeprou_[ii], discounts_[ii], (isdone_[ii])?-1:0);
                    }


                    //datarow["ID"] = ID_[ii];
                    //datarow["NAME"] = NAME_[ii];
                    //datarow["DAT"] = DAT_[ii];
                    //datarow["datrec"] = datrec_[ii];
                    //datarow["typeprou"] = typeprou_[ii];
                    //datarow["PRICE"] = PRICE_[ii];
                    //datarow["discounts"] = discounts_[ii];
                    //datarow["conprou"] = conprou_[ii];
                    //datarow["isdone"] = isdone_[ii];
                }
            }
            else if (Type == TypeSearch.Year)
            {
                DataTable dt        = new DataTable();
                var       gettables = new ModelMega();
                gettables.show(dt);
                foreach (DataRow item in dt.Rows)
                {
                    ID.Add(item.Field <string>("ID"));
                    conprou.Add(item.Field <string>("conprou"));
                    PRICE.Add(item.Field <string>("PRICE"));
                    DAT.Add(item.Field <string>("DAT"));
                    NAME.Add(item.Field <string>("NAME"));
                    datrec.Add(item.Field <string>("datrec"));
                    discounts.Add(item.Field <string>("discounts"));
                    typeprou.Add(item.Field <string>("typeprou"));
                    isdone.Add(item.Field <Int64>("isdone") == -1);
                }


                var daylist = new List <string>();
                foreach (var item in GetYears())
                {
                    daylist.Add(item);
                }
                for (int i = 0; i < daylist.Count; i++)
                {
                    if (SealsFunction.ExtractyearsFromDate() == daylist[i])
                    {
                        ID_.Add(ID[i]);
                        conprou_.Add(conprou[i]);
                        PRICE_.Add(PRICE[i]);
                        DAT_.Add(DAT[i]);
                        NAME_.Add(NAME[i]);
                        datrec_.Add(datrec[i]);
                        discounts_.Add(discounts[i]);
                        typeprou_.Add(typeprou[i]);
                        isdone_.Add(isdone[i]);
                    }
                }



                var modelmega = new ModelMega();



                for (int ii = 0; ii < NAME_.Count; ii++)
                {
                    if (isdone_[ii])
                    {
                        data.Add(new Models.RepairView()
                        {
                            ID        = ID_[ii],
                            conprou   = conprou_[ii],
                            DAT       = DAT_[ii],
                            datrec    = datrec_[ii],
                            discounts = discounts_[ii],
                            isdone    = isdone_[ii]
                            ,
                            NAME     = NAME_[ii],
                            PRICE    = PRICE_[ii],
                            typeprou = typeprou_[ii]
                        });

                        modelmega.add1(ID_[ii], NAME_[ii], PRICE_[ii], DAT[ii], datrec_[ii], conprou_[ii], typeprou_[ii], discounts_[ii], (isdone_[ii]) ? -1 : 0);
                    }
                }
            }
            else
            if (Type == TypeSearch.Month)
            {
                DataTable dt        = new DataTable();
                var       gettables = new ModelMega();
                gettables.show(dt);
                foreach (DataRow item in dt.Rows)
                {
                    ID.Add(item.Field <string>("ID"));
                    conprou.Add(item.Field <string>("conprou"));
                    PRICE.Add(item.Field <string>("PRICE"));
                    DAT.Add(item.Field <string>("DAT"));
                    NAME.Add(item.Field <string>("NAME"));
                    datrec.Add(item.Field <string>("datrec"));
                    discounts.Add(item.Field <string>("discounts"));
                    typeprou.Add(item.Field <string>("typeprou"));
                    isdone.Add(item.Field <Int64>("isdone") == -1);
                }


                var daylist = new List <string>();
                foreach (var item in GetMonths())
                {
                    daylist.Add(item);
                }
                for (int i = 0; i < daylist.Count; i++)
                {
                    if (SealsFunction.ExtractmonthsFromDate() == daylist[i])
                    {
                        ID_.Add(ID[i]);
                        conprou_.Add(conprou[i]);
                        PRICE_.Add(PRICE[i]);
                        DAT_.Add(DAT[i]);
                        NAME_.Add(NAME[i]);
                        datrec_.Add(datrec[i]);
                        discounts_.Add(discounts[i]);
                        typeprou_.Add(typeprou[i]);
                        isdone_.Add(isdone[i]);
                    }
                }

                var modelmega = new ModelMega();
                for (int ii = 0; ii < NAME_.Count; ii++)
                {
                    if (isdone_[ii])
                    {
                        data.Add(new Models.RepairView()
                        {
                            ID        = ID_[ii],
                            conprou   = conprou_[ii],
                            DAT       = DAT_[ii],
                            datrec    = datrec_[ii],
                            discounts = discounts_[ii],
                            isdone    = isdone_[ii]
                            ,
                            NAME     = NAME_[ii],
                            PRICE    = PRICE_[ii],
                            typeprou = typeprou_[ii]
                        });

                        modelmega.add1(ID_[ii], NAME_[ii], PRICE_[ii], DAT[ii], datrec_[ii], conprou_[ii], typeprou_[ii], discounts_[ii], (isdone_[ii]) ? -1 : 0);
                    }
                }
            }
        }