示例#1
0
 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));
     }
 }
示例#2
0
 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));
     }
 }
示例#3
0
 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));
     }
 }
示例#4
0
 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));
     }
 }
示例#5
0
 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));
     }
 }
示例#6
0
 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());
     }
 }
示例#7
0
 public List <BILL_Product> GetBillProduct()
 {
     using (SUPERPEntities context = new SUPERPEntities(false))
     {
         return(context.BILL_Product.Include("BILL_Vat").Include("BILL_Category").ToList());
     }
 }
示例#8
0
 public IEnumerable <COMPTA_AccountingEntries_Periodicity> GetAccountingEntriesPeriodicity( )
 {
     using (SUPERPEntities context = new SUPERPEntities(false))
     {
         return(context.COMPTA_AccountingEntries_Periodicity.Include("COMPTA_Periodicity").Include("COMPTA_AccountingEntries").ToList());
     }
 }
示例#9
0
 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());
     }
 }
示例#11
0
        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);
        }
示例#12
0
 public List <BILL_Transmitter> GetBillTrans()
 {
     using (SUPERPEntities context = new SUPERPEntities(false))
     {
         return(context.BILL_Transmitter.ToList());
     }
 }
示例#13
0
        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);
            }
        }
示例#14
0
 public IEnumerable <Module> GetModules()
 {
     using (SUPERPEntities context = new SUPERPEntities(false))
     {
         return(context.Modules.Include("RoleModules").Include("RoleModules.Module").Include("RoleModules.Role").ToList());
     }
 }
示例#15
0
 public IEnumerable <COMPTA_CustomerJournalLine> GetCustomerJournalLines()
 {
     using (SUPERPEntities context = new SUPERPEntities(false))
     {
         return(context.COMPTA_CustomerJournalLine);
     }
 }
示例#16
0
        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);
            }
        }
示例#17
0
 public IEnumerable <COMPTA_Currency> GetCurrencies()
 {
     using (SUPERPEntities context = new SUPERPEntities(false))
     {
         return(context.COMPTA_Currency.Include("COMPTA_BankAccount"));
     }
 }
示例#18
0
 public IEnumerable <COMPTA_BankJournalLine> GetBankJournalLines()
 {
     using (SUPERPEntities context = new SUPERPEntities(false))
     {
         return(context.COMPTA_BankJournalLine.Include("COMPTA_BankAccount"));
     }
 }
示例#19
0
        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;
            }
        }
示例#20
0
 public List <BILL_Status> GetStatus()
 {
     using (SUPERPEntities context = new SUPERPEntities(false))
     {
         return(context.BILL_Status.ToList());
     }
 }
示例#21
0
 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);
     }
 }
示例#22
0
 public IEnumerable <COMPTA_ClassOfAccounts> GetAccountingClasses()
 {
     using (SUPERPEntities context = new SUPERPEntities(false))
     {
         return(context.COMPTA_ClassOfAccounts
                .Include("COMPTA_ChartOfAccounts").ToList());
     }
 }
示例#23
0
 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));
     }
 }
示例#24
0
 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());
     }
 }
示例#25
0
 public COMPTA_CustomerJournalLine CreateCustomerJournalLine(COMPTA_CustomerJournalLine customerJournalLineToAdd)
 {
     using (SUPERPEntities context = new SUPERPEntities(false))
     {
         var customerJournalLine = context.COMPTA_CustomerJournalLine.Add(customerJournalLineToAdd);
         context.SaveChanges();
         return(customerJournalLine);
     }
 }
示例#26
0
 public COMPTA_AccountingEntries CreateAccountingEntry(COMPTA_AccountingEntries accountingEntryToAdd)
 {
     using (SUPERPEntities context = new SUPERPEntities(false))
     {
         var accountingEntry = context.COMPTA_AccountingEntries.Add(accountingEntryToAdd);
         context.SaveChanges();
         return(accountingEntry);
     }
 }
示例#27
0
 public List <COMPTA_AccountingEntries> GetAccountingEntriesTop1()
 {
     using (SUPERPEntities context = new SUPERPEntities(false))
     {
         return(context.COMPTA_AccountingEntries
                .Include("COMPTA_AccountingEntries_Periodicity")
                .Include("COMPTA_ChartOfAccounts").ToList());
     }
 }
示例#28
0
 public COMPTA_SupplierJournalLine CreateSupplierJournalLine(COMPTA_SupplierJournalLine supplierJournalLineToAdd)
 {
     using (SUPERPEntities context = new SUPERPEntities(false))
     {
         var supplierJournalLine = context.COMPTA_SupplierJournalLine.Add(supplierJournalLineToAdd);
         context.SaveChanges();
         return(supplierJournalLine);
     }
 }
示例#29
0
 public BILL_BillQuotation CreateBillQutotation(BILL_BillQuotation billQuotationToAdd)
 {
     using (SUPERPEntities context = new SUPERPEntities(false))
     {
         var b = context.BILL_BillQuotation.Add(billQuotationToAdd);
         context.SaveChanges();
         return(b);
     }
 }
示例#30
0
 public COMPTA_BankJournalLine CreateBankJournalLine(COMPTA_BankJournalLine bankJournalLineToAdd)
 {
     using (SUPERPEntities context = new SUPERPEntities(false))
     {
         var bankJournalLine = context.COMPTA_BankJournalLine.Add(bankJournalLineToAdd);
         context.SaveChanges();
         return(bankJournalLine);
     }
 }