コード例 #1
0
        public SearchChequeViewModel()
        {
            if (!IsDesignTime)
            {
                Glclient = new GlServiceClient();

                MainRowList     = new SortableCollectionView <TblBankCheque>();
                SelectedMainRow = new TblBankCheque();
                Glclient.CreateChequeCompleted     += (s, sv) => GetMaindata();
                Glclient.GetTblBankChequeCompleted += (s, sv) =>
                {
                    foreach (var row in sv.Result)
                    {
                        MainRowList.Add(row);
                    }
                    if (Bank != 0 && ValuesObjects != null && (!MainRowList.Any() && ValuesObjects.ContainsKey("Cheque0")))
                    {
                        var res = MessageBox.Show("This Cheque is Not Found Do You Want To Create It ?", "Create Cheque",
                                                  MessageBoxButton.OKCancel);
                        if (res == MessageBoxResult.OK)
                        {
                            Glclient.CreateChequeAsync(Bank, (long)ValuesObjects.FirstOrDefault(w => w.Key == "Cheque0").Value, 1, LoggedUserInfo.DatabasEname);
                        }
                    }
                    Loading   = false;
                    FullCount = sv.fullCount;
                };
            }
        }
コード例 #2
0
        public ClosingAdvanceVendorPaymentViewModel()
        {
            if (!IsDesignTime)
            {
                PostDate = DateTime.Now;
                TblJournalAccountTypePerRow = new GenericTable()
                {
                    Iserial = 2
                };
                Glclient    = new GlServiceClient();
                MainRowList = new ObservableCollection <TblGlChequeTransactionDetailViewModel>();
                Glclient.GetTblChequeTransactionDetailNotLinkedCompleted += (s, sv) =>
                {
                    foreach (var row in sv.Result)
                    {
                        var newrow = new TblGlChequeTransactionDetailViewModel();
                        newrow.InjectFrom(row);
                        newrow.ChequePerRow = new TblBankCheque();

                        if (row.TblBankCheque1 != null)
                        {
                            newrow.ChequePerRow.InjectFrom(row.TblBankCheque1);
                        }
                        newrow.TblJournalAccountTypePerRow = new GenericTable();
                        if (row.TblJournalAccountType != null)
                        {
                            newrow.TblJournalAccountTypePerRow.InjectFrom(row.TblJournalAccountType);
                        }
                        newrow.TblJournalAccountType1PerRow = new GenericTable();
                        if (row.TblJournalAccountType1 != null)
                        {
                            newrow.TblJournalAccountType1PerRow.InjectFrom(row.TblJournalAccountType1);
                        }

                        newrow.EntityDetail1TblJournalAccountType = row.EntityDetail1TblJournalAccountType;
                        newrow.EntityDetail2TblJournalAccountType = row.EntityDetail2TblJournalAccountType;
                        newrow.Saved = true;
                        MainRowList.Add(newrow);
                    }
                    Loading = false;
                };
                Glclient.UpdateorInsertClosingAdvanceVendorPaymentsCompleted += (s, ev) =>
                {
                    if (ev.Error != null)
                    {
                        MessageBox.Show(ev.Error.Message);
                    }
                    try
                    {
                        MainRowList.Clear();
                    }
                    // ReSharper disable once EmptyGeneralCatchClause
                    catch (Exception)
                    {
                    }
                    Loading = false;
                };
            }
        }
コード例 #3
0
        public CostDimChildViewModel(LedgerHeaderViewModel ledgerHeaderViewModel)
        {
            if (!IsDesignTime)
            {
                LedgerHeaderViewModel = ledgerHeaderViewModel;
                GetItemPermissions(PermissionItemName.Account.ToString());
                Glclient = new GlServiceClient();

                MainRowList     = new SortableCollectionView <TblCostDimDetailViewModel>();
                SelectedMainRow = new TblCostDimDetailViewModel();

                Glclient.GetTblCostDimSetupHeaderForAccountCompleted += (s, sv) =>
                {
                    if (sv.Result != null)
                    {
                        foreach (var row in sv.Result.TblCostDimDetails)
                        {
                            var newrow = new TblCostDimDetailViewModel();
                            newrow.InjectFrom(row);
                            newrow.CostCenterPerRow = row.TblCostCenter1;
                            MainRowList.Add(newrow);
                        }
                    }

                    Loading = false;

                    if (MainRowList.Any() && (SelectedMainRow == null))
                    {
                        SelectedMainRow = MainRowList.FirstOrDefault();
                    }
                    if (FullCount == 0 && MainRowList.Count == 0)
                    {
                        AddNewMainRow(false);
                    }
                };

                Glclient.SaveTblCostDimHeaderCompleted += (s, ev) =>
                {
                    if (ev.Error != null)
                    {
                        MessageBox.Show(ev.Error.Message);
                    }
                    try
                    {
                        ledgerHeaderViewModel.SelectedDetailRow.TblCostDimHeader = ev.Result;
                        ledgerHeaderViewModel.SaveMainRow();
                    }
                    catch (Exception)
                    {
                    }
                };
                GetMaindata();
            }
        }
コード例 #4
0
        private void UIElement_OnLostFocus(object sender, RoutedEventArgs e)
        {
            var txt = sender as TextBox;

            var currencyClient = new GlServiceClient();

            currencyClient.GetTblAccountbyCodeCompleted += (s, sv) =>
            { if (sv.Result != null)
              {
                  SearchPerRow = sv.Result;
              }
            };
            if (txt.Text != null)
            {
                currencyClient.GetTblAccountbyCodeAsync(txt.Text, LoggedUserInfo.DatabasEname, ChildOnlyPerRow);
            }
        }
コード例 #5
0
        public SearchContractHeaderViewModel()
        {
            if (!IsDesignTime)
            {
                Glclient = new GlServiceClient();

                MainRowList     = new ObservableCollection <TblContractHeader>();
                SelectedMainRow = new TblContractHeader();

                Glclient.GetTblContractHeaderForChequeCompleted += (s, sv) =>
                {
                    foreach (var row in sv.Result.OrderByDescending(w => w.Iserial))
                    {
                        MainRowList.Add(row);
                    }
                    Loading = false;
                };
            }
        }
コード例 #6
0
        public CreateBankChequeChildWindow(BankViewModel viewModel)
        {
            InitializeComponent();
            DataContext = viewModel;
            _viewModel  = viewModel;
            var glclient = new GlServiceClient();

            glclient.GetMaxChequeAsync(_viewModel.SelectedMainRow.Iserial, LoggedUserInfo.DatabasEname);
            glclient.GetMaxChequeCompleted += (s, sv) =>
            {
                try
                {
                    TxtFrom.Text = sv.Result.ToString(CultureInfo.InvariantCulture);
                }
                catch (Exception)
                {
                    TxtFrom.Text = "1";
                }
            };
        }
コード例 #7
0
        public SearchAccountViewModel()
        {
            if (!IsDesignTime)
            {
                Glclient = new GlServiceClient();

                MainRowList     = new SortableCollectionView <TblAccount>();
                SelectedMainRow = new TblAccount();

                Glclient.GetTblAccountCompleted += (s, sv) =>
                {
                    foreach (var row in sv.Result)
                    {
                        MainRowList.Add(row);
                    }

                    Loading   = false;
                    FullCount = sv.fullCount;
                };
            }
        }
コード例 #8
0
        public ClosingPostingViewModel()
        {
            if (!IsDesignTime)
            {
                GetItemPermissions(PermissionItemName.ClosingPosting.ToString());
                Glclient = new GlServiceClient();

                Glclient.GetPostingTimesAsync(LoggedUserInfo.DatabasEname);
                Glclient.GetPostingTimesCompleted += (s, sv) =>
                {
                    AdjustDate   = sv.adjustDate;
                    TransferDate = sv.transferDate;
                    SalesDate    = sv.Result;
                    ExpensesDate =
                        sv.expensesDate;
                };
                Glclient.GlPostCompleted += (s, sv) =>
                {
                    if (sv.Result == 1)
                    {
                        MessageBox.Show("Done");
                    }
                    else
                    {
                        var res =
                            MessageBox.Show("Some Transactions Already Exsists Are You Sure You Want To Override ? ?",
                                            "Delete",
                                            MessageBoxButton.OKCancel);
                        if (res == MessageBoxResult.OK)
                        {
                            Glclient.GlPostAsync(FromDate, ToDate, LoggedUserInfo.Iserial, LoggedUserInfo.DatabasEname,
                                                 Sales, Transfer, Adjustment, Expenses, Depreciation, Commission, true, CostCenter);
                        }
                    }
                };
                FromDate = DateTime.Now;
                ToDate   = DateTime.Now;
                Sales    = Commission = true;
            }
        }
コード例 #9
0
        public MethodOfPaymentViewModel()
        {
            if (!IsDesignTime)
            {
                GetItemPermissions(PermissionItemName.MethodOfPayment.ToString());
                Glclient        = new GlServiceClient();
                MainRowList     = new SortableCollectionView <TblMethodOfPaymentViewModel>();
                SelectedMainRow = new TblMethodOfPaymentViewModel();

                var bankTransactionTypeClient = new GlServiceClient();
                bankTransactionTypeClient.GetGenericCompleted += (s, sv) =>
                {
                    BankTransactionTypeList = sv.Result;
                };
                bankTransactionTypeClient.GetGenericAsync("TblBankTransactionType", "%%", "%%", "%%", "Iserial", "ASC", LoggedUserInfo.DatabasEname);

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

                Glclient.GetTblMethodOfPaymentCompleted += (s, sv) =>
                {
                    foreach (var row in sv.Result)
                    {
                        var newrow = new TblMethodOfPaymentViewModel();
                        if (row.TblBankTransactionType1 != null)
                        {
                            newrow.BankTransactionTypePerRow = new GenericTable();
                            newrow.BankTransactionTypePerRow.InjectFrom(row.TblBankTransactionType1);
                        }
                        if (row.TblJournalAccountType1 != null)
                        {
                            newrow.JournalAccountTypePerRow = new GenericTable();
                            newrow.JournalAccountTypePerRow.InjectFrom(row.TblJournalAccountType1);
                        }
                        newrow.EntityAccountPerRow =
                            sv.entityList.FirstOrDefault(x => x.TblJournalAccountType == row.TblJournalAccountType && x.Iserial == row.Entity);
                        newrow.AccountPerRow = row.TblAccount;
                        newrow.InjectFrom(row);
                        MainRowList.Add(newrow);
                    }

                    Loading   = false;
                    FullCount = sv.fullCount;
                    if (MainRowList.Any() && (SelectedMainRow == null))
                    {
                        SelectedMainRow = MainRowList.FirstOrDefault();
                    }
                    if (FullCount == 0 && MainRowList.Count == 0)
                    {
                        AddNewMainRow(false);
                    }
                };

                Glclient.UpdateOrInsertTblMethodOfPaymentsCompleted += (s, ev) =>
                {
                    if (ev.Error != null)
                    {
                        MessageBox.Show(ev.Error.Message);
                    }
                    try
                    {
                        MainRowList.ElementAt(ev.outindex).InjectFrom(ev.Result);
                    }
                    catch (Exception)
                    {
                    }
                };
                Glclient.DeleteTblMethodOfPaymentCompleted += (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);
                    }
                    if (!MainRowList.Any())
                    {
                        AddNewMainRow(false);
                    }
                };

                GetMaindata();
            }
        }
コード例 #10
0
        public PostingProfileHeaderViewModel()
        {
            if (!IsDesignTime)
            {
                GetItemPermissions(PermissionItemName.PostingProfile.ToString());
                Glclient        = new GlServiceClient();
                MainRowList     = new SortableCollectionView <TblPostingProfileHeaderViewModel>();
                SelectedMainRow = new TblPostingProfileHeaderViewModel();

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

                Glclient.GetTblPostingProfileHeaderCompleted += (s, sv) =>
                {
                    foreach (var row in sv.Result)
                    {
                        var newrow = new TblPostingProfileHeaderViewModel();
                        newrow.InjectFrom(row);
                        MainRowList.Add(newrow);
                    }

                    Loading   = false;
                    FullCount = sv.fullCount;
                    if (MainRowList.Any() && (SelectedMainRow == null))
                    {
                        SelectedMainRow = MainRowList.FirstOrDefault();
                    }
                    if (FullCount == 0 && MainRowList.Count == 0)
                    {
                        AddNewMainRow(false);
                    }
                };

                Glclient.UpdateOrInsertTblPostingProfileHeadersCompleted += (s, ev) =>
                {
                    if (ev.Error != null)
                    {
                        MessageBox.Show(ev.Error.Message);
                    }
                    try
                    {
                        MainRowList.ElementAt(ev.outindex).InjectFrom(ev.Result);
                    }
                    catch (Exception)
                    {
                    }
                };
                Glclient.DeleteTblPostingProfileHeaderCompleted += (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);
                    }
                    if (!MainRowList.Any())
                    {
                        AddNewMainRow(false);
                    }
                };

                Glclient.GetTblPostingProfileDetailCompleted += (s, sv) =>
                {
                    foreach (var row in sv.Result)
                    {
                        var newrow = new TblPostingProfileDetailViewModel
                        {
                            AccountPerRow            = row.TblAccount1,
                            JournalAccountTypePerRow = new GenericTable()
                        };
                        newrow.JournalAccountTypePerRow.InjectFrom(row.TblJournalAccountType);

                        newrow.InjectFrom(row);
                        newrow.EntityAccountPerRow =
                            sv.entityList.FirstOrDefault(x => x.TblJournalAccountType == newrow.Type && x.scope == newrow.Scope &&
                                                         x.Iserial == newrow.Entity);
                        SelectedMainRow.DetailsList.Add(newrow);
                    }
                    Loading         = false;
                    DetailFullCount = sv.fullCount;

                    if (SelectedMainRow.DetailsList.Any() &&
                        (SelectedDetailRow == null))
                    {
                        SelectedDetailRow = SelectedMainRow.DetailsList.FirstOrDefault();
                    }

                    if (DetailFullCount == 0 && SelectedMainRow.DetailsList.Count == 0)
                    {
                        AddNewDetailRow(false);
                    }

                    if (Export)
                    {
                        Export = false;
                        ExportGrid.ExportExcel("Users");
                    }
                };

                Glclient.UpdateOrInsertTblPostingProfileDetailsCompleted += (s, x) =>
                {
                    var savedRow = (TblPostingProfileDetailViewModel)SelectedMainRow.DetailsList.GetItemAt(x.outindex);
                    if (savedRow != null)
                    {
                        savedRow.InjectFrom(x.Result);
                    }
                    Loading = false;
                };

                Glclient.DeleteTblPostingProfileDetailCompleted += (s, ev) =>
                {
                    if (ev.Error != null)
                    {
                        MessageBox.Show(ev.Error.Message);
                    }
                    Loading = false;
                    var oldrow = SelectedMainRow.DetailsList.FirstOrDefault(x => x.Iserial == ev.Result);
                    if (oldrow != null)
                    {
                        SelectedMainRow.DetailsList.Remove(oldrow);
                    }
                    if (!SelectedMainRow.DetailsList.Any())
                    {
                        AddNewDetailRow(false);
                    }
                };

                GetMaindata();
            }
        }
コード例 #11
0
        public DepreciationViewModel()
        {
            if (!IsDesignTime)
            {
                GetItemPermissions("Depreciation");
                GetCustomePermissions("Depreciation");
                Glclient = new GlServiceClient();
                Glclient.GetTblRetailCurrencyCompleted += (s, sv) =>
                {
                    CurrencyList = sv.Result;
                };
                Glclient.GetTblRetailCurrencyAsync(0, int.MaxValue, "It.Iserial", null, null,
                                                   LoggedUserInfo.DatabasEname);
                var depreciationMethodClient = new GlServiceClient();
                depreciationMethodClient.GetGenericCompleted += (s, sv) =>
                {
                    DepreciationMethodList = sv.Result;
                };
                depreciationMethodClient.GetGenericAsync("TblDepreciationMethod", "%%", "%%", "%%", "Iserial", "ASC", LoggedUserInfo.DatabasEname);

                MainRowList     = new SortableCollectionView <TblDepreciationTransactionHeaderViewModel>();
                SelectedMainRow = new TblDepreciationTransactionHeaderViewModel();
                Glclient.GetTblDepreciationTransactionHeaderCompleted += (s, sv) =>
                {
                    foreach (var row in sv.Result)
                    {
                        var newrow = new TblDepreciationTransactionHeaderViewModel();
                        newrow.InjectFrom(row);
                        MainRowList.Add(newrow);
                    }

                    Loading   = false;
                    FullCount = sv.fullCount;
                    if (MainRowList.Any() && (SelectedMainRow == null))
                    {
                        SelectedMainRow = MainRowList.FirstOrDefault();
                    }
                };

                Glclient.GetTblDepreciationTransactionDetailCompleted += (s, sv) =>
                {
                    foreach (var row in sv.Result)
                    {
                        SelectedMainRow.DetailList.Add(row);
                    }

                    Loading = false;
                };

                //Glclient.GetLockupFromPreTransactionCompleted += (s, sv) =>
                //{
                //    foreach (var row in sv.Result)
                //    {
                //        if (SelectedMainRow.DetailsList.All(x => x.TblDepreciationTransactionDetail1 != row.Iserial))
                //        {
                //            var newrow = new TblDepreciationTransactionDetailViewModel();
                //            newrow.InjectFrom(row);
                //            newrow.ChequePerRow = new TblBankCheque();
                //            newrow.Iserial = 0;
                //            newrow.TblDepreciationTransactionHeader = 0;
                //            newrow.TblDepreciationTransactionDetail1 = row.Iserial;
                //            if (row.TblBankCheque1 != null) newrow.ChequePerRow.InjectFrom(row.TblBankCheque1);
                //            newrow.TblJournalAccountTypePerRow = new GenericTable();
                //            if (row.TblJournalAccountType != null)
                //                newrow.TblJournalAccountTypePerRow.InjectFrom(row.TblJournalAccountType);
                //            newrow.TblJournalAccountType1PerRow = new GenericTable();
                //            if (row.TblJournalAccountType1 != null)
                //                newrow.TblJournalAccountType1PerRow.InjectFrom(row.TblJournalAccountType1);
                //            newrow.EntityDetail1TblJournalAccountType = row.EntityDetail1TblJournalAccountType;
                //            newrow.EntityDetail2TblJournalAccountType = row.EntityDetail2TblJournalAccountType;
                //            newrow.EntityPerRow =
                //        sv.entityList.FirstOrDefault(
                //             x => x.TblJournalAccountType == row.EntityDetail1TblJournalAccountType
                //             && x.Iserial == row.EntityDetail1);

                //            newrow.OffsetEntityPerRow =
                //                 sv.entityList.FirstOrDefault(
                //                    x => x.TblJournalAccountType == row.EntityDetail2TblJournalAccountType
                //                    && x.Iserial == row.EntityDetail2);
                //            newrow.Saved = true;

                //            SelectedMainRow.DetailsList.Add(newrow);
                //        }
                //    }

                //    Loading = false;

                //    SelectedDetailRow = SelectedMainRow.DetailsList.FirstOrDefault();
                //};

                Glclient.UpdateOrInsertTblDepreciationTransactionHeaderCompleted += (s, ev) =>
                {
                    if (ev.Error != null)
                    {
                        MessageBox.Show(ev.Error.Message);
                    }
                    try
                    {
                        MainRowList.ElementAt(ev.outindex).InjectFrom(ev.Result);
                    }
                    catch (Exception)
                    {
                    }
                    Loading = false;
                };
                Glclient.DeleteTblDepreciationTransactionHeaderCompleted += (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);
                    }
                    if (!MainRowList.Any())
                    {
                        AddNewMainRow(false);
                    }
                };
                Glclient.GetTblLedgerDetailForDepreciationCompleted += (s, sv) =>
                {
                    foreach (var row in sv.Result)
                    {
                        var newrow = new TblLedgerMainDetailViewModel {
                            CurrencyPerRow = new TblCurrencyTest()
                        };
                        newrow.CurrencyPerRow.InjectFrom(row.TblCurrency1);
                        if (row.TblBankTransactionType1 != null)
                        {
                            newrow.BankTransactionTypePerRow = new GenericTable();
                            newrow.BankTransactionTypePerRow.InjectFrom(row.TblBankTransactionType1);
                        }
                        newrow.MethodOfPaymentPerRow    = row.TblMethodOfPayment1;
                        newrow.JournalAccountTypePerRow = new GenericTable();
                        newrow.OffsetAccountTypePerRow  = new GenericTable();
                        if (row.TblJournalAccountType1 != null)
                        {
                            newrow.JournalAccountTypePerRow.InjectFrom(row.TblJournalAccountType1);
                        }
                        if (row.TblJournalAccountType2 != null)
                        {
                            newrow.OffsetAccountTypePerRow.InjectFrom(row.TblJournalAccountType2);
                        }
                        newrow.EntityPerRow =
                            sv.entityList.FirstOrDefault(x => x.TblJournalAccountType == row.TblJournalAccountType &&
                                                         x.Iserial == row.EntityAccount);
                        newrow.OffsetEntityPerRow =
                            sv.entityList.FirstOrDefault(x => x.TblJournalAccountType == row.OffsetAccountType && x.Iserial == row.OffsetEntityAccount);
                        newrow.InjectFrom(row);
                        if (newrow.DrOrCr == true)
                        {
                            if (row.Amount != null)
                            {
                                newrow.DrAmount = row.Amount;
                            }
                        }
                        else
                        {
                            if (row.Amount != null)
                            {
                                newrow.CrAmount = row.Amount;
                            }
                        }
                        if (row.TblBankCheque1 != null)
                        {
                            newrow.ChequePerRow = row.TblBankCheque1;
                        }
                        newrow.TransactionExists = sv.TransactionExist.FirstOrDefault(x => x.Key == newrow.Iserial).Value;

                        if (row.TblAccount != null)
                        {
                            newrow.AccountPerRow = new TblAccount
                            {
                                Code    = row.TblAccount.Code,
                                Iserial = row.TblAccount.Iserial,
                                Ename   = row.TblAccount.Ename,
                                Aname   = row.TblAccount.Aname
                            };
                        }

                        TblLedgerDetailsList.Add(newrow);
                    }
                    Loading         = false;
                    DetailFullCount = sv.fullCount;
                };
            }
        }
コード例 #12
0
        public ShopAreaViewModel()
        {
            if (!IsDesignTime)
            {
                GetItemPermissions(PermissionItemName.ShopArea.ToString());
                Glclient = new GlServiceClient();

                var costDimSetupTypeClient = new GlServiceClient();
                costDimSetupTypeClient.GetGenericCompleted += (s, sv) => { BrandList = sv.Result; };
                costDimSetupTypeClient.GetGenericAsync("TblItemDownLoadDef", "%%", "%%", "%%", "Iserial", "ASC", LoggedUserInfo.DatabasEname);

                Glclient.GetRetailChainSetupByCodeAsync("ShopAreaCostCenterType", LoggedUserInfo.DatabasEname);

                Glclient.GetRetailChainSetupByCodeCompleted += (s, sv) =>
                {
                    int costcentertype = Convert.ToInt32(sv.Result.sSetupValue);
                    Glclient.GetTblCostCenterAsync(MainRowList.Count, PageSize, costcentertype, "it.Iserial", null, null,
                                                   LoggedUserInfo.DatabasEname, LoggedUserInfo.Iserial, 0, 0);
                };
                Glclient.GetTblCostCenterCompleted += (s, sv) =>
                {
                    CostCenterList = sv.Result;
                };
                MainRowList     = new ObservableCollection <TblshopareaModel>();
                SelectedMainRow = new TblshopareaModel();

                Glclient.GetshopareaCompleted += (s, sv) =>
                {
                    foreach (var row in sv.Result)
                    {
                        var newrow = new TblshopareaModel();
                        newrow.InjectFrom(row);
                        var storeTempRow = sv.StoreList.FirstOrDefault(w => w.code == row.shopcode);
                        if (storeTempRow != null)
                        {
                            newrow.StorePerRow = new CRUDManagerService.StoreForAllCompany()
                            {
                                Code  = storeTempRow.code,
                                Aname = storeTempRow.aname,
                                Ename = storeTempRow.ENAME,
                            };
                        }

                        newrow.BrandPerRow = new GenericTable();

                        var BrandTempRow = sv.BrandList.FirstOrDefault(w => w.Code == row.Brand);
                        newrow.BrandPerRow = new GenericTable()
                        {
                            Code  = BrandTempRow.Code,
                            Aname = BrandTempRow.Aname,
                            Ename = BrandTempRow.Ename,
                        };
                        MainRowList.Add(newrow);
                    }

                    Loading   = false;
                    FullCount = sv.fullCount;
                    if (MainRowList.Any() && (SelectedMainRow == null))
                    {
                        SelectedMainRow = MainRowList.FirstOrDefault();
                    }
                    if (FullCount == 0 && MainRowList.Count == 0)
                    {
                        AddNewMainRow(false);
                    }
                    if (Export)
                    {
                        Export      = false;
                        AllowExport = true;
                        //ExportGrid.ExportExcel("Account");
                    }
                };

                Glclient.UpdateOrInsertshopareaCompleted += (s, ev) =>
                {
                    if (ev.Error != null)
                    {
                        MessageBox.Show(ev.Error.Message);
                    }
                    try
                    {
                        MainRowList.ElementAt(ev.outindex).InjectFrom(ev.Result);
                    }
                    catch (Exception)
                    {
                    }
                    Loading = false;
                };
                Glclient.DeleteshopareaCompleted += (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);
                    }
                    if (!MainRowList.Any())
                    {
                        AddNewMainRow(false);
                    }
                };

                Glclient.GetTblCostCenterShopAreaCompleted += (s, sv) =>
                {
                    foreach (var row in sv.Result)
                    {
                        var newrow = new TblCostCenterShopAreaModel();
                        newrow.InjectFrom(row);
                        var storeTempRow = CostCenterList.FirstOrDefault(w => w.Iserial == row.TblCostCenter);
                        if (storeTempRow != null)
                        {
                            newrow.CostCenterPerRow = new TblCostCenter()
                            {
                                Code              = storeTempRow.Code,
                                Aname             = storeTempRow.Aname,
                                Ename             = storeTempRow.Ename,
                                TblCostCenterType = storeTempRow.TblCostCenterType
                            };
                        }
                        SelectedMainRow.DetailsList.Add(newrow);
                    }

                    Loading         = false;
                    DetailFullCount = sv.fullCount;
                    if (SelectedMainRow.DetailsList.Any() && (SelectedDetailRow == null))
                    {
                        SelectedDetailRow = SelectedMainRow.DetailsList.FirstOrDefault();
                    }
                    if (DetailFullCount == 0 && SelectedMainRow.DetailsList.Count == 0)
                    {
                        AddNewDetailRow(false);
                    }
                };


                Glclient.UpdateOrInsertTblCostCenterShopAreasCompleted += (s, ev) =>
                {
                    if (ev.Error != null)
                    {
                        MessageBox.Show(ev.Error.Message);
                    }
                    try
                    {
                        SelectedMainRow.DetailsList.ElementAt(ev.outindex).InjectFrom(ev.Result);
                    }
                    catch (Exception)
                    {
                    }
                    Loading = false;
                };
                Glclient.DeleteTblCostCenterShopAreaCompleted += (s, ev) =>
                {
                    if (ev.Error != null)
                    {
                        MessageBox.Show(ev.Error.Message);
                    }

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



                GetMaindata();
            }
        }
コード例 #13
0
        public PositionRouteViewModel()
        {
            if (!IsDesignTime)
            {
                GetItemPermissions(PermissionItemName.PositionRoute.ToString());
                Glclient = new GlServiceClient();
                Client.GetEmpPositionAsync("");
                Client.GetEmpPositionCompleted += (s, sv) =>
                {
                    PositionList = sv.Result;
                };


                MainRowList     = new ObservableCollection <TblPositionRouteHeaderViewModel>();
                SelectedMainRow = new TblPositionRouteHeaderViewModel();
                PositionList    = new ObservableCollection <string>();
                Glclient.GetTblPositionRouteHeaderCompleted += (s, sv) =>
                {
                    foreach (var row in sv.Result)
                    {
                        var newrow = new TblPositionRouteHeaderViewModel();
                        newrow.InjectFrom(row);
                        MainRowList.Add(newrow);
                    }

                    Loading   = false;
                    FullCount = sv.fullCount;
                    if (MainRowList.Any() && (SelectedMainRow == null))
                    {
                        SelectedMainRow = MainRowList.FirstOrDefault();
                    }
                    if (FullCount == 0 && MainRowList.Count == 0)
                    {
                        AddNewMainRow(false);
                    }
                };

                Glclient.UpdateOrInsertTblPositionRouteHeaderCompleted += (s, ev) =>
                {
                    if (ev.Error != null)
                    {
                        MessageBox.Show(ev.Error.Message);
                    }
                    try
                    {
                        MainRowList.ElementAt(ev.outindex).InjectFrom(ev.Result);
                    }
                    catch (Exception)
                    {
                    }
                    Loading = false;
                };
                Glclient.DeleteTblPositionRouteHeaderCompleted += (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);
                    }
                    if (!MainRowList.Any())
                    {
                        AddNewMainRow(false);
                    }
                };

                Glclient.GetTblPositionRouteCompleted += (s, sv) =>
                {
                    foreach (var row in sv.Result)
                    {
                        var newrow = new TblPositionRouteViewModel();

                        newrow.InjectFrom(row);
                        newrow.FromStorePerRow = new CRUDManagerService.TblStore().InjectFrom(row.TblStore) as CRUDManagerService.TblStore;
                        newrow.ToStorePerRow   = new CRUDManagerService.TblStore().InjectFrom(row.TblStore1) as CRUDManagerService.TblStore;
                        if (sv.EmpList.FirstOrDefault(w => w.Emplid == newrow.Emplid) != null)
                        {
                            newrow.EmpPerRow = new CRUDManagerService.EmployeesView().InjectFrom(sv.EmpList.FirstOrDefault(w => w.Emplid == newrow.Emplid)) as CRUDManagerService.EmployeesView;
                        }
                        else
                        {
                            newrow.EmpPerRow = new CRUDManagerService.EmployeesView()
                            {
                                Emplid = newrow.Emplid
                            };
                        }
                        SelectedMainRow.DetailsList.Add(newrow);
                    }

                    Loading         = false;
                    DetailFullCount = sv.fullCount;
                    if (SelectedMainRow.DetailsList.Any() && (SelectedDetailRow == null))
                    {
                        SelectedDetailRow = SelectedMainRow.DetailsList.FirstOrDefault();
                    }
                    if (DetailFullCount == 0 && SelectedMainRow.DetailsList.Count == 0)
                    {
                        AddNewDetailRow(false);
                    }
                };

                Glclient.UpdateOrInsertTblPositionRouteCompleted += (s, ev) =>
                {
                    if (ev.Error != null)
                    {
                        MessageBox.Show(ev.Error.Message);
                    }
                    try
                    {
                        SelectedMainRow.DetailsList.ElementAt(ev.outindex).InjectFrom(ev.Result);
                    }
                    catch (Exception)
                    {
                    }
                    Loading = false;
                };
                Glclient.DeleteTblPositionRouteCompleted += (s, ev) =>
                {
                    if (ev.Error != null)
                    {
                        MessageBox.Show(ev.Error.Message);
                    }

                    var oldrow = SelectedMainRow.DetailsList.FirstOrDefault(x => x.Iserial == ev.Result);
                    if (oldrow != null)
                    {
                        SelectedMainRow.DetailsList.Remove(oldrow);
                    }
                    if (!SelectedMainRow.DetailsList.Any())
                    {
                        AddNewDetailRow(false);
                    }
                };
                GetMaindata();
            }
        }
コード例 #14
0
        public GlRuleViewModel()
        {
            if (!IsDesignTime)
            {
                GetItemPermissions(PermissionItemName.GlRule.ToString());
                Glclient = new GlServiceClient();

                Glclient.GetGlInventoryGroupAsync(LoggedUserInfo.DatabasEname);

                Glclient.GetGlInventoryGroupCompleted += (s, sv) =>
                {
                    GlInventoryGroupList = sv.Result;
                };
                var journalAccountTypeClient = new GlServiceClient();
                journalAccountTypeClient.GetGenericCompleted += (s, sv) =>
                {
                    JournalAccountTypeList       = sv.Result;
                    JournalAccountTypeListFilter = new ObservableCollection <GenericTable>(sv.Result.Where(x => x.Iserial == 0 || x.Iserial == 8));
                    var newrow = JournalAccountTypeListFilter.FirstOrDefault(x => x.Iserial == 0);
                    newrow.Code  = "Group";
                    newrow.Ename = "Group";
                    newrow.Aname = "Group";
                };
                journalAccountTypeClient.GetGenericAsync("TblJournalAccountType", "%%", "%%", "%%", "Iserial", "ASC", LoggedUserInfo.DatabasEname);

                var glRuleTypeClient = new GlServiceClient();
                glRuleTypeClient.GetGenericCompleted += (s, sv) => { CostCenterTypeList = sv.Result; };
                glRuleTypeClient.GetGenericAsync("TblCostCenterType", "%%", "%%", "%%", "Iserial", "ASC",
                                                 LoggedUserInfo.DatabasEname);

                var tblCostCenterOptionClient = new GlServiceClient();
                tblCostCenterOptionClient.GetGenericCompleted += (s, sv) => { CostCenterOptionList = sv.Result; };
                tblCostCenterOptionClient.GetGenericAsync("tblCostCenterOption", "%%", "%%", "%%", "Iserial", "ASC",

                                                          LoggedUserInfo.DatabasEname);

                var tblCostAllocationMethodClient = new GlServiceClient();
                tblCostAllocationMethodClient.GetGenericCompleted += (s, sv) => { CostAllocationMethodList = sv.Result; };
                tblCostAllocationMethodClient.GetGenericAsync("TblCostAllocationMethod", "%%", "%%", "%%", "Iserial", "ASC",
                                                              LoggedUserInfo.DatabasEname);

                MainRowList     = new SortableCollectionView <TblGlRuleHeaderViewModel>();
                SelectedMainRow = new TblGlRuleHeaderViewModel();

                Glclient.GetTblGlRuleHeaderCompleted += (s, sv) =>
                {
                    foreach (var row in sv.Result)
                    {
                        var newrow = new TblGlRuleHeaderViewModel();
                        newrow.InjectFrom(row);
                        MainRowList.Add(newrow);
                    }

                    Loading   = false;
                    FullCount = sv.fullCount;
                    if (MainRowList.Any() && (SelectedMainRow == null))
                    {
                        SelectedMainRow = MainRowList.FirstOrDefault();
                    }
                    if (FullCount == 0 && MainRowList.Count == 0)
                    {
                        AddNewMainRow(false);
                    }
                };

                Glclient.UpdateOrInsertTblGlRuleHeadersCompleted += (s, ev) =>
                {
                    if (ev.Error != null)
                    {
                        MessageBox.Show(ev.Error.Message);
                    }
                    try
                    {
                        MainRowList.ElementAt(ev.outindex).InjectFrom(ev.Result);
                    }
                    catch (Exception)
                    {
                    }
                };
                Glclient.DeleteTblGlRuleHeaderCompleted += (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);
                    }
                    if (!MainRowList.Any())
                    {
                        AddNewMainRow(false);
                    }
                };

                Glclient.GetTblGlRuleMainDetailCompleted += (s, sv) =>
                {
                    foreach (var row in sv.Result)
                    {
                        var newrow = new TblGlRuleMainDetailViewModel();

                        newrow.EntityAccountPerRow = new Entity();

                        newrow.EntityAccountPerRow =
                            sv.entityList.FirstOrDefault(x => x.TblJournalAccountType == row.TblJournalAccountType &&
                                                         x.Iserial == row.EntityAccount);

                        if (row.TblJournalAccountType1 != null)
                        {
                            newrow.JournalAccountTypePerRow = new GenericTable();
                            newrow.JournalAccountTypePerRow.InjectFrom(row.TblJournalAccountType1);
                        }
                        if (row.TblCostCenterType1 != null)
                        {
                            newrow.CostCenterTypePerRow = new GenericTable();
                            newrow.CostCenterTypePerRow.InjectFrom(row.TblCostCenterType1);
                        }
                        if (row.TblCostCenterOption1 != null)
                        {
                            newrow.CostCenterOptionPerRow = new GenericTable();
                            newrow.CostCenterOptionPerRow.InjectFrom(row.TblCostCenterOption1);
                        }
                        if (row.TblCostAllocationMethod1 != null)
                        {
                            newrow.CostAllocationMethodPerRow = new GenericTable();
                            newrow.CostAllocationMethodPerRow.InjectFrom(row.TblCostAllocationMethod1);
                        }
                        newrow.InjectFrom(row);
                        SelectedMainRow.DetailsList.Add(newrow);
                    }

                    Loading         = false;
                    DetailFullCount = sv.fullCount;
                    if (SelectedMainRow.DetailsList.Any() && (SelectedDetailRow == null))
                    {
                        SelectedDetailRow = SelectedMainRow.DetailsList.FirstOrDefault();
                    }
                    if (DetailFullCount == 0 && SelectedMainRow.DetailsList.Count == 0)
                    {
                        AddNewDetailRow(false);
                    }
                };

                Glclient.UpdateOrInsertTblGlRuleMainDetailsCompleted += (s, ev) =>
                {
                    if (ev.Error != null)
                    {
                        MessageBox.Show(ev.Error.Message);
                    }
                    try
                    {
                        SelectedDetailRow.DetailsList.ElementAt(ev.outindex).InjectFrom(ev.Result);
                    }
                    catch (Exception)
                    {
                    }
                };
                Glclient.DeleteTblGlRuleMainDetailCompleted += (s, ev) =>
                {
                    if (ev.Error != null)
                    {
                        MessageBox.Show(ev.Error.Message);
                    }

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

                Glclient.GetTblGlRuleDetailCompleted += (s, sv) =>
                {
                    foreach (var row in sv.Result)
                    {
                        var newrow = new TblGlRuleDetailViewModel
                        {
                            CostCenterPerRow         = row.TblCostCenter1,
                            TblCostCenterType        = SelectedDetailRow.TblCostCenterType,
                            CostCenterTypePerRow     = SelectedDetailRow.CostCenterTypePerRow,
                            JournalAccountTypePerRow = JournalAccountTypeListFilter.FirstOrDefault(x => x.Iserial == row.TblJournalAccountType)
                        };

                        if (row.TblJournalAccountType != null)
                        {
                            newrow.GlInventoryGroupPerRow =
                                GlInventoryGroupList.FirstOrDefault(
                                    x =>
                                    x.TblJournalAccountType == row.TblJournalAccountType &&
                                    x.Iserial == row.GlInventoryGroup);
                        }

                        newrow.InjectFrom(row);

                        SelectedDetailRow.DetailsList.Add(newrow);
                    }
                    Loading            = false;
                    DetailSubFullCount = sv.fullCount;

                    if (SelectedDetailRow.DetailsList.Any() &&
                        (SelectedSubDetailRow == null))
                    {
                        SelectedSubDetailRow = SelectedDetailRow.DetailsList.FirstOrDefault();
                    }

                    if (DetailSubFullCount == 0 && SelectedDetailRow.DetailsList.Count == 0)
                    {
                        AddNewSubDetailRow(false);
                    }
                };

                Glclient.UpdateOrInsertTblGlRuleDetailsCompleted += (s, x) =>
                {
                    var savedRow = (TblGlRuleDetailViewModel)SelectedDetailRow.DetailsList.GetItemAt(x.outindex);
                    if (savedRow != null)
                    {
                        savedRow.InjectFrom(x.Result);
                    }
                    Loading = false;
                };

                Glclient.DeleteTblGlRuleDetailCompleted += (s, ev) =>
                {
                    if (ev.Error != null)
                    {
                        MessageBox.Show(ev.Error.Message);
                    }
                    Loading = false;
                    var oldrow = SelectedDetailRow.DetailsList.FirstOrDefault(x => x.Iserial == ev.Result);
                    if (oldrow != null)
                    {
                        SelectedDetailRow.DetailsList.Remove(oldrow);
                    }
                    if (!SelectedDetailRow.DetailsList.Any())
                    {
                        AddNewSubDetailRow(false);
                    }
                };

                GetMaindata();
            }
        }
コード例 #15
0
        public CashDepositeTypeViewModel()
        {
            if (!IsDesignTime)
            {
                GetItemPermissions(PermissionItemName.CashdepositeTypeForm.ToString());
                Glclient        = new GlServiceClient();
                MainRowList     = new SortableCollectionView <TblCashDepositeTypeViewModel>();
                SelectedMainRow = new TblCashDepositeTypeViewModel();


                if (MainRowList.Any() && (SelectedMainRow == null))
                {
                    SelectedMainRow = MainRowList.FirstOrDefault();
                }

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

                Glclient.GetTblCashDepositTypeCompleted += (s, sv) =>
                {
                    CashDepositTypeList = sv.Result;
                    foreach (var row in sv.Result)
                    {
                        var newrow = new TblCashDepositeTypeViewModel();
                        newrow.TblSequencePerRow       = new GenericTable();
                        newrow.DepositeTypeGroupPerRow = new GenericTable();
                        newrow.InjectFrom(row);

                        if (row.TblSequence1 != null)
                        {
                            newrow.TblSequencePerRow.InjectFrom(row.TblSequence1);
                        }
                        if (row.DepositeTypeGroup != null && row.DepositeTypeGroup != 0)
                        {
                            newrow.DepositeTypeGroupPerRow.InjectFrom(CashDepositTypeList.FirstOrDefault(x => x.Iserial == newrow.DepositeTypeGroup));
                        }

                        MainRowList.Add(newrow);
                    }

                    Loading   = false;
                    FullCount = sv.fullCount;
                    if (MainRowList.Any() && (SelectedMainRow == null))
                    {
                        SelectedMainRow = MainRowList.FirstOrDefault();
                    }
                    if (FullCount == 0 && MainRowList.Count == 0)
                    {
                        AddNewMainRow(false);
                    }
                    if (Export)
                    {
                        Export = false;
                        ExportGrid.ExportExcel("CashDepositeType");
                    }
                };

                Glclient.UpdateOrInsertTblCashDepositTypeCompleted += (s, ev) =>
                {
                    if (ev.Error != null)
                    {
                        MessageBox.Show(ev.Error.Message);
                    }
                    try
                    {
                        MainRowList.ElementAt(ev.outindex).InjectFrom(ev.Result);
                    }
                    catch (Exception)
                    {
                    }
                };
                Glclient.DeleteTblCashDepositTypesCompleted += (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);
                    }
                    if (!MainRowList.Any())
                    {
                        AddNewMainRow(false);
                    }
                };

                Glclient.GetCashDepositeSequenceCompleted += (s, sv) =>
                {
                    SequenceList = sv.Result;
                };

                Glclient.GetCashDepositeSequenceAsync(LoggedUserInfo.DatabasEname);

                GetMaindata();
            }
        }
コード例 #16
0
        public GlRuleJobViewModel()
        {
            if (!IsDesignTime)
            {
                Client.GetGenericAsync("TblAuthJob", "%%", "%%", "%%", "Iserial", "ASC");
                Client.GetGenericCompleted += (s, sv) => { JobList = sv.Result; };
                GetItemPermissions(PermissionItemName.GlRuleJob.ToString());
                Glclient = new GlServiceClient();
                var glRuleHeaderClient = new GlServiceClient();
                glRuleHeaderClient.GetGenericCompleted += (s, sv) => { GlRuleHeaderList = sv.Result; };
                glRuleHeaderClient.GetGenericAsync("TblGlRuleHeader", "%%", "%%", "%%", "Iserial", "ASC", LoggedUserInfo.DatabasEname);
                MainRowList     = new SortableCollectionView <TblGlRuleJobViewModel>();
                SelectedMainRow = new TblGlRuleJobViewModel();

                Glclient.GetTblGlRuleJobCompleted += (s, sv) =>
                {
                    foreach (var row in sv.Result)
                    {
                        var newrow = new TblGlRuleJobViewModel();
                        newrow.InjectFrom(row);

                        newrow.GlRuleHeaderPerRow = new GenericTable();
                        if (sv.userList.FirstOrDefault(x => x.Iserial == row.TblJob) != null)
                        {
                            newrow.JobPerRow = new CRUDManagerService.GenericTable();
                            newrow.JobPerRow.InjectFrom(sv.userList.FirstOrDefault(x => x.Iserial == row.TblJob));
                        }

                        newrow.GlRuleHeaderPerRow.InjectFrom(row.TblGlRuleHeader1);
                        MainRowList.Add(newrow);
                    }

                    Loading   = false;
                    FullCount = sv.fullCount;
                    if (MainRowList.Any() && (SelectedMainRow == null))
                    {
                        SelectedMainRow = MainRowList.FirstOrDefault();
                    }
                    if (FullCount == 0 && MainRowList.Count == 0)
                    {
                        AddNewMainRow(false);
                    }
                };

                Glclient.UpdateOrInsertTblGlRuleJobsCompleted += (s, ev) =>
                {
                    if (ev.Error != null)
                    {
                        MessageBox.Show(ev.Error.Message);
                    }
                    try
                    {
                        MainRowList.ElementAt(ev.outindex).InjectFrom(ev.Result);
                    }
// ReSharper disable once EmptyGeneralCatchClause
                    catch (Exception)
                    {
                    }
                };
                Glclient.DeleteTblGlRuleJobCompleted += (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);
                    }
                    if (!MainRowList.Any())
                    {
                        AddNewMainRow(false);
                    }
                };

                GetMaindata();
            }
        }
コード例 #17
0
        public ShopReqHeaderViewModel()
        {
            if (!DesignerProperties.IsInDesignTool)
            {
                Year            = DateTime.Now.Year;
                Week            = GetIso8601WeekOfYear(DateTime.Now);
                MainRowList     = new SortableCollectionView <TblShopReqHeaderViewModel>();
                SelectedMainRow = new TblShopReqHeaderViewModel();
                var shopAccClient = new GlServiceClient();
                shopAccClient.GetGenericCompleted += (s, sv) =>
                {
                    foreach (var variable in sv.Result)
                    {
                        SelectedMainRow.TblShopReqAccs.Add(new TblShopReqAcc
                        {
                            TblShopAcc  = variable.Iserial,
                            TblShopAcc1 = new TblShopAcc
                            {
                                Iserial = variable.Iserial,
                                Code    = variable.Code,
                                Ename   = variable.Ename,
                                Aname   = variable.Aname,
                            }
                        });
                    }
                };
                shopAccClient.GetGenericAsync("TblShopAcc", "%%", "%%", "%%", "Iserial", "ASC", LoggedUserInfo.DatabasEname);

                var tblItemDownLoadDefClient = new GlServiceClient();
                tblItemDownLoadDefClient.GetGenericCompleted += (s, sv) =>
                {
                    TblItemDownLoadDefList = sv.Result;
                };
                tblItemDownLoadDefClient.GetGenericAsync("TblItemDownLoadDef", "%%", "%%", "%%", "Iserial", "ASC", LoggedUserInfo.DatabasEname);
                SelectedMainRow.TblShopReqComments = new ObservableCollection <TblShopReqComment>();
                var shopCommentsClient = new GlServiceClient();
                shopCommentsClient.GetGenericCompleted += (s, sv) =>
                {
                    foreach (var variable in sv.Result)
                    {
                        SelectedMainRow.TblShopReqComments.Add(new TblShopReqComment
                        {
                            TblShopComments = variable.Iserial,
                            TblShopComment  = new TblShopComment
                            {
                                Iserial = variable.Iserial,
                                Code    = variable.Code,
                                Ename   = variable.Ename,
                                Aname   = variable.Aname,
                            }
                        });
                    }
                };
                shopCommentsClient.GetGenericAsync("TblShopComments", "%%", "%%", "%%", "Iserial", "ASC", LoggedUserInfo.DatabasEname);

                Client.GetTblShopReqHeaderCompleted += (s, sv) =>
                {
                    SelectedMainRow.Iserial = 0;
                    if (sv.Result != null)
                    {
                        if (sv.Result.Any())
                        {
                            SelectedMainRow.Iserial            = sv.Result.FirstOrDefault().Iserial;
                            SelectedMainRow.TblStore           = sv.Result.FirstOrDefault().TblStore;
                            SelectedMainRow.TblItemDownLoadDef = sv.Result.FirstOrDefault().TblItemDownLoadDef;
                            SelectedMainRow.Year = sv.Result.FirstOrDefault().Year;
                            SelectedMainRow.Week = sv.Result.FirstOrDefault().Week;
                        }
                    }
                    GetDetailData(SelectedMainRow.Iserial);
                    Loading = false;
                };

                Client.GetTblShopReqAccCompleted += (s, sv) =>
                {
                    foreach (var variable in SelectedMainRow.TblShopReqAccs)
                    {
                        variable.Qty = 0;
                    }
                    foreach (var variable in sv.Result)
                    {
                        SelectedMainRow.TblShopReqAccs.FirstOrDefault(x => x.TblShopAcc == variable.TblShopAcc).Qty = variable.Qty;
                    }
                };

                Client.GetTblShopReqCommentsCompleted += (s, sv) =>
                {
                    foreach (var variable in SelectedMainRow.TblShopReqComments)
                    {
                        variable.Comments = "";
                    }
                    foreach (var variable in sv.Result)
                    {
                        SelectedMainRow.TblShopReqComments.FirstOrDefault(x => x.TblShopComments == variable.TblShopComments).Comments = variable.Comments;
                    }
                };

                Client.GetTblShopReqInvCompleted += (s, sv) =>
                {
                    SelectedMainRow.TblShopReqInvs.Clear();
                    foreach (var variable in sv.Result)
                    {
                        var newrow = new TblShopReqInvViewModel
                        {
                            Qty          = variable.Qty,
                            Iserial      = variable.Iserial,
                            TBLITEMprice = variable.TBLITEMprice,
                            SearchPerRow = new viewstyle()
                            {
                                Code = variable.TBLITEMprice,
                            },
                            TblColor  = variable.TblColor,
                            TblSize   = variable.TblSize,
                            TblColor1 = new GlService.TblColorTest()
                            {
                                ISERIAL = variable.TblColor1.ISERIAL,
                                Code    = variable.TblColor1.Code,
                                Aname   = variable.TblColor1.Aname,
                                Ename   = variable.TblColor1.Ename,
                            },

                            TblSize1 = new GlService.TblSizeRetail()
                            {
                                Iserial = variable.TblSize1.Iserial,

                                Code  = variable.TblSize1.Code,
                                Aname = variable.TblSize1.Aname,
                                Ename = variable.TblSize1.Ename,
                            }
                        };

                        SelectedMainRow.TblShopReqInvs.Add(newrow);
                    }
                    if (!sv.Result.Any())
                    {
                        AddNewMainRow(false);
                    }
                };

                Client.UpdateOrDeleteTblShopReqInvCompleted += (s, sv) =>
                {
                    var savedRow = SelectedMainRow.TblShopReqInvs.ElementAt(sv.outindex);

                    if (savedRow != null)
                    {
                        savedRow.Iserial = sv.Result.Iserial;
                    }
                };

                if (LoggedUserInfo.Store != null)
                {
                    StorePerRow = new TblStore().InjectFrom(LoggedUserInfo.Store) as TblStore;
                }
                StoreList = new SortableCollectionView <TblStore>();

                if (LoggedUserInfo.AllowedStores != null && LoggedUserInfo.Company.Code != "HQ")
                {
                    Client.SearchBysStoreNameAsync(new ObservableCollection <int>(LoggedUserInfo.AllowedStores), LoggedUserInfo.Iserial, null, null, LoggedUserInfo.DatabasEname);
                }

                Client.SearchBysStoreNameCompleted += (s, sv) =>
                {
                    StoreList = sv.Result;
                };

                GetMaindata();
            }
        }
コード例 #18
0
ファイル: VisaMachineViewModel.cs プロジェクト: Osama91/CCWFM
        public VisaMachineViewModel()
        {
            if (!IsDesignTime)
            {
                GetItemPermissions(PermissionItemName.VisaMachineForm.ToString());
                Glclient        = new GlServiceClient();
                MainRowList     = new SortableCollectionView <TblVisaMachineViewModel>();
                SelectedMainRow = new TblVisaMachineViewModel();


                if (MainRowList.Any() && (SelectedMainRow == null))
                {
                    SelectedMainRow = MainRowList.FirstOrDefault();
                }

                Glclient.GetTblVisaMachineCompleted += (s, sv) =>
                {
                    foreach (var row in sv.Result)
                    {
                        var newrow = new TblVisaMachineViewModel();
                        newrow.TblbankPerRow = new TblBank();
                        newrow.InjectFrom(row);

                        if (row.TblBank1 != null)
                        {
                            newrow.TblbankPerRow.InjectFrom(row.TblBank1);
                        }

                        newrow.JournalAccountTypePerRow = new GlService.GenericTable();
                        if (newrow.TblJournalAccountType.HasValue)
                        {
                            newrow.JournalAccountTypePerRow =
                                JournalAccountTypeList.FirstOrDefault(jAT => jAT.Iserial == newrow.TblJournalAccountType.Value);
                        }

                        var entity = sv.EntityAccounts.FirstOrDefault(x => x.TblJournalAccountType == newrow.TblJournalAccountType &&
                                                                      x.Iserial == row.EntityAccount);
                        if (entity != null)
                        {
                            newrow.EntityPerRow.InjectFrom(entity); newrow.RaiseEntityChanged();
                        }


                        MainRowList.Add(newrow);
                    }

                    Loading   = false;
                    FullCount = sv.fullCount;
                    if (MainRowList.Any() && (SelectedMainRow == null))
                    {
                        SelectedMainRow = MainRowList.FirstOrDefault();
                    }
                    if (FullCount == 0 && MainRowList.Count == 0)
                    {
                        AddNewMainRow(false);
                    }
                    if (Export)
                    {
                        Export = false;
                        ExportGrid.ExportExcel("VisaMachines");
                    }
                };

                Glclient.UpdateOrInsertTblVisaMachineCompleted += (s, ev) =>
                {
                    if (ev.Error != null)
                    {
                        MessageBox.Show(ev.Error.Message);
                    }
                    try
                    {
                        MainRowList.ElementAt(ev.outindex).InjectFrom(ev.Result);
                    }
                    catch (Exception)
                    {
                    }
                };
                Glclient.DeleteTblVisaMachineCompleted += (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);
                    }
                    if (!MainRowList.Any())
                    {
                        AddNewMainRow(false);
                    }
                };

                Glclient.GetVisaMachineBanksCompleted += (s, sv) =>
                {
                    BankList = sv.Result;
                };

                Glclient.GetVisaMachineBanksAsync(LoggedUserInfo.DatabasEname);

                GetMaindata();
            }
        }
コード例 #19
0
        public GlExpensisViewModel()
        {
            if (!IsDesignTime)
            {
                GetItemPermissions(PermissionItemName.GlExpensis.ToString());
                Glclient = new GlServiceClient();

                var glExpensisClient = new GlServiceClient();
                glExpensisClient.GetGenericCompleted += (s, sv) =>
                {
                    GlExpensisGroupList = sv.Result;
                };
                glExpensisClient.GetGenericAsync("TblGLExpensisGroup", "%%", "%%", "%%", "Iserial", "ASC", LoggedUserInfo.DatabasEname);

                MainRowList     = new SortableCollectionView <TblGlExpensisViewModel>();
                SelectedMainRow = new TblGlExpensisViewModel();

                Glclient.GetTblGlExpensisCompleted += (s, sv) =>
                {
                    foreach (var row in sv.Result)
                    {
                        var newrow = new TblGlExpensisViewModel();
                        newrow.InjectFrom(row);
                        newrow.GlExpensisGroupPerRow = new GenericTable();
                        if (row.TblGLExpensisGroup1 != null)
                        {
                            newrow.GlExpensisGroupPerRow.InjectFrom(row.TblGLExpensisGroup1);
                        }

                        MainRowList.Add(newrow);
                    }

                    Loading   = false;
                    FullCount = sv.fullCount;
                    if (MainRowList.Any() && (SelectedMainRow == null))
                    {
                        SelectedMainRow = MainRowList.FirstOrDefault();
                    }
                    if (FullCount == 0 && MainRowList.Count == 0)
                    {
                        AddNewMainRow(false);
                    }
                    if (Export)
                    {
                        Export      = false;
                        AllowExport = true;
                        //ExportGrid.ExportExcel("Account");
                    }
                };

                Glclient.UpdateOrInsertTblGlExpensisCompleted += (s, ev) =>
                {
                    if (ev.Error != null)
                    {
                        MessageBox.Show(ev.Error.Message);
                    }
                    try
                    {
                        MainRowList.ElementAt(ev.outindex).InjectFrom(ev.Result);
                    }
                    catch (Exception)
                    {
                    }
                    Loading = false;
                };
                Glclient.DeleteTblGlExpensisCompleted += (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);
                    }
                    if (!MainRowList.Any())
                    {
                        AddNewMainRow(false);
                    }
                };

                GetMaindata();
            }
        }
コード例 #20
0
        public JournalViewModel()
        {
            if (!IsDesignTime)
            {
                GetItemPermissions(PermissionItemName.Journal.ToString());
                Glclient        = new GlServiceClient();
                MainRowList     = new SortableCollectionView <TblJournalViewModel>();
                SelectedMainRow = new TblJournalViewModel();

                var currencyClient = new GlServiceClient();
                currencyClient.GetGenericCompleted += (s, sv) =>
                {
                    CurrencyList = sv.Result;
                };
                currencyClient.GetGenericAsync("TblCurrency", "%%", "%%", "%%", "Iserial", "ASC", LoggedUserInfo.DatabasEname);

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

                var journalTypeClient = new GlServiceClient();
                journalTypeClient.GetGenericCompleted += (s, sv) =>
                {
                    JournalTypeList = sv.Result;
                };
                journalTypeClient.GetGenericAsync("TblJournalType", "%%", "%%", "%%", "Iserial", "ASC", LoggedUserInfo.DatabasEname);
                Glclient.GetTblJournalCompleted += (s, sv) =>
                {
                    foreach (var row in sv.Result)
                    {
                        var newrow = new TblJournalViewModel();
                        newrow.InjectFrom(row);

                        newrow.JournalAccountTypePerRow = new GenericTable();
                        if (row.TblJournalAccountType1 != null)
                        {
                            newrow.JournalAccountTypePerRow.InjectFrom(row.TblJournalAccountType1);
                        }
                        newrow.JournalTypePerRow = new GenericTable();
                        newrow.JournalTypePerRow.InjectFrom(row.TblJournalType1);
                        newrow.CurrencyPerRow = new GenericTable();
                        newrow.CurrencyPerRow.InjectFrom(row.TblCurrency1);

                        newrow.HeaderSequencePerRow      = row.TblSequence;
                        newrow.DetailSequencePerRow      = row.TblSequence1;
                        newrow.OffsetEntityAccountPerRow =
                            sv.entityList.FirstOrDefault(x => x.TblJournalAccountType == row.TblJournalAccountType && x.Iserial == row.Entity);

                        MainRowList.Add(newrow);
                    }

                    Loading   = false;
                    FullCount = sv.fullCount;
                    if (MainRowList.Any() && (SelectedMainRow == null))
                    {
                        SelectedMainRow = MainRowList.FirstOrDefault();
                    }
                    if (FullCount == 0 && MainRowList.Count == 0)
                    {
                        AddNewMainRow(false);
                    }
                    if (Export)
                    {
                        Export = false;
                        ExportGrid.ExportExcel("Journal");
                    }
                };

                Glclient.UpdateOrInsertTblJournalsCompleted += (s, ev) =>
                {
                    if (ev.Error != null)
                    {
                        MessageBox.Show(ev.Error.Message);
                    }
                    try
                    {
                        MainRowList.ElementAt(ev.outindex).InjectFrom(ev.Result);
                    }
                    catch (Exception)
                    {
                    }
                    Loading = false;
                };
                Glclient.DeleteTblJournalCompleted += (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);
                    }
                    if (!MainRowList.Any())
                    {
                        AddNewMainRow(false);
                    }
                };

                GetMaindata();
            }
        }
コード例 #21
0
ファイル: AssetGroupViewModel.cs プロジェクト: Osama91/CCWFM
        public AssetGroupViewModel()
        {
            if (!DesignerProperties.IsInDesignTool)
            {
                GetItemPermissions(PermissionItemName.AssetGroup.ToString());
                MainRowList = new ObservableCollection <TblAssetGroupViewModel>();

                var accountTypeClient = new GlServiceClient();
                Glclient.UpdateOrInsertTblAssetGroupCompleted += (s, x) =>
                {
                    if (x.Error != null)
                    {
                        MessageBox.Show(x.Error.Message);
                    }
                    try
                    {
                        MainRowList.ElementAt(x.outindex).InjectFrom(x.Result);
                    }
                    catch (Exception)
                    {
                    }
                    Loading = false;
                };

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

                    SelectedMainRow = new TblAssetGroupViewModel();
                };

                Glclient.GetTblAssetGroupCompleted += (s, sv) =>
                {
                    foreach (var row in sv.Result)
                    {
                        var newrow = new TblAssetGroupViewModel();
                        newrow.InjectFrom(row);

                        newrow.AccountPerRow = new TblAccount();
                        if (row.TblAccount1 != null)
                        {
                            newrow.AccountPerRow = row.TblAccount1;
                        }

                        newrow.SumAccountPerRow = new TblAccount();
                        if (row.TblAccount2 != null)
                        {
                            newrow.SumAccountPerRow = row.TblAccount2;
                        }
                        MainRowList.Add(newrow);
                    }

                    Loading   = false;
                    FullCount = sv.fullCount;
                    if (MainRowList.Any() && (SelectedMainRow == null))
                    {
                        SelectedMainRow = MainRowList.FirstOrDefault();
                    }
                    if (FullCount == 0 && MainRowList.Count == 0)
                    {
                        AddNewMainRow(false);
                    }
                };
                GetMaindata();
            }
        }
コード例 #22
0
ファイル: SequenceViewModel.cs プロジェクト: Osama91/CCWFM
        public SequenceViewModel()
        {
            if (!IsDesignTime)
            {
                GetItemPermissions(PermissionItemName.Sequence.ToString());
                Glclient        = new GlServiceClient();
                MainRowList     = new SortableCollectionView <TblSequenceViewModel>();
                SelectedMainRow = new TblSequenceViewModel();

                Glclient.GetTblSequenceCompleted += (s, sv) =>
                {
                    foreach (var row in sv.Result)
                    {
                        var newrow = new TblSequenceViewModel();
                        newrow.InjectFrom(row);
                        MainRowList.Add(newrow);
                    }

                    Loading   = false;
                    FullCount = sv.fullCount;
                    if (MainRowList.Any() && (SelectedMainRow == null))
                    {
                        SelectedMainRow = MainRowList.FirstOrDefault();
                    }
                    if (FullCount == 0 && MainRowList.Count == 0)
                    {
                        AddNewMainRow(false);
                    }
                    if (Export)
                    {
                        Export = false;
                        ExportGrid.ExportExcel("Sequence");
                    }
                };

                Glclient.UpdateOrInsertTblSequencesCompleted += (s, ev) =>
                {
                    if (ev.Error != null)
                    {
                        MessageBox.Show(ev.Error.Message);
                    }
                    try
                    {
                        MainRowList.ElementAt(ev.outindex).InjectFrom(ev.Result);
                    }
                    catch (Exception)
                    {
                    }
                };
                Glclient.DeleteTblSequenceCompleted += (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);
                    }
                    if (!MainRowList.Any())
                    {
                        AddNewMainRow(false);
                    }
                };

                GetMaindata();
            }
        }
コード例 #23
0
ファイル: MarkUpViewModel.cs プロジェクト: Osama91/CCWFM
        public MarkupViewModel()
        {
            if (!IsDesignTime)
            {
                GetItemPermissions(PermissionItemName.Markup.ToString());
                Glclient = new GlServiceClient();

                var tblRecInvHeaderTypeClient = new GlServiceClient();
                tblRecInvHeaderTypeClient.GetGenericCompleted += (s, sv) =>
                {
                    MarkupGroupList = sv.Result;
                };
                tblRecInvHeaderTypeClient.GetGenericAsync("TblMarkupGroup", "%%", "%%", "%%", "Iserial", "ASC", LoggedUserInfo.DatabasEname);

                DirectionList = new ObservableCollection <GenericTable>
                {
                    new GenericTable {
                        Iserial = 1, Code = "1", Ename = "1", Aname = "1"
                    },
                    new GenericTable {
                        Iserial = -1, Code = "-1", Ename = "-1", Aname = "-1"
                    }
                };

                MainRowList     = new SortableCollectionView <TblMarkupViewModel>();
                SelectedMainRow = new TblMarkupViewModel();

                Glclient.GetTblMarkupCompleted += (s, sv) =>
                {
                    foreach (var row in sv.Result)
                    {
                        var newrow = new TblMarkupViewModel {
                            MarkupGroupPerRow = new GenericTable()
                        };
                        newrow.MarkupGroupPerRow.InjectFrom(row.TblMarkupGroup1);
                        newrow.InjectFrom(row);

                        MainRowList.Add(newrow);
                    }

                    Loading   = false;
                    FullCount = sv.fullCount;
                    if (MainRowList.Any() && (SelectedMainRow == null))
                    {
                        SelectedMainRow = MainRowList.FirstOrDefault();
                    }
                    if (FullCount == 0 && MainRowList.Count == 0)
                    {
                        AddNewMainRow(false);
                    }
                };

                Glclient.UpdateOrInsertTblMarkupsCompleted += (s, ev) =>
                {
                    if (ev.Error != null)
                    {
                        MessageBox.Show(ev.Error.Message);
                    }
                    try
                    {
                        MainRowList.ElementAt(ev.outindex).InjectFrom(ev.Result);
                    }
                    catch (Exception)
                    {
                    }
                };
                Glclient.DeleteTblMarkupCompleted += (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);
                    }
                    if (!MainRowList.Any())
                    {
                        AddNewMainRow(false);
                    }
                };

                GetMaindata();
            }
        }
コード例 #24
0
        public IncomeStatmentViewModel()
        {
            if (!IsDesignTime)
            {
                GetItemPermissions(PermissionItemName.IncomeStatment.ToString());
                Glclient = new GlServiceClient();
                var glRuleTypeClient = new GlServiceClient();
                glRuleTypeClient.GetGenericCompleted += (s, sv) => {
                    CostCenterTypeList = sv.Result;
                };
                glRuleTypeClient.GetGenericAsync("TblCostCenterType", "%%", "%%", "%%", "Iserial", "ASC",
                                                 LoggedUserInfo.DatabasEname);
                MainRowList      = new SortableCollectionView <TblIncomeStatmentHeaderModel>();
                SelectedMainRow  = new TblIncomeStatmentHeaderModel();
                DesignHeaderList = new ObservableCollection <TblIncomeStatmentDesignHeader>();

                Glclient.GetTblIncomeStatmentDesignHeaderAsync(0, int.MaxValue, "it.Iserial", null, null,
                                                               LoggedUserInfo.DatabasEname);
                Glclient.GetTblIncomeStatmentDesignHeaderCompleted += (s, sv) =>
                {
                    DesignHeaderList = sv.Result;
                    if (DesignHeaderList.Count == 1)
                    {
                        SelectedMainRow.DesignHeaderPerRow = DesignHeaderList.FirstOrDefault();
                    }
                };
                Glclient.GetIncomeStatmentDataCostCenterCompleted += (s, sv) =>
                {
                    SelectedMainRow.DetailsList.Clear();
                    foreach (var variable in sv.DesignDetailList.OrderBy(x => x.RowOrder))
                    {
                        var vis       = Visibility.Collapsed;
                        var itemVis   = Visibility.Visible;
                        var doubleVis = Visibility.Collapsed;
                        if (variable.Type == "Double Seprator" || variable.Type == "Seprator")
                        {
                            if (variable.Type == "Seprator")
                            {
                                vis = Visibility.Visible;
                            }
                            if (variable.Type == "Double Seprator")
                            {
                                doubleVis = Visibility.Visible;
                            }
                            itemVis = Visibility.Collapsed;
                        }

                        var newrow = new TblIncomeStatmentDetailModel
                        {
                            Bold              = variable.Bold,
                            Description       = variable.Description,
                            RowOrder          = variable.RowOrder,
                            Type              = variable.Type,
                            IsSeparator       = vis,
                            IsItem            = itemVis,
                            IsDoubleSeparator = doubleVis,
                        };

                        if (variable.Type.StartsWith("Account"))
                        {
                            if (sv.Result != null)
                            {
                                var oldrow = sv.Result.FirstOrDefault(x => x.AccountPerRow.Ename == variable.Description);
                                if (oldrow != null)
                                {
                                    newrow.CrAmount   = oldrow.CrAmount;
                                    newrow.DrAmount   = oldrow.DrAmount;
                                    newrow.Accountemp = oldrow.AccountTemp;
                                }
                            }

                            if (variable.Type == "Account With Subs")
                            {
                                if (sv.Result != null)
                                {
                                    var oldrow = sv.Result.Where(x => SelectedMainRow.DetailsList.Select(w => w.Accountemp).Equals(x.AccountTemp)).ToList();

                                    // ReSharper disable once InconsistentNaming
                                    foreach (var VARIABLE in oldrow)
                                    {
                                        var newrowaa = new TblIncomeStatmentDetailModel
                                        {
                                            Bold              = variable.Bold,
                                            Description       = variable.Description,
                                            RowOrder          = variable.RowOrder,
                                            Type              = variable.Type,
                                            IsSeparator       = vis,
                                            IsItem            = itemVis,
                                            IsDoubleSeparator = doubleVis,
                                            CrAmount          = VARIABLE.CrAmount,
                                            DrAmount          = VARIABLE.DrAmount
                                        };
                                        SelectedMainRow.DetailsList.Add(newrowaa);
                                    }
                                }
                            }
                        }
                        else if (variable.Type == "Total")
                        {
                            var crAmount =
                                SelectedMainRow.DetailsList.Where(x => x.Type != "Total" && x.Type != "Account With Subs" && x.RowOrder < variable.RowOrder)
                                .Sum(x => x.CrAmount);

                            var drAmount =
                                SelectedMainRow.DetailsList.Where(x => x.Type != "Total" && x.Type != "Account With Subs" && x.RowOrder < variable.RowOrder)
                                .Sum(x => x.DrAmount);

                            if (drAmount > crAmount)
                            {
                                newrow.DrAmount = drAmount - crAmount;
                            }
                            else
                            {
                                newrow.CrAmount = crAmount - drAmount;
                            }
                        }
                        else if (variable.Type == "Income Tax")
                        {
                            var oldrow = SelectedMainRow.DetailsList.FirstOrDefault(x => x.RowOrder == variable.RowOrder - 1);

                            if (oldrow != null)
                            {
                                var value = oldrow.CrAmount ?? 0;

                                foreach (var taxrow in sv.IncomeTax.OrderBy(w => w.Iserial))
                                {
                                    if (value >= taxrow.ToValue)
                                    {
                                        newrow.DrAmount = newrow.DrAmount ?? 0 +
                                                          (taxrow.ToValue * (decimal)taxrow.TaxPres / 100);
                                        value = (decimal)(value - taxrow.ToValue);
                                    }
                                    else
                                    {
                                        newrow.DrAmount = newrow.DrAmount ?? 0 +
                                                          (value * (decimal)taxrow.TaxPres / 100);
                                        value = 0;
                                    }
                                }
                            }
                        }

                        SelectedMainRow.DetailsList.Add(newrow);

                        Loading = false;
                    }
                };
                Glclient.GetIncomeStatmentDataCompleted += (s, sv) =>
                {
                    SelectedMainRow.DetailsList.Clear();
                    foreach (var variable in sv.DesignDetailList.OrderBy(x => x.RowOrder))
                    {
                        var vis       = Visibility.Collapsed;
                        var itemVis   = Visibility.Visible;
                        var doubleVis = Visibility.Collapsed;
                        if (variable.Type == "Double Seprator" || variable.Type == "Seprator")
                        {
                            if (variable.Type == "Seprator")
                            {
                                vis = Visibility.Visible;
                            }
                            if (variable.Type == "Double Seprator")
                            {
                                doubleVis = Visibility.Visible;
                            }
                            itemVis = Visibility.Collapsed;
                        }

                        var newrow = new TblIncomeStatmentDetailModel
                        {
                            Bold              = variable.Bold,
                            Description       = variable.Description,
                            RowOrder          = variable.RowOrder,
                            Type              = variable.Type,
                            IsSeparator       = vis,
                            IsItem            = itemVis,
                            IsDoubleSeparator = doubleVis,
                        };

                        if (variable.Type.StartsWith("Account"))
                        {
                            if (sv.Result != null)
                            {
                                var oldrow = sv.Result.FirstOrDefault(x => x.AccountPerRow.Ename == variable.Description);
                                if (oldrow != null)
                                {
                                    newrow.CrAmount   = oldrow.CrAmount;
                                    newrow.DrAmount   = oldrow.DrAmount;
                                    newrow.Accountemp = oldrow.AccountTemp;
                                }
                            }

                            if (variable.Type == "Account With Subs")
                            {
                                if (sv.Result != null)
                                {
                                    var oldrow = sv.Result.Where(x => SelectedMainRow.DetailsList.Select(w => w.Accountemp).Equals(x.AccountTemp)).ToList();

// ReSharper disable once InconsistentNaming
                                    foreach (var VARIABLE in oldrow)
                                    {
                                        var newrowaa = new TblIncomeStatmentDetailModel
                                        {
                                            Bold              = variable.Bold,
                                            Description       = variable.Description,
                                            RowOrder          = variable.RowOrder,
                                            Type              = variable.Type,
                                            IsSeparator       = vis,
                                            IsItem            = itemVis,
                                            IsDoubleSeparator = doubleVis,
                                            CrAmount          = VARIABLE.CrAmount,
                                            DrAmount          = VARIABLE.DrAmount
                                        };
                                        SelectedMainRow.DetailsList.Add(newrowaa);
                                    }
                                }
                            }
                        }
                        else if (variable.Type == "Total")
                        {
                            var crAmount =
                                SelectedMainRow.DetailsList.Where(x => x.Type != "Total" && x.Type != "Account With Subs" && x.RowOrder < variable.RowOrder)
                                .Sum(x => x.CrAmount);

                            var drAmount =
                                SelectedMainRow.DetailsList.Where(x => x.Type != "Total" && x.Type != "Account With Subs" && x.RowOrder < variable.RowOrder)
                                .Sum(x => x.DrAmount);

                            if (drAmount > crAmount)
                            {
                                newrow.DrAmount = drAmount - crAmount;
                            }
                            else
                            {
                                newrow.CrAmount = crAmount - drAmount;
                            }
                        }
                        else if (variable.Type == "Income Tax")
                        {
                            var oldrow = SelectedMainRow.DetailsList.FirstOrDefault(x => x.RowOrder == variable.RowOrder - 1);

                            if (oldrow != null)
                            {
                                var value = oldrow.CrAmount ?? 0;
                                newrow.DrAmount = 0;
                                foreach (var taxrow in sv.IncomeTax.OrderBy(w => w.Iserial))
                                {
                                    if (value >= taxrow.ToValue)
                                    {
                                        newrow.DrAmount = newrow.DrAmount + (taxrow.ToValue * (decimal)taxrow.TaxPres / 100);
                                        value           = (decimal)(value - taxrow.ToValue);
                                    }
                                    else
                                    {
                                        if (value >= taxrow.FromValue)
                                        {
                                            var taxvalue = (value * (decimal)taxrow.TaxPres / 100);
                                            newrow.DrAmount = newrow.DrAmount + taxvalue;
                                            value           = 0;

                                            //newrow.DrAmount = newrow.DrAmount ?? 0 + (taxrow.ToValue * (decimal)taxrow.TaxPres / 100);
                                            //value = (decimal)(value - taxrow.ToValue);
                                        }
                                    }
                                }
                            }
                        }

                        SelectedMainRow.DetailsList.Add(newrow);

                        Loading = false;
                    }
                };
            }
        }
コード例 #25
0
        public IncomeStatmentDesignViewModel()
        {
            if (!IsDesignTime)
            {
                GetItemPermissions(PermissionItemName.IncomeStatmentDesign.ToString());
                Glclient = new GlServiceClient();

                MainRowList            = new SortableCollectionView <TblIncomeStatmentDesignHeaderViewModel>();
                SelectedMainRow        = new TblIncomeStatmentDesignHeaderViewModel();
                JournalAccountTypeList = new ObservableCollection <GenericTable>();
                JournalAccountTypeList.Add(new GenericTable
                {
                    Code = "Label"
                });

                JournalAccountTypeList.Add(new GenericTable
                {
                    Code = "Account"
                });

                JournalAccountTypeList.Add(new GenericTable
                {
                    Code = "Account With Subs"
                });

                JournalAccountTypeList.Add(new GenericTable
                {
                    Code = "Cost Of Good Sold"
                });

                JournalAccountTypeList.Add(new GenericTable
                {
                    Code = "Income Tax"
                });
                JournalAccountTypeList.Add(new GenericTable
                {
                    Code = "Seprator"
                });

                JournalAccountTypeList.Add(new GenericTable
                {
                    Code = "Double Seprator"
                });
                JournalAccountTypeList.Add(new GenericTable
                {
                    Code = "Total"
                });

                Glclient.GetTblIncomeStatmentDesignHeaderCompleted += (s, sv) =>
                {
                    foreach (var row in sv.Result)
                    {
                        var newrow = new TblIncomeStatmentDesignHeaderViewModel();
                        newrow.InjectFrom(row);
                        MainRowList.Add(newrow);
                    }

                    Loading   = false;
                    FullCount = sv.fullCount;
                    if (MainRowList.Count == 1)
                    {
                        SelectedMainRow = MainRowList.FirstOrDefault();
                    }
                    if (FullCount == 0 && MainRowList.Count == 0)
                    {
                        AddNewMainRow(false);
                    }
                    if (Export)
                    {
                        Export      = false;
                        AllowExport = true;
                        //ExportGrid.ExportExcel("IncomeStatmentDesign");
                    }
                };

                Glclient.UpdateOrInsertTblIncomeStatmentDesignHeaderCompleted += (s, ev) =>
                {
                    if (ev.Error != null)
                    {
                        MessageBox.Show(ev.Error.Message);
                    }
                    try
                    {
                        MainRowList.ElementAt(ev.outindex).InjectFrom(ev.Result);
                    }
                    catch (Exception)
                    {
                    }
                    Loading = false;
                };
                Glclient.DeleteTblIncomeStatmentDesignHeaderCompleted += (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);
                    }
                    if (!MainRowList.Any())
                    {
                        AddNewMainRow(false);
                    }
                };

                Glclient.GetTblIncomeStatmentDesignDetailCompleted += (s, sv) =>
                {
                    foreach (var row in sv.Result)
                    {
                        var newrow = new TblIncomeStatmentDesignDetailViewModel();

                        newrow.InjectFrom(row);
                        if (row.Type.StartsWith("Account"))
                        {
                            newrow.Type          = row.Type;
                            newrow.AccountPerRow = new TblAccount {
                                Code = row.Description
                            };
                        }
                        SelectedMainRow.DetailsList.Add(newrow);
                    }
                    Loading         = false;
                    DetailFullCount = sv.fullCount;

                    if (SelectedMainRow.DetailsList.Count == 1)
                    {
                        SelectedDetailRow = SelectedMainRow.DetailsList.FirstOrDefault();
                    }

                    if (DetailFullCount == 0 && SelectedMainRow.DetailsList.Count == 0)
                    {
                        AddNewDetailRow(false);
                    }
                };

                Glclient.UpdateOrInsertIncomeStatmentDesignDetailCompleted += (s, x) =>
                {
                    var savedRow = (TblIncomeStatmentDesignDetailViewModel)SelectedMainRow.DetailsList.GetItemAt(x.outindex);
                    if (savedRow != null)
                    {
                        savedRow.InjectFrom(x.Result);
                    }
                    Loading = false;
                };

                Glclient.DeleteIncomeStatmentDesignDetailCompleted += (s, ev) =>
                {
                    if (ev.Error != null)
                    {
                        MessageBox.Show(ev.Error.Message);
                    }
                    Loading = false;
                    var oldrow = SelectedMainRow.DetailsList.FirstOrDefault(x => x.Iserial == ev.Result);
                    if (oldrow != null)
                    {
                        SelectedMainRow.DetailsList.Remove(oldrow);
                    }
                    if (!SelectedMainRow.DetailsList.Any())
                    {
                        AddNewDetailRow(false);
                    }
                };

                GetMaindata();
            }
        }
コード例 #26
0
ファイル: CostCenterViewModel.cs プロジェクト: Osama91/CCWFM
        public CostCenterViewModel()
        {
            if (!IsDesignTime)
            {
                GetItemPermissions(PermissionItemName.CostCenter.ToString());
                Glclient = new GlServiceClient();
                var costDimSetupTypeClient = new GlServiceClient();
                costDimSetupTypeClient.GetGenericCompleted += (s, sv) => { CostCenterTypeList = sv.Result; };
                costDimSetupTypeClient.GetGenericAsync("TblCostCenterType", "%%", "%%", "%%", "Iserial", "ASC", LoggedUserInfo.DatabasEname);
                MainRowList     = new SortableCollectionView <TblCostCenterViewModel>();
                SelectedMainRow = new TblCostCenterViewModel();

                Glclient.GetTblCostCenterCompleted += (s, sv) =>
                {
                    foreach (var row in sv.Result)
                    {
                        var newrow = new TblCostCenterViewModel();
                        newrow.InjectFrom(row);
                        newrow.CostCenterTypePerRow = new GenericTable();
                        if (row.TblCostCenterType1 != null)
                        {
                            newrow.CostCenterTypePerRow.InjectFrom(row.TblCostCenterType1);
                        }
                        newrow.CostCenterPerRow = row.TblCostCenter2;

                        MainRowList.Add(newrow);
                    }

                    Loading   = false;
                    FullCount = sv.fullCount;
                    if (MainRowList.Any() && (SelectedMainRow == null))
                    {
                        SelectedMainRow = MainRowList.FirstOrDefault();
                    }
                    if (FullCount == 0 && MainRowList.Count == 0)
                    {
                        AddNewMainRow(false);
                    }
                };

                Glclient.UpdateOrInsertTblCostCentersCompleted += (s, ev) =>
                {
                    if (ev.Error != null)
                    {
                        MessageBox.Show(ev.Error.Message);
                    }
                    try
                    {
                        MainRowList.ElementAt(ev.outindex).InjectFrom(ev.Result);
                    }
                    catch (Exception)
                    {
                    }
                    Loading = false;
                };
                Glclient.DeleteTblCostCenterCompleted += (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);
                    }
                    if (!MainRowList.Any())
                    {
                        AddNewMainRow(false);
                    }
                };

                GetMaindata();
            }
        }
コード例 #27
0
ファイル: GlGenEntityViewModel.cs プロジェクト: Osama91/CCWFM
        public GlGenEntityViewModel()
        {
            if (!IsDesignTime)
            {
                GetItemPermissions(PermissionItemName.GlGenEntity.ToString());
                Glclient = new GlServiceClient();

                Glclient.GetTblJournalAccountTypeCompleted += (s, sv) =>
                {
                    JournalAccountTypeList = sv.Result;
                };
                Glclient.GetTblJournalAccountTypeAsync(true, LoggedUserInfo.DatabasEname);

                MainRowList     = new SortableCollectionView <TblGlGenEntityGroupViewModel>();
                SelectedMainRow = new TblGlGenEntityGroupViewModel();

                Glclient.GetTblGlGenEntityGroupCompleted += (s, sv) =>
                {
                    foreach (var row in sv.Result)
                    {
                        var newrow = new TblGlGenEntityGroupViewModel();
                        newrow.InjectFrom(row);
                        MainRowList.Add(newrow);
                    }

                    Loading   = false;
                    FullCount = sv.fullCount;
                    if (MainRowList.Any() && (SelectedMainRow == null))
                    {
                        SelectedMainRow = MainRowList.FirstOrDefault();
                    }
                    if (FullCount == 0 && MainRowList.Count == 0)
                    {
                        AddNewMainRow(false);
                    }
                };

                Glclient.UpdateOrInsertTblGlGenEntityGroupCompleted += (s, ev) =>
                {
                    if (ev.Error != null)
                    {
                        MessageBox.Show(ev.Error.Message);
                    }
                    try
                    {
                        MainRowList.ElementAt(ev.outindex).InjectFrom(ev.Result);
                    }
                    catch (Exception)
                    {
                    }
                    Loading = false;
                };
                Glclient.DeleteTblGlGenEntityGroupCompleted += (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);
                    }
                    if (!MainRowList.Any())
                    {
                        AddNewMainRow(false);
                    }
                };

                Glclient.GetTblGlGenEntityCompleted += (s, sv) =>
                {
                    foreach (var row in sv.Result)
                    {
                        var newrow = new TblGlGenEntityViewModel();

                        newrow.InjectFrom(row);
                        SelectedMainRow.DetailsList.Add(newrow);
                    }

                    Loading         = false;
                    DetailFullCount = sv.fullCount;
                    if (SelectedMainRow.DetailsList.Any() && (SelectedDetailRow == null))
                    {
                        SelectedDetailRow = SelectedMainRow.DetailsList.FirstOrDefault();
                    }
                    if (DetailFullCount == 0 && SelectedMainRow.DetailsList.Count == 0)
                    {
                        AddNewDetailRow(false);
                    }
                };

                Glclient.UpdateOrInsertTblGlGenEntityCompleted += (s, ev) =>
                {
                    if (ev.Error != null)
                    {
                        MessageBox.Show(ev.Error.Message);
                    }
                    try
                    {
                        SelectedMainRow.DetailsList.ElementAt(ev.outindex).InjectFrom(ev.Result);
                    }
                    catch (Exception)
                    {
                    }
                };
                Glclient.DeleteTblGlGenEntityCompleted += (s, ev) =>
                {
                    if (ev.Error != null)
                    {
                        MessageBox.Show(ev.Error.Message);
                    }

                    var oldrow = SelectedMainRow.DetailsList.FirstOrDefault(x => x.Iserial == ev.Result);
                    if (oldrow != null)
                    {
                        SelectedMainRow.DetailsList.Remove(oldrow);
                    }
                    if (!SelectedMainRow.DetailsList.Any())
                    {
                        AddNewDetailRow(false);
                    }
                };
            }
        }
コード例 #28
0
        public BankViewModel()
        {
            if (!IsDesignTime)
            {
                GetItemPermissions(PermissionItemName.Bank.ToString());
                Glclient = new GlServiceClient();
                var currencyClient = new GlServiceClient();
                currencyClient.GetGenericCompleted += (s, sv) =>
                {
                    CurrencyList = sv.Result;
                };
                currencyClient.GetGenericAsync("TblCurrency", "%%", "%%", "%%", "Iserial", "ASC", LoggedUserInfo.DatabasEname);

                var BankAccountTypeClient = new GlServiceClient();
                BankAccountTypeClient.GetGenericCompleted += (s, sv) =>
                {
                    BankAccountTypeList = sv.Result;
                };
                BankAccountTypeClient.GetGenericAsync("TblBankAccountType", "%%", "%%", "%%", "Iserial", "ASC", LoggedUserInfo.DatabasEname);


                var bankClient = new GlServiceClient();
                bankClient.GetGenericCompleted += (s, sv) =>
                {
                    BankGroupList = sv.Result;
                };
                bankClient.GetGenericAsync("TblBankGroup", "%%", "%%", "%%", "Iserial", "ASC", LoggedUserInfo.DatabasEname);

                MainRowList     = new SortableCollectionView <TblBankViewModel>();
                SelectedMainRow = new TblBankViewModel();

                Glclient.GetTblBankChequeCompleted += (s, sv) =>
                {
                    foreach (var row in sv.Result)
                    {
                        var newrow = new TblBankChequeViewModel();
                        newrow.InjectFrom(row);

                        if (row.TblCurrency1 != null)
                        {
                            newrow.CurrencyPerRow.InjectFrom(row.TblCurrency1);
                        }

                        if (row.TblBank1 != null)
                        {
                            newrow.BankPerRow.InjectFrom(row.TblBank1);
                        }
                        if (row.TblJournalAccountType1 != null)
                        {
                            newrow.JournalAccountTypePerRow.InjectFrom(row.TblJournalAccountType1);
                        }
                        newrow.EntityPerRow =
                            sv.entityList.FirstOrDefault(x => x.TblJournalAccountType == row.TblJournalAccountType &&
                                                         x.Iserial == row.EntityAccount);
                        SelectedMainRow.DetailsList.Add(newrow);
                    }

                    Loading   = false;
                    FullCount = sv.fullCount;
                }
                ;
                Glclient.GetTblBankCompleted += (s, sv) =>
                {
                    foreach (var row in sv.Result)
                    {
                        var newrow = new TblBankViewModel();
                        newrow.CurrencyPerRow        = new GenericTable();
                        newrow.BankAccountTypePerRow = new GenericTable();
                        newrow.BankGroupPerRow       = new GenericTable();
                        newrow.InjectFrom(row);

                        if (row.TblCurrency1 != null)
                        {
                            newrow.CurrencyPerRow.InjectFrom(row.TblCurrency1);
                        }


                        if (row.TblBankAccountType1 != null)
                        {
                            newrow.BankAccountTypePerRow.InjectFrom(row.TblBankAccountType1);
                        }


                        if (row.TblBankGroup1 != null)
                        {
                            newrow.BankGroupPerRow.InjectFrom(row.TblBankGroup1);
                        }

                        MainRowList.Add(newrow);
                    }

                    Loading   = false;
                    FullCount = sv.fullCount;
                    if (MainRowList.Any() && (SelectedMainRow == null))
                    {
                        SelectedMainRow = MainRowList.FirstOrDefault();
                    }
                    if (FullCount == 0 && MainRowList.Count == 0)
                    {
                        AddNewMainRow(false);
                    }
                };

                Glclient.UpdateOrInsertTblBanksCompleted += (s, ev) =>
                {
                    if (ev.Error != null)
                    {
                        MessageBox.Show(ev.Error.Message);
                    }
                    try
                    {
                        MainRowList.ElementAt(ev.outindex).InjectFrom(ev.Result);
                    }
                    catch (Exception)
                    {
                    }
                    Loading = false;
                };
                Glclient.DeleteTblBankCompleted += (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);
                    }
                    if (!MainRowList.Any())
                    {
                        AddNewMainRow(false);
                    }
                };
                Glclient.CreateChequeCompleted        += (s, sv) => MessageBox.Show("Cheques Generated");
                Glclient.DeleteTblBankChequeCompleted += (s, sv) =>
                {
                    MessageBox.Show("Cheques Deleted");
                    SelectedMainRow.DetailsList.Clear();
                    GetDetailRow();
                };

                GetMaindata();
            }
        }
コード例 #29
0
ファイル: GeneralFilter.cs プロジェクト: Osama91/CCWFM
        public static void NavigatToMenu(string menuName, string title, string menuLink)
        {
            var child = new FrameChildWindow();

            if (menuName == PermissionItemName.SeasonCurrenciesForm.ToString())
            {
                child.LayoutRoot.Children.Add(new SeasonCurrencies());
            }
            if (menuName == PermissionItemName.PurchaseBudget.ToString())
            {
                child.LayoutRoot.Children.Add(new PurchaseBudget());
            }

            if (menuName == PermissionItemName.VariableTermManual.ToString())
            {
                child.LayoutRoot.Children.Add(new VariableTermManual());
            }
            if (menuName == PermissionItemName.DyeingPlanForm.ToString())
            {
                child.LayoutRoot.Children.Add(new DyeingPlan());
            }
            if (menuName == PermissionItemName.IncomeStatment.ToString())
            {
                child.LayoutRoot.Children.Add(new IncomeStatmentPrintPreview(new IncomeStatmentViewModel()));
            }

            if (menuName == PermissionItemName.FactoryEmpLeavingTransaction.ToString())
            {
                child.LayoutRoot.Children.Add(new BehalfFiltered());
            }

            if (menuName == PermissionItemName.GlGenEntity.ToString())
            {
                child.LayoutRoot.Children.Add(new GlGenEntity());
            }

            if (menuName == PermissionItemName.GeneratePurchase.ToString())
            {
                child.LayoutRoot.Children.Add(new GeneratePurchase());
            }
            if (menuName == PermissionItemName.EmpLeavingTransactionForm.ToString())
            {
                child.LayoutRoot.Children.Add(new EmpLeavingTransaction());
            }
            if (menuName == PermissionItemName.EmpLeavingTransactionForManagment.ToString())
            {
                child.LayoutRoot.Children.Add(new EmpLeavingTransactioForManagment());
            }
            if (menuName == PermissionItemName.SalesOrderRequestInvoice.ToString())
            {
                child.LayoutRoot.Children.Add(new SalesOrderRequestInvoice());
            }

            if (menuName == PermissionItemName.RouteCardInvoice.ToString())
            {
                child.LayoutRoot.Children.Add(new RouteCardInvoice());
            }

            if (menuName == PermissionItemName.EmpWeeklyDayOff.ToString())
            {
                child.LayoutRoot.Children.Add(new EmpWeeklyDayOff());
            }

            if (menuName == PermissionItemName.NewUserRequestForm.ToString())
            {
                child.LayoutRoot.Children.Add(new CreateNewUser());
            }
            if (menuName == PermissionItemName.ConfirmNewUserRequestForm.ToString())
            {
                child.LayoutRoot.Children.Add(new ConfirmNewUserRequest());
            }

            if (menuName == PermissionItemName.StyleFabricComposition.ToString())
            {
                child.LayoutRoot.Children.Add(new GenericForm("TblStyleFabricComposition", "", PermissionItemName.StyleFabricComposition));
            }

            if (menuName == PermissionItemName.BrandSectionMail.ToString())
            {
                child.LayoutRoot.Children.Add(new BrandSectionMail());
            }

            if (menuName == PermissionItemName.RecInvProd.ToString())
            {
                child.LayoutRoot.Children.Add(new RecInvProd());
            }
            if (menuName == PermissionItemName.PeriodLock.ToString())
            {
                child.LayoutRoot.Children.Add(new PeriodLock());
            }


            if (menuName == PermissionItemName.BrandSectionMailSample.ToString())
            {
                child.LayoutRoot.Children.Add(new BrandSectionMailSample());
            }

            if (menuName == PermissionItemName.StandardBomForm.ToString())
            {
                child.LayoutRoot.Children.Add(new StandardBom());
            }
            if (menuName == PermissionItemName.AttendanceFileReason.ToString())
            {
                child.LayoutRoot.Children.Add(new AttendanceFileReason());
            }

            if (menuName == PermissionItemName.RouteCoding.ToString())
            {
                child.LayoutRoot.Children.Add(new RouteCoding());
            }
            if (menuName == PermissionItemName.FingerPrintTransaction.ToString())
            {
                child.LayoutRoot.Children.Add(new FingerPrintTransaction());
            }
            if (menuName == PermissionItemName.TransferMsg.ToString())
            {
                child.LayoutRoot.Children.Add(new TransferMsg());
            }
            if (menuName == PermissionItemName.AssetsStatus.ToString())
            {
                child.LayoutRoot.Children.Add(new GenericForm("TblAssetsStatus", "", PermissionItemName.AssetsStatus));
            }

            if (menuName == PermissionItemName.Reservation.ToString())
            {
                child.LayoutRoot.Children.Add(new Reservation());
            }

            if (menuName == PermissionItemName.DyeingPlanAccForm.ToString())
            {
                child.LayoutRoot.Children.Add(new DyeingPlanAcc());
            }

            if (menuName == PermissionItemName.GlobalRetailBusinessBudget.ToString())
            {
                child.LayoutRoot.Children.Add(new GlobalBudget(1));//RetailBudget
            }

            if (menuName == PermissionItemName.GlobalCCBusinessBudget.ToString())
            {
                child.LayoutRoot.Children.Add(new GlobalBudget(2));//CCBudget
            }

            if (menuName == PermissionItemName.CCBrandBudget.ToString())
            {
                child.LayoutRoot.Children.Add(new BrandBudget(2));//CCBudget
            }

            if (menuName == PermissionItemName.ClosingAdvanceVendorPayment.ToString())
            {
                child.LayoutRoot.Children.Add(new ClosingAdvanceVendorPayment());//CCBudget
            }


            if (menuName == PermissionItemName.AssetsType.ToString())
            {
                child.LayoutRoot.Children.Add(new GenericForm("TblAssetsType", "", PermissionItemName.AssetsType));
            }
            if (menuName == PermissionItemName.AssetsTransaction.ToString())
            {
                child.LayoutRoot.Children.Add(new AssetsTransaction());
            }
            if (menuName == PermissionItemName.VariableTermManualFactory.ToString())
            {
                child.LayoutRoot.Children.Add(new VariableTermManualFactory());
            }


            if (menuName == PermissionItemName.Depreciation.ToString())
            {
                child.LayoutRoot.Children.Add(new Depreciation());
            }
            if (menuName == PermissionItemName.ShopReqHeader.ToString())
            {
                child.LayoutRoot.Children.Add(new ShopReqHeader());
            }

            if (menuName == PermissionItemName.Processor.ToString())
            {
                child.LayoutRoot.Children.Add(new GenericForm("TblProcessor", "", PermissionItemName.Processor));
            }
            if (menuName == PermissionItemName.HardDisk.ToString())
            {
                child.LayoutRoot.Children.Add(new GenericForm("TblHardDisk", "", PermissionItemName.HardDisk));
            }
            if (menuName == PermissionItemName.Memory.ToString())
            {
                child.LayoutRoot.Children.Add(new GenericForm("TblMemory", "", PermissionItemName.Memory));
            }

            if (menuName == PermissionItemName.AssetsForm.ToString())
            {
                child.LayoutRoot.Children.Add(new Assets());
            }

            if (menuName == PermissionItemName.FixAtt.ToString())
            {
                //child.LayoutRoot.Children.Add(new SalaryTerms());
                child.LayoutRoot.Children.Add(new FixAtt());
            }


            if (menuName == PermissionItemName.DyeingOrderInvoice.ToString())
            {
                child.LayoutRoot.Children.Add(new DyeingOrderInvoice());
            }


            if (menuName == PermissionItemName.Gps.ToString())
            {
                const string url         = "http://192.168.1.23:251/home/users";
                var          absoluteUri = new Uri(url, UriKind.Absolute);
                System.Windows.Browser.HtmlPage.Window.Navigate(absoluteUri, "_blank");
                return;
            }
            if (menuName == PermissionItemName.MissionTracker.ToString())
            {
                const string url         = "http://192.168.1.23:251/home/MissionTracking";
                var          absoluteUri = new Uri(url, UriKind.Absolute);
                System.Windows.Browser.HtmlPage.Window.Navigate(absoluteUri, "_blank");
                return;
            }

            if (menuName == PermissionItemName.StyleCategory.ToString())
            {
                child.LayoutRoot.Children.Add(
                    new GenericForm
                        ("TblStyleCategory"

                        , PermissionItemName.StyleCategory
                        ));
            }
            if (menuName == PermissionItemName.BrandSectionPermissionForm.ToString())
            {
                child.LayoutRoot.Children.Add(new BrandSectionPermission(Convert.ToInt32(LoggedUserInfo.Iserial)));
            }
            else if (menuName == PermissionItemName.RouteCardForm.ToString())
            {
                child.LayoutRoot.Children.Add(new RouteCard());
            }
            else if (menuName == PermissionItemName.FabricInspectionForm.ToString())
            {
                child.LayoutRoot.Children.Add(new FabricDefects());
            }
            else if (menuName == PermissionItemName.BankDepositApproval.ToString())
            {
                child.LayoutRoot.Children.Add(new BankDepositApproval());
            }

            else if (menuName == PermissionItemName.MarkerDetailsForm.ToString())
            {
                child.LayoutRoot.Children.Add(new MarkersView());
            }
            else if (menuName == PermissionItemName.SizesForm.ToString())
            {
                child.LayoutRoot.Children.Add(new SizeGroup());
            }
            else if (menuName == PermissionItemName.ColorsForm.ToString())
            {
                child.LayoutRoot.Children.Add(new Color());
            }
            else if (menuName == PermissionItemName.TransferForm.ToString())
            {
                child.LayoutRoot.Children.Add(new TransferView(true));
            }
            else if (menuName == PermissionItemName.TransferTo.ToString())
            {
                child.LayoutRoot.Children.Add(new TransferView(false));
            }
            else if (menuName == PermissionItemName.Adjustment.ToString())
            {
                child.LayoutRoot.Children.Add(new AdjustmentView(false));
            }
            else if (menuName == PermissionItemName.OpeningBalance.ToString())
            {
                child.LayoutRoot.Children.Add(new AdjustmentView(true));
            }
            //Commented To Work On Stitch
            //else if (menuName == PermissionItemName.Contracts.ToString())
            //{
            //    child.LayoutRoot.Children.Add(new ContractView());
            //}
            else if (menuName == PermissionItemName.BankStatement.ToString())
            {
                child.LayoutRoot.Children.Add(new BankStatementView());
            }
            else if (menuName == PermissionItemName.CashDeposit.ToString())
            {
                child.LayoutRoot.Children.Add(new CashDepositView());
            }
            else if (menuName == PermissionItemName.FabricDesignsForm.ToString())
            {
                child.LayoutRoot.Children.Add(
                    new GenericForm
                        ("Tbl_lkp_FabricDesignes"
                        , ""
                        , PermissionItemName.FabricDesignsForm
                        )
                    );
            }
            else if (menuName == PermissionItemName.FabricFinishesForm.ToString())
            {
                child.LayoutRoot.Children.Add(
                    new GenericForm
                        ("tbl_lkp_FabricFinish"
                        , ""
                        , PermissionItemName.FabricFinishesForm
                        )
                    );
            }
            else if (menuName == PermissionItemName.FabricMaterialsForm.ToString())
            {
                child.LayoutRoot.Children.Add(
                    new GenericForm
                        ("Tbl_lkp_FabricMaterials"
                        , ""
                        , PermissionItemName.FabricMaterialsForm
                        )
                    );
            }

            else if (menuName == PermissionItemName.FabricStructuresForm.ToString())
            {
                child.LayoutRoot.Children.Add(new FabricStructure());
            }
            else if (menuName == PermissionItemName.FabricTypesForm.ToString())
            {
                child.LayoutRoot.Children.Add(
                    new GenericForm
                        ("Tbl_lkp_FabricTypes"
                        , ""
                        , PermissionItemName.FabricTypesForm
                        )
                    );
            }
            else if (menuName == PermissionItemName.YarnCountsForm.ToString())
            {
                child.LayoutRoot.Children.Add(
                    new GenericForm
                        ("tbl_lkp_YarnCount"
                        , ""
                        , PermissionItemName.YarnCountsForm
                        )
                    );
            }

            else if (menuName == PermissionItemName.YarnFinishesForm.ToString())
            {
                child.LayoutRoot.Children.Add(
                    new GenericForm
                        ("tbl_lkp_YarnFinish"
                        , ""
                        , PermissionItemName.YarnFinishesForm
                        )
                    );
            }
            else if (menuName == PermissionItemName.ContentsForm.ToString())
            {
                child.LayoutRoot.Children.Add(
                    new GenericForm
                        ("Tbl_lkp_Contents"
                        , ""
                        , PermissionItemName.ContentsForm
                        )
                    );
            }
            else if (menuName == PermissionItemName.GaugesForm.ToString())
            {
                child.LayoutRoot.Children.Add(
                    new GenericForm
                        ("Tbl_lkp_Gauges"
                        , ""
                        , PermissionItemName.GaugesForm
                        )
                    );
            }
            else if (menuName == PermissionItemName.StatusesForm.ToString())
            {
                child.LayoutRoot.Children.Add(
                    new GenericForm
                        ("Tbl_lkp_Status"
                        , ""
                        , PermissionItemName.StatusesForm
                        )
                    );
            }
            else if (menuName == PermissionItemName.UoMsForm.ToString())
            {
                child.LayoutRoot.Children.Add(
                    new GenericForm
                        ("Tbl_lkp_UoM"
                        , ""
                        , PermissionItemName.UoMsForm
                        )
                    );
            }
            else if (menuName == PermissionItemName.ThreadNumbersForm.ToString())
            {
                child.LayoutRoot.Children.Add(
                    new GenericForm
                        ("Tbl_lkp_ThreadNumbers"
                        , ""
                        , PermissionItemName.ThreadNumbersForm
                        )
                    );
            }
            else if (menuName == PermissionItemName.BarCodeSettingsForm.ToString())
            {
                child.LayoutRoot.Children.Add(new DisplayingBarcodeSetup());
            }
            else if (menuName == PermissionItemName.DefectsForm.ToString())
            {
                child.LayoutRoot.Children.Add(
                    new GenericForm
                        ("tbl_WF_Defects", ""
                        , PermissionItemName.DefectsForm)
                    );
            }
            else if (menuName == PermissionItemName.FabSetupForm.ToString())
            {
                child.LayoutRoot.Children.Add(new FabricSetups());
            }

            else if (menuName == PermissionItemName.FabSetupWFForm.ToString())
            {
                child.LayoutRoot.Children.Add(new FabricSetupsWF());
            }
            else if (menuName == PermissionItemName.YarnSourcesForm.ToString())
            {
                child.LayoutRoot.Children.Add(
                    new GenericForm
                        ("tbl_lkp_YarnSource"
                        , ""
                        , PermissionItemName.YarnSourcesForm
                        )
                    );
            }
            else if (menuName == PermissionItemName.Currencies.ToString())
            {
                child.LayoutRoot.Children.Add(
                    new GenericForm
                        ("tbl_lkp_Currency"
                        , ""
                        , PermissionItemName.Currencies
                        )
                    );
            }
            else if (menuName == PermissionItemName.CostTypes.ToString())
            {
                child.LayoutRoot.Children.Add(
                    new GenericForm
                        ("tbl_lkp_CostTypes"
                        , ""
                        , PermissionItemName.CostTypes
                        )
                    );
            }

            else if (menuName == PermissionItemName.CostCenter.ToString())
            {
                child.LayoutRoot.Children.Add(new CostCenter());
            }
            else if (menuName == PermissionItemName.ShopArea.ToString())
            {
                child.LayoutRoot.Children.Add(new ShopArea());
            }

            else if (menuName == PermissionItemName.CostDimSetup.ToString())
            {
                child.LayoutRoot.Children.Add(new CostDimSetup());
            }
            else if (menuName == PermissionItemName.UserJobsForm.ToString())
            {
                child.LayoutRoot.Children.Add(new UserJobs());
            }
            else if (menuName == PermissionItemName.UserBrandsForm.ToString())
            {
                child.LayoutRoot.Children.Add(new UserBrands());
            }
            else if (menuName == PermissionItemName.PermissionsForm.ToString())
            {
                child.LayoutRoot.Children.Add(new PermissionsAdminPage());
            }
            else if (menuName == PermissionItemName.SupplierFabric.ToString())
            {
                child.LayoutRoot.Children.Add(new SupplierFabric());
            }
            else if (menuName == PermissionItemName.StyleStatus.ToString())
            {
                child.LayoutRoot.Children.Add(new StyleStatus());
            }
            else if (menuName == PermissionItemName.FamilyForm.ToString())
            {
                child.LayoutRoot.Children.Add(new Family());
            }

            else if (menuName == PermissionItemName.ProductionOrder.ToString())
            {
                child.LayoutRoot.Children.Add(new ProductionOrder());
            }


            else if (menuName == PermissionItemName.PurchaseOrderRequest.ToString())
            {
                child.LayoutRoot.Children.Add(new PurchaseOrderRequest());
            }
            else if (menuName == PermissionItemName.SalesOrderRequest.ToString())
            {
                child.LayoutRoot.Children.Add(new SalesOrderRequest());
            }

            else if (menuName == PermissionItemName.GlExpensis.ToString())
            {
                child.LayoutRoot.Children.Add(new GlExpensis());
            }

            else if (menuName == PermissionItemName.SeasonForm.ToString())
            {
                child.LayoutRoot.Children.Add(new Season());
            }
            else if (menuName == PermissionItemName.DirectionForm.ToString())
            {
                child.LayoutRoot.Children.Add(

                    new GenericForm
                        ("TblLkpDirection"
                        , ""
                        , PermissionItemName.DirectionForm
                        )
                    );
            }
            else if (menuName == PermissionItemName.BrandSectionForm.ToString())
            {
                child.LayoutRoot.Children.Add(
                    new GenericForm
                        ("TblLkpBrandSection"
                        , PermissionItemName.BrandSection
                        ));
            }
            else if (menuName == PermissionItemName.ColorGroupForm.ToString())
            {
                child.LayoutRoot.Children.Add(new GenericForm
                                                  ("TblLkpColorGroup"
                                                  , ""
                                                  , PermissionItemName.ColorGroupForm
                                                  ));
            }
            else if (menuName == PermissionItemName.CheckListGroup.ToString())
            {
                child.LayoutRoot.Children.Add(new GenericForm
                                                  ("TblCheckListGroup"
                                                  , ""
                                                  , PermissionItemName.CheckListGroup
                                                  ));
            }

            else if (menuName == PermissionItemName.CheckListDesignGroupHeader1.ToString())
            {
                child.LayoutRoot.Children.Add(new GenericForm
                                                  ("TblCheckListDesignGroupHeader1"
                                                  , ""
                                                  , PermissionItemName.CheckListDesignGroupHeader1
                                                  ));
            }
            else if (menuName == PermissionItemName.CheckListDesignGroupHeader2.ToString())
            {
                child.LayoutRoot.Children.Add(new GenericForm
                                                  ("TblCheckListDesignGroupHeader2"
                                                  , ""
                                                  , PermissionItemName.CheckListDesignGroupHeader2
                                                  ));
            }
            else if (menuName == PermissionItemName.CheckListItem.ToString())
            {
                child.LayoutRoot.Children.Add(new GenericForm
                                                  ("TblCheckListItem"
                                                  , ""
                                                  , PermissionItemName.CheckListItem
                                                  ));
            }
            else if (menuName == PermissionItemName.CheckListLink.ToString())
            {
                child.LayoutRoot.Children.Add(new CheckListLink());
            }

            else if (menuName == PermissionItemName.CheckListTransaction.ToString())
            {
                child.LayoutRoot.Children.Add(new CheckListTransaction());
            }
            else if (menuName == PermissionItemName.ColorCodeForm.ToString())
            {
                //if (LoggedUserInfo.Iserial==5)
                //{
                //    child.LayoutRoot.Children.Add(new IntegrationPage());
                //}
                //else
                //{
                child.LayoutRoot.Children.Add(new Color());
                //}
            }
            else if (menuName == PermissionItemName.ColorLinkForm.ToString())
            {
                child.LayoutRoot.Children.Add(new ColorLink());
            }
            else if (menuName == PermissionItemName.FamilyLinkForm.ToString())
            {
                child.LayoutRoot.Children.Add(new FamilyCategoryLink());

                //  child.LayoutRoot.Children.Add(new FamilyLink());
            }
            else if (menuName == PermissionItemName.DirectionLinkForm.ToString())
            {
                child.LayoutRoot.Children.Add(new DirectionLink());
            }
            else if (menuName == PermissionItemName.DesignForm.ToString())
            {
                child.LayoutRoot.Children.Add(
                    new GenericForm
                        ("Tbl_lkp_FabricDesignes"
                        , ""
                        , PermissionItemName.DesignForm
                        )
                    );
            }
            else if (menuName == PermissionItemName.ColorThemesForm.ToString())
            {
                child.LayoutRoot.Children.Add(new SalesOrderColorTheme());
            }
            else if (menuName == PermissionItemName.FactoryDelivery.ToString())
            {
                child.LayoutRoot.Children.Add(new FactoryDelivery());
            }

            else if (menuName == PermissionItemName.StyleCodingForm.ToString())
            {
                child.LayoutRoot.Children.Add(new StyleHeader(SalesOrderType.SalesOrderPo, true));
            }
            else if (menuName == PermissionItemName.ServiceCodingForm.ToString())
            {
                child.LayoutRoot.Children.Add(new ServiceCoding());
            }
            else if (menuName == PermissionItemName.fabImgs.ToString())
            {
                child.LayoutRoot.Children.Add(new FabricImageGallary());
            }
            else if (menuName == PermissionItemName.FactoryGroupForm.ToString())
            {
                child.LayoutRoot.Children.Add(
                    new GenericForm
                        ("TblFactoryGroup"
                        , ""
                        , PermissionItemName.FactoryGroupForm)
                    );
            }
            else if (menuName == PermissionItemName.SubContractor.ToString())
            {
                child.LayoutRoot.Children.Add(
                    new GenericForm
                        ("TblSubContractor"
                        , ""
                        , PermissionItemName.SubContractor)
                    );
            }
            else if (menuName == PermissionItemName.AccessoriesCodingForm.ToString())
            {
                child.LayoutRoot.Children.Add(new AccessorySetups());
            }
            else if (menuName == PermissionItemName.AccessoriesGroupForm.ToString())
            {
                child.LayoutRoot.Children.Add(new AccessoryGroup());
            }

            else if (menuName == PermissionItemName.AccessoriesSizeGroupForm.ToString())
            {
                child.LayoutRoot.Children.Add(new AccSizeGroup());
            }
            else if (menuName == PermissionItemName.Documentation.ToString())
            {
                child.LayoutRoot.Children.Add(new DocumentationFiles());
            }

            else if (menuName == PermissionItemName.IssueJournalForm.ToString())
            {
                child.LayoutRoot.Children.Add(new IssueJournal());
            }
            else if (menuName == PermissionItemName.RetailPoForm.ToString())
            {
                child.LayoutRoot.Children.Add(new StyleHeader(SalesOrderType.RetailPo, false));
            }
            else if (menuName == PermissionItemName.CCPoForm.ToString())
            {
                child.LayoutRoot.Children.Add(new StyleHeader(SalesOrderType.SalesOrderPo, false));
            }
            else if (menuName == PermissionItemName.CCPoForm.ToString())
            {
                child.LayoutRoot.Children.Add(new StyleHeader(SalesOrderType.AdvancedSampleRequest, false));
            }

            else if (menuName == PermissionItemName.ProductionInvoice.ToString())
            {
                child.LayoutRoot.Children.Add(new ProductionInvoice());
            }
            else if (menuName == PermissionItemName.TradeAgreementFabricView.ToString())
            {
                child.LayoutRoot.Children.Add(new TradeAgreementFabricView());
            }
            else if (menuName == PermissionItemName.PaymentScheduleSettingsForm.ToString())
            {
                child.LayoutRoot.Children.Add(new PaymentScheduleSetting());
            }
            else if (menuName == PermissionItemName.PaymentScheduleForm.ToString())
            {
                child.LayoutRoot.Children.Add(new PaymentSchedule());
            }
            else if (menuName == PermissionItemName.BankDepositForm.ToString())
            {
                child.LayoutRoot.Children.Add(new BankDeposit());
            }
            else if (menuName == PermissionItemName.EmployeeShiftForm.ToString())
            {
                child.LayoutRoot.Children.Add(new EmployeeShift());
            }
            else if (menuName == PermissionItemName.EmployeeBehalfForm.ToString())
            {
                child.LayoutRoot.Children.Add(new EmployeeBehalf());
            }

            else if (menuName == PermissionItemName.ExcuseRulesForm.ToString())
            {
                child.LayoutRoot.Children.Add(new ExcuseRules());
            }
            else if (menuName == PermissionItemName.EmployeeInfoForm.ToString())
            {
                child.LayoutRoot.Children.Add(new EmployeeInfo());
            }

            else if (menuName == PermissionItemName.PromotionForm.ToString())
            {
                child.LayoutRoot.Children.Add(new PromotionViewModel());
            }
            else if (menuName == PermissionItemName.BrandStoreTarget.ToString())
            {
                child.LayoutRoot.Children.Add(new BrandStoreTarget());
            }
            else if (menuName == PermissionItemName.BrandStoreTargetForManagement.ToString())
            {
                child.LayoutRoot.Children.Add(new BrandStoreTargetManagment());
            }

            else if (menuName == PermissionItemName.CheckListMail.ToString())
            {
                child.LayoutRoot.Children.Add(new CheckListMail());
            }

            else if (menuName == PermissionItemName.BrandBudget.ToString())
            {
                child.LayoutRoot.Children.Add(new BrandBudget(1));
            }
            else if (menuName == PermissionItemName.CurrencyDailyExchangeForm.ToString())
            {
                child.LayoutRoot.Children.Add(new CurrencyDailyExchange());
            }
            else if (menuName == PermissionItemName.Bank.ToString())
            {
                child.LayoutRoot.Children.Add(new Bank());
            }
            else if (menuName == PermissionItemName.JournalSetting.ToString())
            {
                child.LayoutRoot.Children.Add(new JournalSetting());
            }

            else if (menuName == PermissionItemName.StoreCommission.ToString())
            {
                child.LayoutRoot.Children.Add(new StoreCommissionView());
            }
            else if (menuName == PermissionItemName.StoreVisaMachine.ToString())
            {
                child.LayoutRoot.Children.Add(new StoreVisaMachineView());
            }
            else if (menuName == PermissionItemName.Asset.ToString())
            {
                child.LayoutRoot.Children.Add(new Asset());
            }
            else if (menuName == PermissionItemName.GlPosting.ToString())
            {
                child.ImgClose.Visibility = Visibility.Collapsed;

                child.LayoutRoot.Children.Add(new GlPosting());
            }
            else if (menuName == PermissionItemName.BankGroup.ToString())
            {
                child.LayoutRoot.Children.Add((new GenericFormGl
                                                   ("TblBankGroup"
                                                   , ""
                                                   , PermissionItemName.BankGroup
                                                   )));
            }
            else if (menuName == PermissionItemName.AssetGroup.ToString())
            {
                child.LayoutRoot.Children.Add(new AssetGroup());
            }
            else if (menuName == PermissionItemName.CostCenterType.ToString())
            {
                child.LayoutRoot.Children.Add(new GenericFormGl
                                                  ("TblCostCenterType"
                                                  , ""
                                                  , PermissionItemName.CostCenterType
                                                  ));
            }

            else if (menuName == PermissionItemName.BankTransactionType.ToString())
            {
                child.LayoutRoot.Children.Add(new BankTransactionType());
            }
            else if (menuName == PermissionItemName.BankTransactionTypeGroup.ToString())
            {
                child.LayoutRoot.Children.Add(new GenericFormGl
                                                  ("TblBankTransactionTypeGroup"
                                                  , ""
                                                  , PermissionItemName.BankTransactionTypeGroup
                                                  ));
            }

            else if (menuName == PermissionItemName.CostCenterOption.ToString())
            {
                child.LayoutRoot.Children.Add(new GenericFormGl
                                                  ("TblCostCenterOption"
                                                  , ""
                                                  , PermissionItemName.CostCenterOption
                                                  ));
            }

            else if (menuName == PermissionItemName.ExpensesGroup.ToString())
            {
                child.LayoutRoot.Children.Add(new GenericFormGl
                                                  ("TblExpensisGroup"
                                                  , ""
                                                  , PermissionItemName.CostCenterOption
                                                  ));
            }
            else if (menuName == PermissionItemName.Expenses.ToString())
            {
                //   child.LayoutRoot.Children.Add(new Journal());
            }
            else if (menuName == PermissionItemName.Journal.ToString())
            {
                child.LayoutRoot.Children.Add(new Journal());
            }
            else if (menuName == PermissionItemName.Sequence.ToString())
            {
                child.LayoutRoot.Children.Add(new Sequence());
            }

            else if (menuName == PermissionItemName.CashdepositeTypeForm.ToString())
            {
                child.LayoutRoot.Children.Add(new CashDepositeType());
            }
            else if (menuName == PermissionItemName.VisaMachineForm.ToString())
            {
                child.LayoutRoot.Children.Add(new VisaMachine());
            }
            else if (menuName == PermissionItemName.CalliopeDaliySales.ToString())
            {
                child.LayoutRoot.Children.Add(new StoreDailySales());
            }
            else if (menuName == PermissionItemName.Account.ToString())
            {
                child.LayoutRoot.Children.Add(new Account());
            }
            else if (menuName == PermissionItemName.LedgerHeader.ToString())
            {
                child.LayoutRoot.Children.Add(new Ledger());
            }

            else if (menuName == PermissionItemName.PositionRoute.ToString())
            {
                child.LayoutRoot.Children.Add(new PositionRoute());
            }


            else if (menuName == PermissionItemName.PeriodsGl.ToString())
            {
                child.LayoutRoot.Children.Add(new PeriodsGl());
            }
            else if (menuName == PermissionItemName.PostingProfile.ToString())
            {
                child.LayoutRoot.Children.Add(new PostingProfile());
            }
            else if (menuName == PermissionItemName.RecInv.ToString())
            {
                child.LayoutRoot.Children.Add(new RecInv());
            }

            else if (menuName == PermissionItemName.Markup.ToString())
            {
                child.LayoutRoot.Children.Add(new Markup());
            }

            else if (menuName == PermissionItemName.MarkupGroup.ToString())
            {
                child.LayoutRoot.Children.Add(new MarkupGroup());
            }

            else if (menuName == PermissionItemName.InventPosting.ToString())
            {
                child.LayoutRoot.Children.Add(new InventPosting());
            }
            else if (menuName == PermissionItemName.SalaryApproval.ToString())
            {
                child.LayoutRoot.Children.Add(new SalaryApproval());
            }



            else if (menuName == PermissionItemName.GlRule.ToString())
            {
                child.LayoutRoot.Children.Add(new GlRule());
            }
            else if (menuName == PermissionItemName.GlRuleJob.ToString())
            {
                child.LayoutRoot.Children.Add(new GlRuleJob());
            }

            else if (menuName == PermissionItemName.CostAllocationMethod.ToString())
            {
                child.LayoutRoot.Children.Add(new CostAllocationMethod());
            }
            else if (menuName == PermissionItemName.MethodOfPayment.ToString())
            {
                child.LayoutRoot.Children.Add(new MethodOfPayment());
            }
            else if (menuName == PermissionItemName.IncomeStatmentDesign.ToString())
            {
                child.LayoutRoot.Children.Add(new IncomeStatmentDesign());
            }

            else if (menuName == PermissionItemName.IncomeStatmentDesign.ToString())
            {
                child.LayoutRoot.Children.Add(new IncomeStatmentDesign());
            }
            else if (menuName == PermissionItemName.CostCenterRouteGroup.ToString())
            {
                child.LayoutRoot.Children.Add(new CostCenterRouteGroup());
            }
            else if (menuName == PermissionItemName.CostCenterOrganizationUnit.ToString())
            {
                child.LayoutRoot.Children.Add(new CostCenterOrganizationUnit());
            }

            if (!string.IsNullOrWhiteSpace(menuLink) && menuName.StartsWith(PermissionItemName.GlCashTransaction.ToString()))
            {
                var client = new GlServiceClient();
                client.GetTblCashTypeSettingsAsync(menuLink, LoggedUserInfo.DatabasEname);
                client.GetTblCashTypeSettingsCompleted += (s, sv) =>
                {
                    child.LayoutRoot.Children.Add(new GlCashTransaction(sv.Result, sv.entityList));
                    if (LoggedUserInfo.CurrLang == 0)
                    {
                        child.FlowDirection = FlowDirection.RightToLeft;
                    }
                    else
                    {
                        child.FlowDirection = FlowDirection.LeftToRight;
                    }
                    child.Title = title;
                    child.Show();
                };

                return;
            }

            if (!string.IsNullOrWhiteSpace(menuLink))
            {
                var client = new GlServiceClient();
                client.GetTblChequeTypeSettingsAsync(menuLink, LoggedUserInfo.DatabasEname);
                client.GetTblChequeTypeSettingsCompleted += (s, sv) =>
                {
                    child.LayoutRoot.Children.Add(new GlChequeTransaction(sv.Result, sv.entityList));
                    if (LoggedUserInfo.CurrLang == 0)
                    {
                        child.FlowDirection = FlowDirection.RightToLeft;
                    }
                    else
                    {
                        child.FlowDirection = FlowDirection.LeftToRight;
                    }
                    child.Title = title;
                    child.Show();
                };

                return;
            }
            if (LoggedUserInfo.CurrLang == 0)
            {
                child.FlowDirection = FlowDirection.RightToLeft;
            }
            else
            {
                child.FlowDirection = FlowDirection.LeftToRight;
            }
            if (menuName == PermissionItemName.BrandSectionFamily.ToString())
            {
                child.LayoutRoot.Children.Add(new BrandSectionFamily());
            }
            child.Title = title;
            child.Show();
        }
コード例 #30
0
        public InventPostingViewModel()
        {
            if (!IsDesignTime)
            {
                GetItemPermissions(PermissionItemName.InventPosting.ToString());
                Glclient        = new GlServiceClient();
                MainRowList     = new SortableCollectionView <TblInventPostingViewModel>();
                SelectedMainRow = new TblInventPostingViewModel();
                Glclient.GetGlItemGroupAsync(LoggedUserInfo.DatabasEname);
                Glclient.GetGlItemGroupCompleted += (s, sv) =>
                {
                    ItemGroupList = sv.Result;
                };
                Glclient.GetTblInventPostingTypeAsync(LoggedUserInfo.DatabasEname);
                Glclient.GetTblInventPostingTypeCompleted += (s, sv) =>
                {
                    InventPostingTypeList = sv.Result;
                    Items = new ObservableCollection <TblInventAccountType>(InventPostingTypeList.Where(x => x.TabName == "SalesOrder"));
                };
                Glclient.GetTblInventPostingCompleted += (s, sv) =>
                {
                    foreach (var row in sv.Result)
                    {
                        var newrow = new TblInventPostingViewModel
                        {
                            AccountPerRow   = row.TblAccount1,
                            ItemGroupPerRow = ItemGroupList.FirstOrDefault(x => x.Iserial == row.ItemScopeRelation)
                        };
                        newrow.InjectFrom(row);
                        newrow.JournalAccountTypePerRow = JournalAccountTypePerRow;
                        if (sv.entityList != null && sv.entityList.Any(x => x.scope == row.SupCustScope && x.Iserial == row.SupCustRelation))
                        {
                            newrow.EntityAccountPerRow =
                                sv.entityList.First(x => x.scope == row.SupCustScope && x.Iserial == row.SupCustRelation);
                        }

                        MainRowList.Add(newrow);
                    }

                    Loading = false;

                    if (MainRowList.Any() && (SelectedMainRow == null))
                    {
                        SelectedMainRow = MainRowList.FirstOrDefault();
                    }
                    if (MainRowList.Count == 0)
                    {
                        AddNewMainRow(false);
                    }
                };

                Glclient.UpdateOrInsertTblInventPostingsCompleted += (s, ev) =>
                {
                    if (ev.Error != null)
                    {
                        MessageBox.Show(ev.Error.Message);
                    }
                    try
                    {
                        MainRowList.ElementAt(ev.outindex).InjectFrom(ev.Result);
                    }
// ReSharper disable once EmptyGeneralCatchClause
                    catch
                    {
                    }
                };
                Glclient.DeleteTblInventPostingCompleted += (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);
                    }
                    if (!MainRowList.Any())
                    {
                        AddNewMainRow(false);
                    }
                };
            }
        }