コード例 #1
0
ファイル: frmNubeAccount.xaml.cs プロジェクト: Youvaniga/ABDC
        void WritePayment(DALNewNUBE.FundMaster fm)
        {
            WriteLog("Start to store the Payment");
            try
            {
                var l1 = lstPayment.Where(x => x.Fund == fm.FundName && x.PaymentDate >= new DateTime(2016, 4, 1)).ToList();
                pbrPayment.Maximum = l1.Count();
                pbrPayment.Value   = 0;
                foreach (var p in l1)
                {
                    try
                    {
                        DALNewNUBE.Payment pm = new DALNewNUBE.Payment()
                        {
                            LedgerId    = GetLedgerId(p.Ledger.LedgerName),
                            Amount      = Convert.ToDecimal(p.PayAmount),
                            ChequeDate  = p.chequeDate,
                            ChequeNo    = p.ChequeNo,
                            ClearDate   = p.ClearDate,
                            VoucherNo   = p.VoucherNo,
                            EntryNo     = Payment_NewRefNo(p.PaymentDate.Value),
                            ExtraCharge = Convert.ToDecimal(p.ExtraCharge),
                            Particulars = p.Narration,
                            PaymentDate = p.PaymentDate.Value,
                            PaymentMode = p.PaymentMode,
                            PayTo       = p.PayTo,
                            Status      = p.Status,
                            RefNo       = p.RefNo,
                            RefCode     = p.PaymentId.ToString()
                        };

                        foreach (var pd in p.PaymentDetails)
                        {
                            DALNewNUBE.PaymentDetail pmd = new DALNewNUBE.PaymentDetail()
                            {
                                LedgerId   = GetLedgerId(pd.Ledger.LedgerName),
                                Amount     = Convert.ToDecimal(pd.Amount),
                                Particular = pd.Narration,
                            };
                            pm.PaymentDetails.Add(pmd);
                        }

                        lstPaymentNew.Add(pm);

                        WriteLog(string.Format("Stored Payment => Date : {0}, Entry No : {1}, Voucher No : {2}", pm.PaymentDate, pm.EntryNo, pm.VoucherNo));
                        pbrPayment.Value += 1;
                    }
                    catch (Exception ex)
                    {
                        WriteLog(string.Format("Error on Stored Payment => Date : {0}, Entry No : {1}, Voucher No : {2}, Error : {3}", p.PaymentDate, p.EntryNo, p.VoucherNo, ex.Message));
                    }
                }
            }
            catch (Exception ex)
            {
                WriteLog(string.Format("Error on Payment: {0}", ex.Message));
            }
            WriteLog("End to Store the Payment");
        }
コード例 #2
0
ファイル: frmNubeAccount.xaml.cs プロジェクト: Youvaniga/ABDC
        void WriteLogData(DALNewNUBE.FundMaster fm)
        {
            var ua  = fm.UserTypes.FirstOrDefault().UserAccounts.FirstOrDefault();
            var ua1 = new DALNewNUBE.FundMaster()
            {
                Id = fm.Id, FundName = fm.FundName, IsActive = fm.IsActive
            };

            var cf  = fm.CustomFormats.FirstOrDefault();
            var cf1 = new DALNewNUBE.CustomFormat()
            {
                Id = cf.Id, CurrencyCaseSensitive = cf.CurrencyCaseSensitive, CurrencyNegativeSymbolPrefix = cf.CurrencyNegativeSymbolPrefix, CurrencyNegativeSymbolSuffix = cf.CurrencyNegativeSymbolSuffix, CurrencyPositiveSymbolPrefix = cf.CurrencyPositiveSymbolPrefix, CurrencyPositiveSymbolSuffix = cf.CurrencyPositiveSymbolSuffix, CurrencyToWordPrefix = cf.CurrencyToWordPrefix, CurrencyToWordSuffix = cf.CurrencyToWordSuffix, DecimalSymbol = cf.DecimalSymbol, DecimalToWordPrefix = cf.DecimalToWordPrefix, DecimalToWordSuffix = cf.DecimalToWordSuffix, DigitGroupingBy = cf.DigitGroupingBy, DigitGroupingSymbol = cf.DigitGroupingSymbol, FundMasterId = cf.FundMasterId, IsDisplayWithOnlyOnSuffix = cf.IsDisplayWithOnlyOnSuffix, NoOfDigitAfterDecimal = cf.NoOfDigitAfterDecimal
            };

            var ut  = fm.UserTypes.FirstOrDefault();
            var ut1 = new DALNewNUBE.UserType()
            {
                Id = ut.Id, FundMasterId = ut.FundMasterId, TypeOfUser = ut.TypeOfUser, Description = ut.Description
            };

            foreach (var utd in ut.UserTypeDetails)
            {
                ut1.UserTypeDetails.Add(new DALNewNUBE.UserTypeDetail()
                {
                    Id = utd.Id, UserTypeId = utd.UserTypeId, UserTypeFormDetailId = utd.UserTypeFormDetailId, IsViewForm = utd.IsViewForm, AllowInsert = utd.AllowInsert, AllowUpdate = utd.AllowUpdate, AllowDelete = utd.AllowDelete
                });
            }

            var acym  = fm.ACYearMasters.FirstOrDefault();
            var acym1 = new DALNewNUBE.ACYearMaster()
            {
                Id = acym.Id, ACYear = acym.ACYear, ACYearStatusId = acym.ACYearStatusId, FundMasterId = acym.FundMasterId
            };

            foreach (var acymlb in acym.ACYearLedgerBalances)
            {
                acym1.ACYearLedgerBalances.Add(new DALNewNUBE.ACYearLedgerBalance()
                {
                    Id = acymlb.Id, ACYearMasterId = acym.Id, LedgerId = acymlb.LedgerId, DrAmt = acymlb.DrAmt, CrAmt = acymlb.CrAmt
                });
            }

            var fm1 = new DALNewNUBE.FundMaster()
            {
                Id = fm.Id, FundName = fm.FundName, IsActive = fm.IsActive
            };

            LogDetailStore(fm1, ua.Id);
            LogDetailStore(cf1, ua.Id);
            LogDetailStore(ut1, ua.Id);
            LogDetailStore(ua1, ua.Id);
            var x1 = dbNew.SaveChanges();

            WriteLog("Log Data Finished of Master");
            LogDetailStore(acym1, ua.Id);
            var x2 = dbNew.SaveChanges();

            WriteLog("Log Data Finished of AccountYearMaster");
            foreach (var ag in fm.AccountGroups)
            {
                LogDetailStore(new DALNewNUBE.AccountGroup()
                {
                    Id = ag.Id, FundMasterId = fm.Id, GroupCode = ag.GroupCode, UnderGroupId = ag.UnderGroupId, GroupName = ag.GroupName
                }, ua.Id);
            }

            var x3 = dbNew.SaveChanges();

            WriteLog("Log Data Finished of AccountGroup");
            foreach (var ld in lstLedgerNew)
            {
                LogDetailStore(new DALNewNUBE.Ledger()
                {
                    Id = ld.Id, AccountGroupId = ld.AccountGroupId, LedgerCode = ld.LedgerCode, LedgerName = ld.LedgerName
                }, ua.Id);
            }
            var n0 = dbNew.SaveChanges();

            WriteLog("Log Data Finished of Ledger");
            int i = 0;

            foreach (var p in lstPaymentNew)
            {
                var p1 = new DALNewNUBE.Payment()
                {
                    Id = p.Id, Amount = p.Amount, ChequeDate = p.ChequeDate, ChequeNo = p.ChequeNo, ClearDate = p.ClearDate, EntryNo = p.EntryNo, ExtraCharge = p.ExtraCharge, LedgerId = p.LedgerId, Particulars = p.Particulars, PaymentDate = p.PaymentDate, PaymentMode = p.PaymentMode, PayTo = p.PayTo, RefCode = p.RefCode, RefNo = p.RefNo, Status = p.Status, VoucherNo = p.VoucherNo
                };
                foreach (var pd in p.PaymentDetails)
                {
                    p1.PaymentDetails.Add(new DALNewNUBE.PaymentDetail()
                    {
                        Id = pd.Id, Amount = pd.Amount, LedgerId = pd.LedgerId, Particular = pd.Particular, PaymentId = pd.PaymentId
                    });
                }

                LogDetailStore(p1, ua.Id);
                if (i++ % 1000 == 0)
                {
                    dbNew.SaveChanges();
                }
            }
            var n1 = dbNew.SaveChanges();

            WriteLog("Log Data Finished of Payment");
            foreach (var r in lstReceiptNew)
            {
                var r1 = new DALNewNUBE.Receipt()
                {
                    Id = r.Id, Amount = r.Amount, ChequeDate = r.ChequeDate, ChequeNo = r.ChequeNo, CleareDate = r.CleareDate, EntryNo = r.EntryNo, Extracharge = r.Extracharge, LedgerId = r.LedgerId, Particulars = r.Particulars, ReceiptDate = r.ReceiptDate, ReceiptMode = r.ReceiptMode, ReceivedFrom = r.ReceivedFrom, RefCode = r.RefCode, RefNo = r.RefNo, Status = r.Status, VoucherNo = r.VoucherNo
                };
                foreach (var rd in r.ReceiptDetails)
                {
                    r1.ReceiptDetails.Add(new DALNewNUBE.ReceiptDetail()
                    {
                        Id = rd.Id, Amount = rd.Amount, LedgerId = rd.LedgerId, Particulars = rd.Particulars, ReceiptId = rd.ReceiptId
                    });
                }
                LogDetailStore(r1, ua.Id);

                if (i++ % 1000 == 0)
                {
                    dbNew.SaveChanges();
                }
            }
            var n2 = dbNew.SaveChanges();

            WriteLog("Log Data Finished of Receipt");
            foreach (var j in lstJournalNew)
            {
                var j1 = new DALNewNUBE.Journal()
                {
                    Id = j.Id, Amount = j.Amount, EntryNo = j.EntryNo, HQNo = j.HQNo, JournalDate = j.JournalDate, Particular = j.Particular, RefCode = j.RefCode, Status = j.Status, VoucherNo = j.VoucherNo
                };
                foreach (var jd in j.JournalDetails)
                {
                    j1.JournalDetails.Add(new DALNewNUBE.JournalDetail()
                    {
                        Id = jd.Id, CrAmt = jd.CrAmt, DrAmt = jd.DrAmt, JournalId = jd.JournalId, LedgerId = jd.LedgerId, Particulars = jd.Particulars
                    });
                }
                LogDetailStore(j1, ua.Id);
                if (i++ % 1000 == 0)
                {
                    dbNew.SaveChanges();
                }
            }

            var n3 = dbNew.SaveChanges();

            WriteLog("Log Data Finished of Journal");
        }