Ejemplo n.º 1
0
        public void SaveMainRow()
        {
            if (SelectedMainRow != null)
            {
                var valiationCollection = new List <ValidationResult>();

                var isvalid = Validator.TryValidateObject(SelectedMainRow,
                                                          new ValidationContext(SelectedMainRow, null, null), valiationCollection, true);

                if (isvalid)
                {
                    var save = SelectedMainRow.Iserial == 0;
                    if (AllowUpdate != true && !save)
                    {
                        MessageBox.Show(strings.AllowUpdateMsg);
                        return;
                    }
                    var saveRow = new TblCostCenter();
                    saveRow.InjectFrom(SelectedMainRow);

                    if (!Loading)
                    {
                        Loading = true;
                        Glclient.UpdateOrInsertTblCostCentersAsync(saveRow, save, MainRowList.IndexOf(SelectedMainRow), LoggedUserInfo.DatabasEname);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public void SaveOldRow(TblIncomeStatmentDesignHeaderViewModel oldRow)
        {
            if (oldRow != null)
            {
                var valiationCollection = new List <ValidationResult>();

                var isvalid = Validator.TryValidateObject(oldRow,
                                                          new ValidationContext(oldRow, null, null), valiationCollection, true);

                if (isvalid)
                {
                    var save = oldRow.Iserial == 0;
                    if (AllowUpdate != true && !save)
                    {
                        MessageBox.Show(strings.AllowUpdateMsg);
                        return;
                    }
                    var saveRow = new TblIncomeStatmentDesignHeader();
                    saveRow.InjectFrom(oldRow);

                    if (!Loading)
                    {
                        Loading = true;
                        Glclient.UpdateOrInsertTblIncomeStatmentDesignHeaderAsync(saveRow, save, MainRowList.IndexOf(oldRow),
                                                                                  LoggedUserInfo.DatabasEname);
                    }
                }
            }
        }
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)
                 {
                     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.º 4
0
        public void SaveDetailRow()
        {
            if (SelectedDetailRow != null)
            {
                var valiationCollection = new List <ValidationResult>();

                var isvalid = Validator.TryValidateObject(SelectedDetailRow,
                                                          new ValidationContext(SelectedDetailRow, null, null), valiationCollection, true);

                if (SelectedDetailRow.Type.StartsWith("Account") && string.IsNullOrWhiteSpace(SelectedDetailRow.Description))
                {
                    isvalid = false;
                }
                if (isvalid)
                {
                    var save = SelectedDetailRow.Iserial == 0;
                    if (SelectedDetailRow.TblIncomeStatmentDesignHeader == 0)
                    {
                        SelectedDetailRow.TblIncomeStatmentDesignHeader = SelectedMainRow.Iserial;
                    }
                    if (AllowUpdate != true && !save)
                    {
                        MessageBox.Show(strings.AllowUpdateMsg);
                        return;
                    }
                    var rowToSave = new TblIncomeStatmentDesignDetail();
                    rowToSave.InjectFrom(SelectedDetailRow);

                    Glclient.UpdateOrInsertIncomeStatmentDesignDetailAsync(rowToSave, save,
                                                                           SelectedMainRow.DetailsList.IndexOf(SelectedDetailRow), LoggedUserInfo.DatabasEname);
                }
            }
        }
Ejemplo n.º 5
0
        public void SaveDetailRow()
        {
            if (SelectedDetailRow != null)
            {
                var valiationCollection = new List <ValidationResult>();

                var isvalid = Validator.TryValidateObject(SelectedDetailRow,
                                                          new ValidationContext(SelectedDetailRow, null, null), valiationCollection, true);

                if (isvalid)
                {
                    var save = SelectedDetailRow.Iserial == 0;
                    if (AllowUpdate != true)
                    {
                        return;
                    }
                    var rowToSave = new TblGlPeriodLine();
                    rowToSave.InjectFrom(SelectedDetailRow);


                    if (!Loading)
                    {
                        Loading = true;

                        Glclient.UpdateOrInsertCspPeriodLineAsync(rowToSave, save,
                                                                  SelectedMainRow.TblPeriodLineList.IndexOf(SelectedDetailRow), LoggedUserInfo.DatabasEname,
                                                                  LoggedUserInfo.Iserial);
                    }
                }
            }
        }
Ejemplo n.º 6
0
        public void SaveDetailRow()
        {
            if (SelectedDetailRow != null)
            {
                var valiationCollection = new List <ValidationResult>();

                var isvalid = Validator.TryValidateObject(SelectedDetailRow,
                                                          new ValidationContext(SelectedDetailRow, null, null), valiationCollection, true);

                if (isvalid)
                {
                    var save = SelectedDetailRow.Iserial == 0;
                    if (SelectedDetailRow.TblGlRuleHeader == 0)
                    {
                        SelectedDetailRow.TblGlRuleHeader = SelectedMainRow.Iserial;
                    }
                    if (AllowUpdate != true && !save)
                    {
                        MessageBox.Show(strings.AllowUpdateMsg);
                        return;
                    }
                    var rowToSave = new TblGlRuleMainDetail();
                    rowToSave.InjectFrom(SelectedDetailRow);

                    Glclient.UpdateOrInsertTblGlRuleMainDetailsAsync(rowToSave, save,
                                                                     SelectedMainRow.DetailsList.IndexOf(SelectedDetailRow), LoggedUserInfo.DatabasEname);
                }
            }
        }
Ejemplo n.º 7
0
 public void DeleteSubDetailRow()
 {
     if (SelectedSubDetailRows != null)
     {
         var res = MessageBox.Show("Are You To Delete SelectedRecords From Database ?", "Delete",
                                   MessageBoxButton.OKCancel);
         if (res == MessageBoxResult.OK)
         {
             foreach (var row in SelectedSubDetailRows)
             {
                 if (row.Iserial != 0)
                 {
                     if (AllowDelete != true)
                     {
                         MessageBox.Show(strings.AllowDeleteMsg);
                         return;
                     }
                     Loading = true;
                     Glclient.DeleteTblGlRuleDetailAsync(
                         (TblGlRuleDetail) new TblGlRuleDetail().InjectFrom(row), 1,
                         LoggedUserInfo.DatabasEname);
                 }
                 else
                 {
                     SelectedDetailRow.DetailsList.Remove(SelectedSubDetailRow);
                     if (!SelectedDetailRow.DetailsList.Any())
                     {
                         AddNewSubDetailRow(false);
                     }
                 }
             }
         }
     }
 }
Ejemplo n.º 8
0
        // ReSharper disable once InconsistentNaming
        public LedgerAttachmentViewModel(TblLedgerHeaderViewModel Row)
        {
            HeaderRow       = Row;
            MainRowList     = new SortableCollectionView <GlLedgerAttachmentViewModel>();
            SelectedMainRow = new GlLedgerAttachmentViewModel();

            Glclient.GetTblLedgerHeaderAttachmentCompleted += (s, sv) =>
            {
                MainRowList.Clear();
                foreach (var row in sv.Result)
                {
                    var newrow = new GlLedgerAttachmentViewModel();
                    newrow.InjectFrom(row);
                    MainRowList.Add(newrow);
                }
                Loading = false;
            };

            Glclient.GetTblLedgerHeaderAttachmentAsync(HeaderRow.Iserial);
            Glclient.UpdateOrInsertTblLedgerHeaderAttachmentCompleted += (s, x) => Glclient.GetTblLedgerHeaderAttachmentAsync(HeaderRow.Iserial);

            Glclient.DeleteTblLedgerHeaderAttachmentCompleted += (s, ev) =>
            {
                if (ev.Error != null)
                {
                    throw ev.Error;
                }

                var oldrow = MainRowList.FirstOrDefault(x => x.Iserial == ev.Result);
                if (oldrow != null)
                {
                    MainRowList.Remove(oldrow);
                }
            };
        }
Ejemplo n.º 9
0
        public void SaveOldSubDetailRow(TblGlRuleDetailViewModel oldRow)
        {
            if (oldRow != null)
            {
                var valiationCollection = new List <ValidationResult>();

                var isvalid = Validator.TryValidateObject(oldRow,
                                                          new ValidationContext(oldRow, null, null), valiationCollection, true);

                if (isvalid)
                {
                    var save = oldRow.Iserial == 0;
                    if (AllowUpdate != true && !save)
                    {
                        MessageBox.Show(strings.AllowUpdateMsg);
                        return;
                    }
                    if (Loading == false)
                    {
                        Loading = true;
                        var saveRow = new TblGlRuleDetail();
                        saveRow.InjectFrom(oldRow);

                        Glclient.UpdateOrInsertTblGlRuleDetailsAsync(saveRow, save, SelectedDetailRow.DetailsList.IndexOf(oldRow),
                                                                     LoggedUserInfo.DatabasEname);
                    }
                }
            }
        }
Ejemplo n.º 10
0
        public void SaveMainRow()
        {
            if (SelectedMainRow != null)
            {
                var valiationCollection = new List <ValidationResult>();

                var isvalid = Validator.TryValidateObject(SelectedMainRow,
                                                          new ValidationContext(SelectedMainRow, null, null), valiationCollection, true);

                if (isvalid)
                {
                    var save = SelectedMainRow.Iserial == 0;
                    if (AllowUpdate != true && !save)
                    {
                        MessageBox.Show(strings.AllowUpdateMsg);
                        return;
                    }
                    var costdimist = new ObservableCollection <TblCostDimDetail>();
                    foreach (var tblCostDimDetailViewModel in MainRowList)
                    {
                        costdimist.Add(new TblCostDimDetail().InjectFrom(tblCostDimDetailViewModel) as TblCostDimDetail);
                    }

                    var saveRow = new TblCostDimDetail();
                    saveRow.InjectFrom(SelectedMainRow);
                    Glclient.SaveTblCostDimHeaderAsync((int)LedgerHeaderViewModel.SelectedDetailRow.TblJournalAccountType, costdimist,
                                                       LoggedUserInfo.DatabasEname);
                }
            }
        }
Ejemplo n.º 11
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.º 12
0
 public void DeleteSubDetailRow()
 {
     if (SelectedSubDetailRows != null)
     {
         var res = MessageBox.Show("Are You To Delete SelectedRecords From Database ?", "Delete",
                                   MessageBoxButton.OKCancel);
         if (res == MessageBoxResult.OK)
         {
             var ListInt = SelectedSubDetailRows.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.DeleteTblJournalSettingCostCenterAsync(ObsInt, LoggedUserInfo.DatabasEname);
             foreach (var row in SelectedSubDetailRows.Where(w => w.Iserial == 0).ToList())
             {
                 SelectedMainRow.SubDetailList.Remove(row);
             }
             if (!SelectedMainRow.SubDetailList.Any())
             {
                 AddNewDetailRow(false);
             }
         }
     }
 }
Ejemplo n.º 13
0
 public void GetMaindata()
 {
     if (SortBy == null)
     {
         SortBy = "it.Iserial";
     }
     Glclient.GetTblPeriodAsync(MainRowList.Count, PageSize, SortBy, Filter, ValuesObjects, LoggedUserInfo.DatabasEname);
 }
Ejemplo n.º 14
0
 public void GetMaindata()
 {
     if (SortBy == null)
     {
         SortBy = "it.Iserial";
     }
     Loading = true;
     Glclient.GetTblBankTransactionTypeAsync(MainRowList.Count, PageSize, SortBy, Filter, ValuesObjects, LoggedUserInfo.DatabasEname);
 }
Ejemplo n.º 15
0
 public void GetDetailRow()
 {
     if (SortBy == null)
     {
         SortBy = "it.Iserial";
     }
     Loading = true;
     Glclient.GetTblBankChequeAsync(SelectedMainRow.DetailsList.Count, int.MaxValue, SelectedMainRow.Iserial, SortBy, DetailFilter, DetailValuesObjects, LoggedUserInfo.DatabasEname, 4);
 }
Ejemplo n.º 16
0
 public void GetMaindata()
 {
     if (SortBy == null)
     {
         SortBy = "it.Iserial";
     }
     Loading = true;
     Glclient.GetTblCostCenterOrganizationUnitAsync(MainRowList.Count, PageSize, SortBy, Filter, ValuesObjects, LoggedUserInfo.DatabasEname);
 }
Ejemplo n.º 17
0
 public void GetMaindata()
 {
     if (SortBy == null)
     {
         SortBy = "it.Iserial desc";
     }
     Loading = true;
     Glclient.GetTblChequeTransactionDetailNotLinkedAsync(Vendor, LoggedUserInfo.DatabasEname);
 }
Ejemplo n.º 18
0
 public void GetSubDetailData()
 {
     Loading = true;
     if (SelectedMainRow != null)
     {
         Glclient.GetTblGlRuleDetailAsync(SelectedDetailRow.DetailsList.Count, PageSize, SelectedDetailRow.Iserial,
                                          "it.Iserial", DetailSubFilter, DetailSubValuesObjects, LoggedUserInfo.DatabasEname);
     }
 }
Ejemplo n.º 19
0
 public void GetMaindata()
 {
     if (SortBy == null)
     {
         SortBy = "it.Iserial";
     }
     Loading = true;
     Glclient.GetGenericAsync(TablEname, Code, Ename, Aname, SortBy, Direction, LoggedUserInfo.DatabasEname);
 }
Ejemplo n.º 20
0
 public void GetMaindata()
 {
     if (SortBy == null)
     {
         SortBy = "it.Iserial";
     }
     Loading = true;
     Glclient.GetTblAccountAsync(MainRowList.Count, PageSize, SortBy, Filter, ValuesObjects,
                                 LoggedUserInfo.DatabasEname, ChildOnly);
 }
Ejemplo n.º 21
0
 public void GetMaindata()
 {
     if (SortBy == null)
     {
         SortBy = "it.Iserial";
     }
     Loading = true;
     Glclient.GetTblCostDimSetupHeaderForAccountAsync((int)LedgerHeaderViewModel.SelectedDetailRow.TblJournalAccountType, LedgerHeaderViewModel.SelectedDetailRow.TblCostDimHeader
                                                      , LoggedUserInfo.DatabasEname);
 }
Ejemplo n.º 22
0
 public void GetMaindata()
 {
     if (SortBy == null)
     {
         SortBy = "it.Iserial";
     }
     Loading = true;
     Glclient.GetTblContractHeaderForChequeAsync(TblJournalAccountType, EntityAccount,
                                                 LoggedUserInfo.DatabasEname);
 }
Ejemplo n.º 23
0
 public void GetFullMainData()
 {
     if (SortBy == null)
     {
         SortBy = "it.Iserial";
     }
     Loading = true;
     Export  = true;
     Glclient.GetTblGlExpensisAsync(MainRowList.Count, PageSize, SortBy, Filter, ValuesObjects, LoggedUserInfo.DatabasEname);
 }
Ejemplo n.º 24
0
 public void GetMaindata()
 {
     if (SortBy == null)
     {
         SortBy = "it.Iserial";
     }
     Loading = true;
     Glclient.GetTblCostCenterAsync(MainRowList.Count, PageSize, CostCenterType, SortBy, Filter, ValuesObjects,
                                    LoggedUserInfo.DatabasEname, LoggedUserInfo.Iserial, EntityAccount, EntityAccountType);
 }
Ejemplo n.º 25
0
 public void GetMaindata()
 {
     if (SortBy == null)
     {
         SortBy = "it.Iserial";
     }
     Loading = true;
     Glclient.GetTblGlGenEntityGroupAsync(MainRowList.Count, PageSize, MainJournalAccoutType.Iserial, SortBy, Filter, ValuesObjects,
                                          LoggedUserInfo.DatabasEname);
 }
Ejemplo n.º 26
0
 public void GetMaindata()
 {
     if (SortBy == null)
     {
         SortBy = "it.Iserial";
     }
     Loading = true;
     Glclient.GetTblBankChequeAsync(MainRowList.Count, PageSize, Bank, SortBy, Filter, ValuesObjects,
                                    LoggedUserInfo.DatabasEname, ChequeStatusPerRow.Iserial);
 }
Ejemplo n.º 27
0
 public void GetMaindata()
 {
     if (SortBy == null)
     {
         SortBy = "it.Iserial";
     }
     Loading = true;
     Glclient.GetTblIncomeStatmentDesignHeaderAsync(MainRowList.Count, PageSize, SortBy, Filter, ValuesObjects,
                                                    LoggedUserInfo.DatabasEname);
 }
Ejemplo n.º 28
0
        internal void GetLedgerDetail()
        {
            if (DetailSortBy == null)
            {
                DetailSortBy = "it.Iserial";
            }
            Loading = true;

            Glclient.GetTblLedgerDetailForDepreciationAsync(0, 100, true, DetailSortBy, DetailFilter, DetailValuesObjects, LoggedUserInfo.DatabasEname);
        }
Ejemplo n.º 29
0
 public void GetDetailData()
 {
     SelectedMainRow.DetailList.Clear();
     if (SortBy == null)
     {
         SortBy = "it.Iserial";
     }
     Loading = true;
     Glclient.GetTblDepreciationTransactionDetailAsync(SelectedMainRow.Iserial,
                                                       LoggedUserInfo.DatabasEname);
 }
Ejemplo n.º 30
0
        public void SaveMainRow()
        {
            Loading = true;
            var observableCollectionIserials = new ObservableCollection <int>();

            foreach (var item in MainRowList.Where(w => w.Saved == true).Select(w => w.Iserial).ToList())
            {
                observableCollectionIserials.Add(item);
            }
            Glclient.UpdateorInsertClosingAdvanceVendorPaymentsAsync(PostDate, observableCollectionIserials, LoggedUserInfo.Iserial, LoggedUserInfo.DatabasEname);
        }