Ejemplo n.º 1
0
 public void DeleteMainRow()
 {
     if (SelectedMainRows != null)
     {
         var res = MessageBox.Show("Are You To Delete SelectedRecords From Database ?", "Delete",
                                   MessageBoxButton.OKCancel);
         if (res == MessageBoxResult.OK)
         {
             foreach (var row in SelectedMainRows)
             {
                 if (row.Iserial != 0)
                 {
                     if (AllowDelete != true)
                     {
                         MessageBox.Show(strings.AllowDeleteMsg);
                         return;
                     }
                     Loading = true;
                     Client.DeleteSmlAsync(
                         (TblSeasonalMasterList) new TblSeasonalMasterList().InjectFrom(row), MainRowList.IndexOf(row));
                 }
                 else
                 {
                     MainRowList.Remove(row);
                 }
             }
         }
     }
 }
Ejemplo n.º 2
0
 public void DeleteMainRow()
 {
     if (SelectedMainRows != null)
     {
         var res = MessageBox.Show("Are You To Delete SelectedRecords From Database ?", "Delete",
                                   MessageBoxButton.OKCancel);
         if (res == MessageBoxResult.OK)
         {
             foreach (var row in SelectedMainRows)
             {
                 if (row.Iserial != 0)
                 {
                     if (AllowDelete != true)
                     {
                         MessageBox.Show(strings.AllowDeleteMsg);
                         return;
                     }
                     Glclient.DeleteTblGlRuleHeaderAsync((TblGlRuleHeader) new TblGlRuleHeader().InjectFrom(row), 0, LoggedUserInfo.DatabasEname);
                 }
                 else
                 {
                     MainRowList.Remove(row);
                     if (!MainRowList.Any())
                     {
                         AddNewMainRow(false);
                     }
                 }
             }
         }
     }
 }
Ejemplo n.º 3
0
 public void DeleteMainRow()
 {
     if (SelectedMainRows != null)
     {
         var res = MessageBox.Show("Are You To Delete SelectedRecords From Database ?", "Delete",
                                   MessageBoxButton.OKCancel);
         if (res == MessageBoxResult.OK)
         {
             foreach (var row in SelectedMainRows)
             {
                 if (row.Iserial != 0)
                 {
                     Loading = true;
                     Client.DeleteTblUserCheckListAsync(
                         (TblUserCheckList) new TblUserCheckList().InjectFrom(row), MainRowList.IndexOf(row));
                 }
                 else
                 {
                     MainRowList.Remove(row);
                     if (!MainRowList.Any())
                     {
                         AddNewMainRow(false);
                     }
                 }
             }
         }
     }
 }
Ejemplo n.º 4
0
 public void DeleteMainRow()
 {
     if (SelectedMainRows != null)
     {
         var res = MessageBox.Show("Are You To Delete SelectedRecords From Database ?", "Delete",
                                   MessageBoxButton.OKCancel);
         if (res == MessageBoxResult.OK)
         {
             foreach (var row in SelectedMainRows)
             {
                 if (row.Iserial != 0)
                 {
                     if (AllowDelete != true)
                     {
                         MessageBox.Show(strings.AllowDeleteMsg);
                         return;
                     }
                     Loading = true;
                     Client.DeleteTblSalesOrderColorThemeAsync(
                         (TblSalesOrderColorTheme) new TblSalesOrderColorTheme().InjectFrom(row), MainRowList.IndexOf(row));
                 }
                 else
                 {
                     MainRowList.Remove(row);
                     if (!MainRowList.Any())
                     {
                         AddNewMainRow(false);
                     }
                 }
             }
         }
     }
 }
Ejemplo n.º 5
0
        internal void Delete()
        {
            var res = MessageBox.Show("Are You To Delete SelectedRecords From Database ?", "Delete",
                                      MessageBoxButton.OKCancel);

            if (res == MessageBoxResult.OK)
            {
                Loading = true;
                foreach (var item in SelectedMainRows)
                {
                    if (item.Iserial == 0)
                    {
                        MainRowList.Remove(item);
                        if (!MainRowList.Any())
                        {
                            AddNewMainRow(false);
                        }
                    }
                    else
                    {
                        if (AllowDelete != true)
                        {
                            MessageBox.Show(strings.AllowDeleteMsg);
                            return;
                        }
                        Loading = true;
                        Glclient.DeleteGenericAsync(TablEname, item.Iserial.ToString(CultureInfo.InvariantCulture),
                                                    LoggedUserInfo.DatabasEname);
                    }
                }
            }
        }
Ejemplo n.º 6
0
 public void DeleteMainRow()
 {
     if (SelectedMainRows != null)
     {
         var res = MessageBox.Show("Are You To Delete SelectedRecords From Database ?", "Delete",
                                   MessageBoxButton.OKCancel);
         if (res == MessageBoxResult.OK)
         {
             var ListInt = SelectedMainRows.Select(w => w.Iserial).ToList();
             var ObsInt  = new ObservableCollection <int>();
             foreach (var item in ListInt)
             {
                 ObsInt.Add(item);
             }
             if (AllowDelete != true)
             {
                 MessageBox.Show(strings.AllowDeleteMsg);
                 return;
             }
             Glclient.DeleteTblJournalSettingAsync(ObsInt, LoggedUserInfo.DatabasEname);
             foreach (var row in SelectedMainRows.Where(w => w.Iserial == 0).ToList())
             {
                 MainRowList.Remove(row);
             }
             if (!MainRowList.Any())
             {
                 AddNewMainRow(false);
             }
         }
     }
 }
        public EmpLeavingTransactionViewModel()
        {
            if (!DesignerProperties.IsInDesignTool)
            {
                GetItemPermissions(PermissionItemName.EmpLeavingTransactionForm.ToString());
                GetCustomePermissions(PermissionItemName.EmpLeavingTransactionForm.ToString());
                PremCompleted += (s, sv) => AddNewMainRow(false);
                Client.UpdateOrInsertEmpLeavingTransactionCompleted += (s, x) =>
                {
                    var savedRow = (TblEmpLeavingTransactionViewModel)MainRowList.GetItemAt(x.outindex);

                    if (savedRow != null)
                    {
                        savedRow.InjectFrom(x.Result);
                    }
                    Loading = false;
                };
                Client.SearchBysStoreNameAsync(new ObservableCollection <int>(LoggedUserInfo.AllowedStores), LoggedUserInfo.Iserial, null, null, LoggedUserInfo.DatabasEname);

                Client.SearchBysStoreNameCompleted += (s, sv) =>
                {
                    foreach (var variable in sv.Result)
                    {
                        Client.GetEmpTablebyStoreAndCompanyAsync(LoggedUserInfo.DatabasEname, variable.code);
                        Store = variable.code;
                    }
                };
                Client.DeleteEmpLeavingTransactionCompleted += (s, ev) =>
                {
                    if (ev.Error != null)
                    {
                        throw ev.Error;
                    }

                    var oldrow = MainRowList.FirstOrDefault(x => x.Iserial == ev.Result);
                    if (oldrow != null)
                    {
                        MainRowList.Remove(oldrow);
                    }
                    if (!MainRowList.Any())
                    {
                        AddNewMainRow(false);
                    }
                };
                EmpList = new ObservableCollection <EmployeesView>();
                Client.GetEmpTablebyStoreAndCompanyCompleted += (s, sv) =>
                {
                    foreach (var variable in sv.Result)
                    {
                        EmpList.Add(variable);
                    }
                };
            }
        }
Ejemplo n.º 8
0
 public void DeleteMainRow()
 {
     if (SelectedMainRows != null)
     {
         foreach (var row in SelectedMainRows)
         {
             MainRowList.Remove(row);
             if (!MainRowList.Any())
             {
                 AddNewMainRow(false);
             }
         }
     }
 }
Ejemplo n.º 9
0
        public void DeleteMainRow(TblStyleImageViewModel row)
        {
            var res = MessageBox.Show("Are You To Delete SelectedRecords From Database ?", "Delete",
                                      MessageBoxButton.OKCancel);

            if (res == MessageBoxResult.OK)
            {
                if (row.Iserial == 0)
                {
                    MainRowList.Remove(row);
                }
                else
                {
                    Client.DeleteTblStyleImageAsync(
                        (TblStyleImage) new TblStyleImage().InjectFrom(row), MainRowList.IndexOf(row));
                }
            }
        }
Ejemplo n.º 10
0
 public void DeleteMainRow()
 {
     if (SelectedMainRows != null)
     {
         var res = MessageBox.Show("Are You To Delete SelectedRecords From Database ?", "Delete",
                                   MessageBoxButton.OKCancel);
         if (res == MessageBoxResult.OK)
         {
             foreach (var row in SelectedMainRows)
             {
                 if (row.Iserial != 0)
                 {
                     Client.DeleteTblCheckListMailAsync(
                         (TblCheckListMail) new TblCheckListMail().InjectFrom(row), MainRowList.IndexOf(row));
                 }
                 else
                 {
                     MainRowList.Remove(row);
                 }
             }
         }
     }
 }
Ejemplo n.º 11
0
 public void DeleteMainRow()
 {
     if (SelectedMainRows != null)
     {
         var res = MessageBox.Show("Are You To Delete SelectedRecords From Database ?", "Delete",
                                   MessageBoxButton.OKCancel);
         if (res == MessageBoxResult.OK)
         {
             foreach (var row in SelectedMainRows)
             {
                 if (row.Iserial != 0)
                 {
                     AuthClient.DeleteUserAsync(row.Iserial);
                     Loading = true;
                 }
                 else
                 {
                     MainRowList.Remove(row);
                 }
             }
         }
     }
 }
Ejemplo n.º 12
0
 public void DeleteMainRow()
 {
     if (SelectedMainRows != null)
     {
         var res = MessageBox.Show("Are You To Delete SelectedRecords From Database ?", "Delete",
                                   MessageBoxButton.OKCancel);
         if (res == MessageBoxResult.OK)
         {
             foreach (var row in SelectedMainRows)
             {
                 if (row.GlSerial != 0)
                 {
                     Client.DeleteFingerPrintTransactionAsync(
                         (FingerPrintTransaction) new FingerPrintTransaction().InjectFrom(row), MainRowList.IndexOf(row));
                 }
                 else
                 {
                     MainRowList.Remove(row);
                 }
             }
         }
     }
 }
Ejemplo n.º 13
0
        public DyeingOrderInvoiceViewModel() : base(PermissionItemName.DyeingOrderInvoice)
        {
            GetItemPermissions(PermissionItemName.DyeingOrderInvoice.ToString());
            //PermissionItemName.dyeing
            DyeingServiceClient.PostDyeingOrderInvoiceCompleted += (s, sv) =>
            {
                if (sv.Result != null)
                {
                    SelectedMainRow.InjectFrom(sv.Result);
                }
                SelectedMainRow.VisPosted = false;
                MessageBox.Show("Posted Completed");
            };
            DyeingServiceClient.DeleteDyeingOrderInvoiceHeaderCompleted += (s, ev) =>
            {
                if (ev.Error != null)
                {
                    MessageBox.Show(ev.Error.Message);
                }
                var oldrow = MainRowList.FirstOrDefault(x => x.Iserial == ev.Result);
                if (oldrow != null)
                {
                    MainRowList.Remove(oldrow);
                }
            };

            MiscValueTypeList = new ObservableCollection <GenericTable>
            {
                new GenericTable {
                    Iserial = 0, Code = "%", Ename = "%", Aname = "%"
                },
                new GenericTable {
                    Iserial = 1, Code = "Value", Ename = "Value", Aname = "Value"
                }
            };

            var currencyClient = new GlService.GlServiceClient();

            currencyClient.GetGenericCompleted += (s, sv) =>
            {
                CurrencyList = new ObservableCollection <CRUDManagerService.GenericTable>();
                foreach (var item in sv.Result)
                {
                    CurrencyList.Add(new CRUDManagerService.GenericTable().InjectFrom(item) as CRUDManagerService.GenericTable);
                }
            };
            currencyClient.GetGenericAsync("TblCurrency", "%%", "%%", "%%", "Iserial", "ASC", LoggedUserInfo.DatabasEname);

            var journalAccountTypeClient = new GlService.GlServiceClient();

            journalAccountTypeClient.GetGenericCompleted += (s, sv) =>
            {
                JournalAccountTypeList = sv.Result;
            };
            journalAccountTypeClient.GetGenericAsync("TblJournalAccountType", "%%", "%%", "%%", "Iserial", "ASC", LoggedUserInfo.DatabasEname);


            PurchasePlanClient.GetTblMarkupProdAsync(0, int.MaxValue, "it.Iserial", null, null, LoggedUserInfo.DatabasEname);

            PurchasePlanClient.GetTblMarkupProdCompleted += (s, sv) =>
            {
                MarkupList = new ObservableCollection <TblMarkupProd>();
                foreach (var item in sv.Result)
                {
                    MarkupList.Add(new TblMarkupProd().InjectFrom(item) as TblMarkupProd);
                }

                // MarkupList = sv.Result;
            };



            SelectedMainRow = new TblDyeingOrderInvoiceHeaderViewModel {
                DocDate = DateTime.Now
            };

            DyeingServiceClient.UpdateOrInsertDyeingOrderInvoiceHeaderCompleted += (s, sv) =>
            {
                if (sv.Error != null)
                {
                    MessageBox.Show(sv.Error.Message);
                }
                try
                {
                    SelectedMainRow.InjectFrom(sv.Result);

                    if (SelectedMainRow.Status == 0)
                    {
                        SelectedMainRow.VisPosted = true;
                    }
                    else
                    {
                        SelectedMainRow.VisPosted = false;
                    }
                }

                catch (Exception)
                {
                }
                Loading = false;
                if (OpenMisc)
                {
                    new MarkupTransProdChildWindow(this).Show();
                    OpenMisc = false;
                }
            };

            PurchasePlanClient.UpdateOrInsertDyeingOrderInvoiceMarkupTransProdsCompleted += (s, x) =>
            {
                var markup = new TblMarkupProd();
                try
                {
                    var row = SelectedMainRow.MarkUpTransList.ElementAt(x.outindex);
                    if (row != null)
                    {
                        markup = row.TblMarkupProd1;
                    }
                    if (x.Result.Iserial == -1)
                    {
                        MessageBox.Show("This Markup Is Not Linked To Account");
                        row.TblMarkupProd1 = null;
                    }
                    else
                    {
                        SelectedMainRow.MarkUpTransList.ElementAt(x.outindex).InjectFrom(x.Result);
                        if (row != null)
                        {
                            row.TblMarkupProd1 = markup;
                        }
                    }
                }
                catch (Exception)
                {
                }

                Loading = false;
            };
            DyeingServiceClient.GetDyeingOrderInvoiceHeaderCompleted += (s, sv) =>
            {
                Loading = false;
                MainRowList.Clear();
                foreach (var variable in sv.Result.ToList())
                {
                    var newvendor = new Vendor();
                    newvendor.InjectFrom(sv.Vendors.FirstOrDefault(w => w.vendor_code == variable.Vendor));

                    var newrow = new TblDyeingOrderInvoiceHeaderViewModel();
                    newrow.InjectFrom(variable);
                    newrow.VendorPerRow = newvendor;
                    if (newrow.Status == 0)
                    {
                        newrow.VisPosted = true;
                    }
                    newrow.CurrencyPerRow = new GenericTable();
                    newrow.CurrencyPerRow.InjectFrom(CurrencyList.FirstOrDefault(w => w.Iserial == variable.TblCurrency));
                    newrow.TblCurrency = variable.TblCurrency;
                    MainRowList.Add(newrow);
                }
            };

            DyeingServiceClient.GetDyeingOrderInvoiceDetailCompleted += (s, sv) =>
            {
                foreach (var variable in sv.Result.ToList())
                {
                    var newrow = new TblDyeingOrderInvoiceDetailViewModel();
                    newrow.InjectFrom(variable);
                    newrow.ServicePerRow       = new TblService();
                    newrow.ColorPerRow         = new TblColor();
                    newrow.ColorPerRow.Code    = variable.TblColor1.Code;
                    newrow.ServicePerRow.Code  = variable.TblService1.Code;
                    newrow.ServicePerRow.Ename = variable.TblService1.Ename;
                    TransactionDetails.Add(newrow);
                }
            };
            DyeingServiceClient.SearchDyeingOrderInvoiceCompleted += (s, sv) =>
            {
                TransactionDetails.Clear();
                foreach (var variable in sv.Result.ToList())
                {
                    var newrow = new TblDyeingOrderInvoiceDetailViewModel();
                    newrow.InjectFrom(variable);
                    newrow.ServicePerRow       = new TblService();
                    newrow.ColorPerRow         = new TblColor();
                    newrow.ColorPerRow.Code    = variable.ColorCode;
                    newrow.ServicePerRow.Code  = variable.ServiceCode;
                    newrow.ServicePerRow.Ename = variable.ServiceName;
                    newrow.SupplierInv         = variable.SupplierInv;
                    TransactionDetails.Add(newrow);
                }
            };

            PurchasePlanClient.DyeingOrderInvoiceMarkupTransProdCompleted += (s, sv) =>
            {
                foreach (var row in sv.Result)
                {
                    var newrow = new TblMarkupTranProdViewModel();
                    newrow.InjectFrom(row);
                    newrow.CurrencyPerRow = new GenericTable();
                    newrow.CurrencyPerRow.InjectFrom(CurrencyList.FirstOrDefault(w => w.Iserial == row.TblCurrency));
                    newrow.TblCurrency    = row.TblCurrency;
                    newrow.TblMarkupProd1 = new TblMarkupProd();
                    newrow.TblMarkupProd1.InjectFrom(MarkupList.FirstOrDefault(w => w.Iserial == row.TblMarkupProd));
                    newrow.TblMarkupProd            = row.TblMarkupProd;
                    newrow.JournalAccountTypePerRow = JournalAccountTypeList.FirstOrDefault(w => w.Iserial == newrow.TblJournalAccountType);
                    newrow.EntityPerRow             = new GlService.Entity().InjectFrom(sv.entityList.FirstOrDefault(w => w.Iserial == row.EntityAccount && w.TblJournalAccountType == row.TblJournalAccountType)) as GlService.Entity;
                    newrow.TblJournalAccountType    = row.TblJournalAccountType;
                    newrow.EntityAccount            = row.EntityAccount;
                    SelectedMainRow.MarkUpTransList.Add(newrow);
                }

                Loading = false;

                if (SelectedMainRow.MarkUpTransList.Count == 0)
                {
                    AddNewMarkUpRow(false, true);
                }
            };
        }
Ejemplo n.º 14
0
        public EmpWeeklyDayOffViewModel()
        {
            if (!DesignerProperties.IsInDesignTool)
            {
                WeekList = new List <string>();

                GetItemPermissions(PermissionItemName.EmpWeeklyDayOff.ToString());

                Client.UpdateOrInsertTblEmpWeeklyDayOffCompleted += (s, x) =>
                {
                    var savedRow = (TblEmpWeeklyDayOffViewModel)MainRowList.GetItemAt(x.outindex);

                    if (savedRow != null)
                    {
                        savedRow.InjectFrom(x.Result);
                    }
                };
                Client.DeleteTblEmpWeeklyDayOffCompleted += (s, ev) =>
                {
                    if (ev.Error != null)
                    {
                        throw ev.Error;
                    }

                    var oldrow = MainRowList.FirstOrDefault(x => x.Iserial == ev.Result);
                    if (oldrow != null)
                    {
                        MainRowList.Remove(oldrow);
                    }
                    if (!MainRowList.Any())
                    {
                        AddNewMainRow(false);
                    }
                };

                foreach (var variable in GetDates(2015, 10))
                {
                    WeekList.Add(variable.DayOfWeek.ToString());
                }
                GetMaindata();

                Client.GetTblEmpWeeklyDayOffCompleted += (s, sv) =>
                {
                    foreach (var row in sv.Result)
                    {
                        var newrow = new TblEmpWeeklyDayOffViewModel();
                        newrow.InjectFrom(row);
                        MainRowList.Add(newrow);
                    }
                    Loading   = false;
                    FullCount = sv.fullCount;
                    if (MainRowList.Any() && (SelectedMainRow == null || SelectedMainRow.Iserial == 0))
                    {
                        SelectedMainRow = MainRowList.FirstOrDefault();
                    }

                    if (FullCount == 0 && MainRowList.Count == 0)
                    {
                        AddNewMainRow(false);
                    }

                    if (Export)
                    {
                        Export = false;

                        //var handler = ExportCompleted;
                        //if (handler != null) handler(this, EventArgs.Empty);
                        //ExportGrid.ExportExcel("Style");
                    }
                };
            }
        }