Beispiel #1
0
        void WriteJournal(DALNewNUBE.FundMaster cm)
        {
            WriteLog("Start to store the Journal");
            try
            {
                var l1 = lstJournal.Where(x => x.Fund == cm.FundName && x.JournalDate >= new DateTime(2016, 4, 1)).ToList();
                pbrJournal.Maximum = l1.Count();
                pbrJournal.Value   = 0;
                foreach (var j in l1)
                {
                    try
                    {
                        DALNewNUBE.Journal jm = new DALNewNUBE.Journal()
                        {
                            VoucherNo   = j.VoucherNo,
                            EntryNo     = Journal_NewRefNo(j.JournalDate.Value),
                            HQNo        = j.HQNo,
                            JournalDate = j.JournalDate.Value,
                            Status      = j.Status,
                            RefCode     = j.JournalId.ToString()
                        };

                        foreach (var jd in j.JournalDetails)
                        {
                            DALNewNUBE.JournalDetail pmd = new DALNewNUBE.JournalDetail()
                            {
                                LedgerId    = GetLedgerId(jd.Ledger.LedgerName),
                                CrAmt       = Convert.ToDecimal(jd.CrAmt),
                                DrAmt       = Convert.ToDecimal(jd.DrAmt),
                                Particulars = jd.Narration,
                            };
                            jm.JournalDetails.Add(pmd);
                        }

                        lstJournalNew.Add(jm);

                        WriteLog(string.Format("Stored Journal => Date : {0}, Entry No : {1}, Voucher No : {2}", jm.JournalDate, jm.EntryNo, jm.VoucherNo));
                        pbrJournal.Value += 1;
                    }
                    catch (Exception ex)
                    {
                        WriteLog(string.Format("Error Stored Journal => Date : {0}, Entry No : {1}, Voucher No : {2}, Error : {3}", j.JournalDate, j.EntryNo, j.VoucherNo, ex.Message));
                    }
                }
            }
            catch (Exception ex)
            {
                WriteLog(string.Format("Error on Journal: {0}", ex.Message));
            }

            WriteLog("End to Store the Journal");
        }
Beispiel #2
0
        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");
        }