public BILL_Product GetProductPrice(Double priceProduct) { using (SUPERPEntities context = new SUPERPEntities(false)) { return(context.BILL_Product.Include("BILL_Vat").Include("BILL_Category").SingleOrDefault(p => p.Price == priceProduct)); } }
public COMPTA_AccountingEntries_Periodicity GetAccountingEntriesPeriodicityById(long id) { using (SUPERPEntities context = new SUPERPEntities(false)) { return(context.COMPTA_AccountingEntries_Periodicity.Include("COMPTA_Periodicity").Include("COMPTA_AccountingEntries").FirstOrDefault(x => x.COMPTA_AccountingEntries.id == id)); } }
public BILL_Product GetProductByName(string nameProduct) { using (SUPERPEntities context = new SUPERPEntities(false)) { return(context.BILL_Product.Include("BILL_Vat").Include("BILL_Category").SingleOrDefault(p => p.Name == nameProduct)); } }
public IEnumerable <BILL_Product> GetProductCategory(long idCategory) { using (SUPERPEntities context = new SUPERPEntities(false)) { return(context.BILL_Product.Include("BILL_Vat").Include("BILL_Category").Where(p => p.Category_Id == idCategory)); } }
public BILL_Product GetProductByID(long id) { using (SUPERPEntities context = new SUPERPEntities(false)) { return(context.BILL_Product.Include("BILL_Vat").Include("BILL_Category").SingleOrDefault(p => p.Product_Id == id)); } }
public List <BILL_Product> GetProducts() { using (SUPERPEntities context = new SUPERPEntities(false)) { return(context.BILL_Product.Include("BILL_Vat").Include("BILL_Category").Where(p => p.Name != null).ToList()); } }
public List <BILL_Product> GetBillProduct() { using (SUPERPEntities context = new SUPERPEntities(false)) { return(context.BILL_Product.Include("BILL_Vat").Include("BILL_Category").ToList()); } }
public IEnumerable <COMPTA_AccountingEntries_Periodicity> GetAccountingEntriesPeriodicity( ) { using (SUPERPEntities context = new SUPERPEntities(false)) { return(context.COMPTA_AccountingEntries_Periodicity.Include("COMPTA_Periodicity").Include("COMPTA_AccountingEntries").ToList()); } }
public COMPTA_ExchangeRate GetLastExchangeRate() { using (SUPERPEntities context = new SUPERPEntities(false)) { return(context.COMPTA_ExchangeRate.OrderByDescending(x => x.updatedDate).FirstOrDefault()); } }
public List <BILL_BillQuotationStatus> GetBillQuotationStatusByBillQuotation(long billQuotation_id) { using (SUPERPEntities context = new SUPERPEntities(false)) { return(context.BILL_BillQuotationStatus.Where(bqs => bqs.BillQuotation_Id == billQuotation_id).ToList()); } }
public static string getMaxNum() { var numStr = "000000001"; try { using (SUPERPEntities context = new SUPERPEntities(false)) { var num = Convert.ToInt32(numStr); var billQuotation = context.BILL_BillQuotation.OrderByDescending(b => b.NBill); if (billQuotation != null && billQuotation.Count() > 0) { var nbill = billQuotation.First().NBill; if (nbill != null) { var intNum = Convert.ToInt32(nbill) + 1; numStr = intNum.ToString(); } } while (numStr.Length < 9) { numStr = "0" + numStr; } } } catch (Exception ex) { throw; } return(numStr); }
public List <BILL_Transmitter> GetBillTrans() { using (SUPERPEntities context = new SUPERPEntities(false)) { return(context.BILL_Transmitter.ToList()); } }
public User EditUser(User userToEdit) { if (userToEdit == null) { return(null); } using (SUPERPEntities context = new SUPERPEntities(false)) { var u = context.Users.Find(userToEdit.Id); if (u == null) { return(null); } u.Address = userToEdit.Address; u.Email = userToEdit.Email; u.Firstname = userToEdit.Firstname; u.Lastname = userToEdit.Lastname; if (userToEdit.Role != null) { u.Role = context.Roles.Find(userToEdit.Role.Id); u.Role_id = u.Role.Id; } u.Zip_code = userToEdit.Zip_code; u.City = userToEdit.City; context.SaveChanges(); return(u); } }
public IEnumerable <Module> GetModules() { using (SUPERPEntities context = new SUPERPEntities(false)) { return(context.Modules.Include("RoleModules").Include("RoleModules.Module").Include("RoleModules.Role").ToList()); } }
public IEnumerable <COMPTA_CustomerJournalLine> GetCustomerJournalLines() { using (SUPERPEntities context = new SUPERPEntities(false)) { return(context.COMPTA_CustomerJournalLine); } }
public Role CreateRole(Role roleToAdd) { if (roleToAdd == null) { return(null); } using (SUPERPEntities context = new SUPERPEntities(false)) { var r = context.Roles.Add(new Role() { Label = roleToAdd.Label, Users = new List <User>(), RoleModules = new List <RoleModule>() }); context.SaveChanges(); foreach (RoleModule rm in roleToAdd.RoleModules) { context.RoleModules.Add(new RoleModule() { Role_id = r.Id, Module_id = rm.Module_id }); } context.SaveChanges(); return(r); } }
public IEnumerable <COMPTA_Currency> GetCurrencies() { using (SUPERPEntities context = new SUPERPEntities(false)) { return(context.COMPTA_Currency.Include("COMPTA_BankAccount")); } }
public IEnumerable <COMPTA_BankJournalLine> GetBankJournalLines() { using (SUPERPEntities context = new SUPERPEntities(false)) { return(context.COMPTA_BankJournalLine.Include("COMPTA_BankAccount")); } }
private void CalculateTTC() { var htRef = 0.00; var context = new SUPERPEntities(); var lstLine = context.BILL_LineBillQuotation.Where(l => l.BillQuotation_Id == BillQuotation_Id); foreach (var line in lstLine) { var tvaRate = (line.BILL_Product.BILL_Vat.Rate == null) ? 0.00 : Convert.ToDouble(line.BILL_Product.BILL_Vat.Rate); double priceProductTTC = (tvaRate * line.BILL_Product.Price) + line.BILL_Product.Price; htRef += line.BILL_Product.Price * line.Quantite; AmountTTC += priceProductTTC * line.Quantite; } /* Check if amountHT is valid */ if (htRef != AmountDF) { var b = context.BILL_BillQuotation.Find(BillQuotation_Id); b.AmountDF = htRef; context.SaveChanges(); } /* Check if VAT is affected */ if (!Vat) { AmountTTC = AmountDF; } }
public List <BILL_Status> GetStatus() { using (SUPERPEntities context = new SUPERPEntities(false)) { return(context.BILL_Status.ToList()); } }
public List <BILL_Status> GetStatusChain(long status_id) { using (SUPERPEntities context = new SUPERPEntities(false)) { var res = context.BILL_StatusChain.Include("BILL_Status").Include("BILL_Status1").Where(s => s.Status_Id == status_id).Select(s => s.BILL_Status1).ToList(); return(res); } }
public IEnumerable <COMPTA_ClassOfAccounts> GetAccountingClasses() { using (SUPERPEntities context = new SUPERPEntities(false)) { return(context.COMPTA_ClassOfAccounts .Include("COMPTA_ChartOfAccounts").ToList()); } }
public IEnumerable <BILL_Product> productsIncludedInBill(long billquotation_id) { using (SUPERPEntities context = new SUPERPEntities(false)) { return(context.BILL_LineBillQuotation.Include("BILL_Product").Include("BILL_Product.BILL_Vat") .Include("BILL_Product.BILL_Category") .Where(line => line.BillQuotation_Id == billquotation_id).Select(l => l.BILL_Product)); } }
public IEnumerable <BILL_LineBillQuotation> GetLineBillQuotation(long billQuotation_id) { using (SUPERPEntities context = new SUPERPEntities(false)) { return(context.BILL_LineBillQuotation.Include("BILL_Product").Include("BILL_Product.BILL_Vat") .Include("BILL_Product.BILL_Category") .Where(line => line.BillQuotation_Id == billQuotation_id).ToList()); } }
public COMPTA_CustomerJournalLine CreateCustomerJournalLine(COMPTA_CustomerJournalLine customerJournalLineToAdd) { using (SUPERPEntities context = new SUPERPEntities(false)) { var customerJournalLine = context.COMPTA_CustomerJournalLine.Add(customerJournalLineToAdd); context.SaveChanges(); return(customerJournalLine); } }
public COMPTA_AccountingEntries CreateAccountingEntry(COMPTA_AccountingEntries accountingEntryToAdd) { using (SUPERPEntities context = new SUPERPEntities(false)) { var accountingEntry = context.COMPTA_AccountingEntries.Add(accountingEntryToAdd); context.SaveChanges(); return(accountingEntry); } }
public List <COMPTA_AccountingEntries> GetAccountingEntriesTop1() { using (SUPERPEntities context = new SUPERPEntities(false)) { return(context.COMPTA_AccountingEntries .Include("COMPTA_AccountingEntries_Periodicity") .Include("COMPTA_ChartOfAccounts").ToList()); } }
public COMPTA_SupplierJournalLine CreateSupplierJournalLine(COMPTA_SupplierJournalLine supplierJournalLineToAdd) { using (SUPERPEntities context = new SUPERPEntities(false)) { var supplierJournalLine = context.COMPTA_SupplierJournalLine.Add(supplierJournalLineToAdd); context.SaveChanges(); return(supplierJournalLine); } }
public BILL_BillQuotation CreateBillQutotation(BILL_BillQuotation billQuotationToAdd) { using (SUPERPEntities context = new SUPERPEntities(false)) { var b = context.BILL_BillQuotation.Add(billQuotationToAdd); context.SaveChanges(); return(b); } }
public COMPTA_BankJournalLine CreateBankJournalLine(COMPTA_BankJournalLine bankJournalLineToAdd) { using (SUPERPEntities context = new SUPERPEntities(false)) { var bankJournalLine = context.COMPTA_BankJournalLine.Add(bankJournalLineToAdd); context.SaveChanges(); return(bankJournalLine); } }