public dynamic DisplayVoucherData() { using (AccountingEntity context = new AccountingEntity()) { var results = from v in context.Vouchers join em in context.Employees on v.AuthenticationBy equals em.Emp_ID join accDebit in context.Accounts on v.Debit equals accDebit.Code join accCredit in context.Accounts on v.Credit equals accCredit.Code select new { voucherNo = v.VNo, Debit = accDebit.Name, Amount = v.Amount, Credit = accCredit.Name, Date = v.VDate, Narration = v.Narration, Authentication = em.FName //State = r.StateNavigationProperty.StateLabel, //If FK //State = _context.State.First(state => state.StateId == r.StateId), //If Not FK //HostAddress = r.ServerReference.Value.HostAddress, //TimeStamp = r.TimeStamp }; var resultToList = results.ToList(); return(resultToList); } }
public void Run(IHR1Context db, AccountingEntity accountingEntity) { var amtInput = new JournalTemplateInput() { AppTenantID = accountingEntity.AppTenantID, Name = "Salary", UserInputType = db.UserInputTypes.First(x => x.Code == "CURRENCY") }; var template = new JournalTemplate(); template.AppTenantID = accountingEntity.AppTenantID; template.JournalType = db.JournalTypes.First(x => x.Code == "PAYSTUB"); template.Name = "Salary"; template.OriginKey = "EmploymentContract"; template.UserInputs.Add(amtInput); var templateTxn = new JournalTemplateTxn(); templateTxn.AppTenantID = accountingEntity.AppTenantID; templateTxn.AmountInput = amtInput; templateTxn.Description = "Salary"; templateTxn.JournalTxnType = template.JournalType.JournalTxnTypes.First(x => x.IsCode == "AMT"); template.JournalTemplateTxns.Add(templateTxn); accountingEntity.JournalTemplates.Add(template); }
public static DataTable TransactionTable(int x) { int code = x; using (AccountingEntity c = new AccountingEntity()) { List <Account> usepurposes = c.Accounts.ToList(); Account account = new Account(); DataTable dt = new DataTable(); dt.Columns.Add("id"); dt.Columns.Add("name"); var query = from ac in c.Accounts where ac.Code == code select ac.Type; int type = query.FirstOrDefault(); //var queryToList = query.ToList(); //int type= Convert.ToInt32( query); foreach (Account usepurpose in usepurposes) { if (usepurpose.Type != type) { dt.Rows.Add(usepurpose.Code, usepurpose.Name); } } return(dt); } }
public int returnVoucherNo() { using (AccountingEntity context = new AccountingEntity()) { int id = context.Vouchers.Max(r => r.VNo); return(id + 1); } }
public void AccountDataEntry() { using (AccountingEntity context = new AccountingEntity()) { int i = 4; context.Accounts.Add(new Account { Code = 110000 + i, Name = "BANK ACCOUNT", Type = 3 }); i = i + 2; context.Accounts.Add(new Account { Code = 110000 + i, Name = "ADVERTISEMENT AND PUBLICITY EXP", Type = 1 }); i = i + 2; context.Accounts.Add(new Account { Code = 110000 + i, Name = "GENERAL EXPENSES", Type = 1 }); i = i + 2; context.Accounts.Add(new Account { Code = 110000 + i, Name = "REPAIR & MAINTENANCE EXPENSES ACCOUNT", Type = 1 }); i = i + 2; context.Accounts.Add(new Account { Code = 110000 + i, Name = "MISCELLANEOUS EXPENSES", Type = 1 }); i = i + 2; context.Accounts.Add(new Account { Code = 110000 + i, Name = "SALARY ACCOUNT", Type = 2 }); i = i + 2; context.Accounts.Add(new Account { Code = 110000 + i, Name = "WAGES ACCOUNT", Type = 1 }); i = i + 2; context.Accounts.Add(new Account { Code = 110000 + i, Name = "INCOME TAX ACCOUNT", Type = 4 }); i = i + 2; context.Accounts.Add(new Account { Code = 110000 + i, Name = "RENT ACCOUNT", Type = 1 }); i = i + 2; context.Accounts.Add(new Account { Code = 110000 + i, Name = "PURCHASE ACCOUNT", Type = 1 }); i = i + 2; context.Accounts.Add(new Account { Code = 110000 + i, Name = "LOANS TO STAFF", Type = 4 }); i = i + 2; context.Accounts.Add(new Account { Code = 110000 + i, Name = "FURNITURE ACCOUNT", Type = 3 }); context.SaveChanges(); } }
public void UpdateIntoVoucher(int VoucherNo, int paidBy, int transactionType, int amount, string narration, DateTime date, string employeeID) { using (AccountingEntity context = new AccountingEntity()) { Voucher voucher = context.Vouchers.FirstOrDefault(r => r.VNo == VoucherNo); voucher.Debit = transactionType; voucher.Credit = paidBy; voucher.Amount = amount; voucher.Narration = narration; voucher.VDate = DateTime.Now; voucher.AuthenticationBy = employeeID; context.SaveChanges(); } }
public async Task <IHttpActionResult> Register(RegisterRequest model) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } //using (TransactionScope scope = new TransactionScope()) { IHR1Context db = AppCore.IoC.Container.Resolve <IHR1Context>(); try { AppTenant tenant = new AppTenant(); tenant.Name = model.CompanyName; var user = new AppUser() { UserName = model.Email, Email = model.Email, AppTenant = tenant }; IdentityResult result = await UserManager.CreateAsync(user, model.Password); if (!result.Succeeded) { //scope.Dispose(); return(GetErrorResult(result)); } var tenantParty = new Party() { AppTenantID = tenant.ID, Name = model.CompanyName, PartyType = "C" }; var tentantEntity = new AccountingEntity() { AppTenantID = tenant.ID, Party = tenantParty }; db.AccountingEntities.Add(tentantEntity); await db.SaveChangesAsync(); //scope.Complete(); } catch (Exception ex) { //scope.Dispose(); throw ex; } } return(Ok()); }
public static DataTable EmployeeTable() { using (AccountingEntity c = new AccountingEntity()) { List <Employee> usepurposes = c.Employees.ToList(); DataTable dt = new DataTable(); dt.Columns.Add("Emp_ID"); dt.Columns.Add("First Name"); foreach (Employee usepurpose in usepurposes) { dt.Rows.Add(usepurpose.Emp_ID, usepurpose.FName); } return(dt); } }
public static DataTable AccountTable() { using (AccountingEntity c = new AccountingEntity()) { List <Account> usepurposes = c.Accounts.ToList(); DataTable dt = new DataTable(); dt.Columns.Add("id"); dt.Columns.Add("name"); foreach (Account usepurpose in usepurposes) { // if (usepurpose.Type==4) dt.Rows.Add(usepurpose.Code, usepurpose.Name); } return(dt); } }
public void InsertIntoVoucher(int paidBy, int transactionType, int amount, string narration, DateTime date, string employeeID) { using (AccountingEntity context = new AccountingEntity()) { Voucher voucher = new Voucher { Debit = paidBy, Credit = transactionType, Amount = amount, Narration = narration, VDate = date, AuthenticationBy = employeeID, PreparedBy = "A001" }; context.Vouchers.Add(voucher); // MessageBox.Show(voucher.AuthenticationBy.ToString()); context.SaveChanges(); } }
public void OnChangeAccountingEntity(AccountingEntity entity, UpdateOperations operations) { InterceptChange(entity, operations); }
public async Task <IHttpActionResult> Register(RegisterRequest model) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } //using (TransactionScope scope = new TransactionScope()) { IS1Context db = AppCore.IoC.Container.Resolve <IS1Context>(); try { string roleId = _identityContext.GetRoleIdByCode("CM"); AppTenant tenant = new AppTenant(); tenant.Name = model.PropertyName; var user = new AppUser() { UserName = model.Email, Email = model.Email }; user.AppTenantUsers.Add(new AppTenantUser() { AppRoleID = roleId, AppTenant = tenant }); IdentityResult result = await UserManager.CreateAsync(user, model.Password); if (!result.Succeeded) { //scope.Dispose(); return(GetErrorResult(result)); } var region = (_appContext as IS1Context).Regions.Single(x => x.Code == "BC"); //temp var tenantParty = new Party() { AppTenantID = tenant.ID, Name = model.PropertyName, PartyType = "C" }; var tentantEntity = new AccountingEntity() { AppTenantID = tenant.ID, Party = tenantParty, Region = region }; db.AccountingEntities.Add(tentantEntity); await db.SaveChangesAsync(); //scope.Complete(); } catch (Exception ex) { //scope.Dispose(); throw ex; } } return(Ok()); }