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); } }
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 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 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 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_Transmitter> GetBillTrans() { using (SUPERPEntities context = new SUPERPEntities(false)) { return context.BILL_Transmitter.ToList(); } }
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 List<BILL_Product> GetBillProduct() { using (SUPERPEntities context = new SUPERPEntities(false)) { return context.BILL_Product.Include("BILL_Vat").Include("BILL_Category").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 COMPTA_ClassOfAccounts CreateAccountingClass(COMPTA_ClassOfAccounts accountingClassToAdd) { using(SUPERPEntities context = new SUPERPEntities(false)) { var accountingClass = context.COMPTA_ClassOfAccounts.Add(accountingClassToAdd); context.SaveChanges(); return accountingClass; } }
public COMPTA_ChartOfAccounts CreateAccountingAccount(COMPTA_ChartOfAccounts accountingAccountToAdd) { using(SUPERPEntities context = new SUPERPEntities(false)) { var accountingAccount = context.COMPTA_ChartOfAccounts.Add(accountingAccountToAdd); context.SaveChanges(); return accountingAccount; } }
public List<Company_Contact> GetListCompanyContact() { List<Company_Contact> lcontact; using (SUPERPEntities sup = new SUPERPEntities(false)) { lcontact = sup.Company_Contact.ToList(); ; } return lcontact; }
public COMPTA_BankAccount CreateBankAccount(COMPTA_BankAccount bankAccountToAdd) { using(SUPERPEntities context = new SUPERPEntities(false)) { var bankAccount = context.COMPTA_BankAccount.Add(bankAccountToAdd); context.SaveChanges(); return bankAccount; } }
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 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_AccountingEntries CreateAccountingEntry(COMPTA_AccountingEntries accountingEntryToAdd) { using(SUPERPEntities context = new SUPERPEntities(false)) { var accountingEntry = context.COMPTA_AccountingEntries.Add(accountingEntryToAdd); context.SaveChanges(); return accountingEntry; } }
public COMPTA_Bank CreateBank(COMPTA_Bank bankToAdd) { using(SUPERPEntities context = new SUPERPEntities(false)) { var bank = context.COMPTA_Bank.Add(bankToAdd); context.SaveChanges(); return bank; } }
public COMPTA_Currency CreateCurrency(COMPTA_Currency currencyToAdd) { using(SUPERPEntities context = new SUPERPEntities(false)) { var currency = context.COMPTA_Currency.Add(currencyToAdd); context.SaveChanges(); return currency; } }
public COMPTA_BankJournalLine CreateBankJournalLine(COMPTA_BankJournalLine bankJournalLineToAdd) { using(SUPERPEntities context = new SUPERPEntities(false)) { var bankJournalLine = context.COMPTA_BankJournalLine.Add(bankJournalLineToAdd); context.SaveChanges(); return bankJournalLine; } }
public List<Company_Contact> GetListCompanyContact(int idCompany) { List<Company_Contact> lcontact; using (SUPERPEntities sup = new SUPERPEntities(false)) { lcontact = sup.Company_Contact.Where(o => o.company_id == idCompany).ToList(); ; } return lcontact; }
public BILL_Product CreateBillProduct(BILL_Product billProductToAdd) { using (SUPERPEntities context = new SUPERPEntities(false)) { var p = context.BILL_Product.Add(billProductToAdd); context.SaveChanges(); return p; } }
public List<Company> GetListCompany() { List<Company> com1 = new List<Company>(); using (SUPERPEntities sup = new SUPERPEntities(false)) { com1 = sup.Companies.ToList(); } return com1; }
public Company GetCompany(int idCompany) { Company com = new Company(); using (SUPERPEntities sup = new SUPERPEntities(false)) { com = sup.Companies.Where(o => o.id == idCompany).FirstOrDefault(); } return com; }
public Company_Contact GetCompany_Contact(int idContact) { Company_Contact contact; using (SUPERPEntities sup = new SUPERPEntities(false)) { contact = sup.Company_Contact.Where(o => o.id == idContact).FirstOrDefault(); ; } return contact; }
public bool DeleteCompany(int id) { using (SUPERPEntities sup = new SUPERPEntities(false)) { Company contact = sup.Companies.Where(p => p.id == id).FirstOrDefault(); sup.Entry(contact).State = System.Data.Entity.EntityState.Deleted; sup.SaveChanges(); } return true; }
public BILL_Product EditBillProduct(BILL_Product billProductToEdit) { using (SUPERPEntities context = new SUPERPEntities(false)) { var p = context.BILL_Product.Find(billProductToEdit.Product_Id); p = billProductToEdit; context.SaveChanges(); return p; } }
public int CreateCompany(Company compa) { using (SUPERPEntities sup = new SUPERPEntities(false)) { sup.Companies.Add(compa); sup.SaveChanges(); Company cont = sup.Companies.OrderByDescending(p => p.id).First(); return (int)cont.id; } }