public int FundMaster_Save(BLL.FundMaster fm) { try { DAL.FundMaster d = DB.FundMasters.Where(x => x.Id == fm.Id).FirstOrDefault(); if (d == null) { d = new DAL.FundMaster(); DB.FundMasters.Add(d); fm.IsActive = true; fm.toCopy <DAL.FundMaster>(d); DateTime dt = DateTime.Now; DAL.ACYearMaster acym = new DAL.ACYearMaster() { ACYear = dt.Month > 3 ? string.Format("{0} - {1}", dt.Year, dt.Year + 1) : string.Format("{0} - {1}", dt.Year - 1, dt.Year), ACYearStatusId = (int)AppLib.ACYearStatus.Open }; d.ACYearMasters.Add(acym); DB.SaveChanges(); fm.Id = d.Id; if (d.Id != 0) { FundSetup(fm); CurrencySetup(fm); } } else { fm.toCopy <DAL.FundMaster>(d); DB.SaveChanges(); } Clients.Clients(OtherLoginClientsOnGroup).FundMaster_Save(fm); return(fm.Id); } catch (Exception ex) { } return(0); }
private void CurrencySetup(BLL.FundMaster cm) { DAL.CustomFormat cf = new DAL.CustomFormat(); cf.FundMasterId = cm.Id; cf.CurrencyPositiveSymbolPrefix = "RM"; cf.CurrencyPositiveSymbolSuffix = "RM"; cf.CurrencyNegativeSymbolPrefix = "RM"; cf.CurrencyNegativeSymbolSuffix = "RM"; cf.CurrencyToWordPrefix = "Ringgit"; cf.CurrencyToWordSuffix = "Ringgit"; cf.DecimalToWordPrefix = "Cent"; cf.DecimalToWordSuffix = "Cent"; cf.DigitGroupingBy = 2; cf.CurrencyCaseSensitive = 2; cf.DecimalSymbol = "."; cf.DigitGroupingSymbol = ","; cf.IsDisplayWithOnlyOnSuffix = true; cf.NoOfDigitAfterDecimal = 2; DB.CustomFormats.Add(cf); DB.SaveChanges(); }
void AccountSetup(BLL.FundMaster cmp) { DAL.AccountGroup pr = new DAL.AccountGroup(); pr.GroupName = BLL.DataKeyValue.Primary_Key; pr.GroupCode = string.Empty; pr.FundMasterId = cmp.Id; DB.AccountGroups.Add(pr); DB.SaveChanges(); SetDataKeyValue(cmp.Id, pr.GroupName, pr.Id); AccountSetup_Asset(pr); AccountSetup_Liabilities(pr); AccountSetup_Income(pr); AccountSetup_Expense(pr); DAL.Ledger PL = new DAL.Ledger(); PL.LedgerName = BLL.DataKeyValue.Profit_Loss_Ledger_Key; PL.AccountGroupId = pr.Id; DB.Ledgers.Add(PL); DB.SaveChanges(); SetDataKeyValue(pr.FundMasterId, PL.LedgerName, PL.Id); }
private void FundSetup(BLL.FundMaster fm) { UserSetup(fm); //AccountSetup(fm); }