Exemple #1
0
        private void Encode1_EditValueChanged(object sender, DevExpress.Xpf.Editors.EditValueChangedEventArgs e)
        {
            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)
                });
            }
            switch (Encode1.Text)
            {
            case "/m": { ZMounth(); break; }

            case "/d": { Zday(); break; }

            case "/y": { Zyear(); break; }

            default: { DDR.ItemsSource = obr; Resultpri_a.Text = Fos.sumPrice_a(); break; }
            }
        }
Exemple #2
0
        private List <string> SaveDelete()
        {
            var result   = new List <string>();
            var obr      = new ObservableCollectionCore <Models.RepairView>();
            var megaView = new MegaView();

            foreach (DataRow item in megaView.GetAllItemsHasSold().Rows)
            {
                if (item.Field <Int64>("isdone") != -1)
                {
                    result.Add(item.Field <string>("ID"));
                }
            }
            return(result);
        }
Exemple #3
0
        public string sumPrice(ObservableCollectionCore <Models.RepairView> collection)
        {
            var megaview = new MegaView();

            var listPrice = new List <string>();

            foreach (DataRow item in megaview.GetAllItemsHasSold().Rows)
            {
                listPrice.Add(item.Field <string>("PRICE"));
            }
            double result = 0;

            for (int i = 0; i < listPrice.Count; i++)
            {
                result += double.Parse(listPrice[i].Replace("SAR", "").Replace(",", ""));
            }
            return("SAR " + result.ToString("N0"));
        }
Exemple #4
0
        private void Repair_Selected(object sender, RoutedEventArgs e)
        {
            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();
            try
            {
                DDa.Visibility     = Visibility.Hidden;
                DD.Visibility      = Visibility.Hidden;
                DDR.Visibility     = Visibility.Visible;
                Encode.IsEnabled   = false;
                Encode.Visibility  = Visibility.Hidden;
                Encode1.IsEnabled  = true;
                Encode1.Visibility = Visibility.Visible;
                Encode.Clear();
                IS_SELECTED        = false;
                is_Repair_Selected = true;
                Delete.IsEnabled   = true;
            }
            catch (Exception ex) { }
        }
Exemple #5
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
            }
        }