Example #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));
     }
 }
Example #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));
     }
 }
Example #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));
     }
 }
Example #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));
     }
 }
Example #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));
     }
 }
Example #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());
     }
 }
Example #7
0
 public List <BILL_Product> GetBillProduct()
 {
     using (SUPERPEntities context = new SUPERPEntities(false))
     {
         return(context.BILL_Product.Include("BILL_Vat").Include("BILL_Category").ToList());
     }
 }
Example #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());
     }
 }
Example #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());
     }
 }
Example #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);
        }
Example #12
0
 public List <BILL_Transmitter> GetBillTrans()
 {
     using (SUPERPEntities context = new SUPERPEntities(false))
     {
         return(context.BILL_Transmitter.ToList());
     }
 }
Example #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);
            }
        }
Example #14
0
 public IEnumerable <Module> GetModules()
 {
     using (SUPERPEntities context = new SUPERPEntities(false))
     {
         return(context.Modules.Include("RoleModules").Include("RoleModules.Module").Include("RoleModules.Role").ToList());
     }
 }
Example #15
0
 public IEnumerable <COMPTA_CustomerJournalLine> GetCustomerJournalLines()
 {
     using (SUPERPEntities context = new SUPERPEntities(false))
     {
         return(context.COMPTA_CustomerJournalLine);
     }
 }
Example #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);
            }
        }
Example #17
0
 public IEnumerable <COMPTA_Currency> GetCurrencies()
 {
     using (SUPERPEntities context = new SUPERPEntities(false))
     {
         return(context.COMPTA_Currency.Include("COMPTA_BankAccount"));
     }
 }
Example #18
0
 public IEnumerable <COMPTA_BankJournalLine> GetBankJournalLines()
 {
     using (SUPERPEntities context = new SUPERPEntities(false))
     {
         return(context.COMPTA_BankJournalLine.Include("COMPTA_BankAccount"));
     }
 }
Example #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;
            }
        }
Example #20
0
 public List <BILL_Status> GetStatus()
 {
     using (SUPERPEntities context = new SUPERPEntities(false))
     {
         return(context.BILL_Status.ToList());
     }
 }
Example #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);
     }
 }
Example #22
0
 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());
     }
 }
Example #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);
     }
 }
Example #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);
     }
 }
Example #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());
     }
 }
Example #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);
     }
 }
Example #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);
     }
 }
Example #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);
     }
 }