public void CheckDbConnection()
 {
     using (Billing_Customized_Entities billingEntities = new Billing_Customized_Entities())
     {
         billingEntities.AdminDetails.ToList();
     }
 }
        public bool UpdateProductDetails(long productId, string productName, decimal quantity,
                                         decimal buyingPrice, decimal retailPrice, decimal wholesalePrice,
                                         decimal creditPrice, int gstPercentage)
        {
            bool isProductDetailsUpdated = false;

            using (Billing_Customized_Entities updateProductDetails = new Billing_Customized_Entities())
            {
                StockDetail stock = updateProductDetails.StockDetails.FirstOrDefault(obj => obj.ProductId == productId);

                if (stock != null)
                {
                    stock.ProductName       = productName;
                    stock.Quantity          = quantity;
                    stock.BuyingPrice       = Math.Round(buyingPrice, 2);
                    stock.RetailPrice       = Math.Round(retailPrice, 2);
                    stock.WholesalePrice    = Math.Round(wholesalePrice, 2);
                    stock.CreditPrice       = Math.Round(creditPrice, 2);
                    stock.GSTPercentage     = gstPercentage;
                    isProductDetailsUpdated = true;
                    updateProductDetails.SaveChanges();
                }

                return(isProductDetailsUpdated);
            }
        }
 public List <WholeSaleBill> GetAllWholesaleSalesDetails()
 {
     using (Billing_Customized_Entities allSalesDetails = new Billing_Customized_Entities())
     {
         return(allSalesDetails.WholeSaleBills.ToList());
     }
 }
Exemplo n.º 4
0
 public List <CreditBillTransaction> GetCreditBillTransactions()
 {
     using (Billing_Customized_Entities creditTransactions = new Billing_Customized_Entities())
     {
         return(creditTransactions.CreditBillTransactions.ToList());
     }
 }
 public List <CreditBillSalesDetail> RetrieveAllCreditProductSalesDetails()
 {
     using (Billing_Customized_Entities allSalesDetails = new Billing_Customized_Entities())
     {
         return(allSalesDetails.CreditBillSalesDetails.ToList());
     }
 }
Exemplo n.º 6
0
 public List <RetailBill> RetrieveAllRetailSalesDetails()
 {
     using (Billing_Customized_Entities allSalesDetails = new Billing_Customized_Entities())
     {
         return(allSalesDetails.RetailBills.ToList());
     }
 }
 public List <AdminDetail> GetAllAdmin()
 {
     using (Billing_Customized_Entities allAdmin = new Billing_Customized_Entities())
     {
         return(allAdmin.AdminDetails.ToList());
     }
 }
Exemplo n.º 8
0
 public List <ExpenseDetail> GetAllExpenseDetails()
 {
     using (Billing_Customized_Entities expenseDetails = new Billing_Customized_Entities())
     {
         return(expenseDetails.ExpenseDetails.ToList());
     }
 }
 public List <StockDetail> GetAllStock()
 {
     using (Billing_Customized_Entities getAllStock = new Billing_Customized_Entities())
     {
         return(getAllStock.StockDetails.ToList());
     }
 }
 public List <CreditBill> GetAllCreditSalesDetails()
 {
     using (Billing_Customized_Entities allSalesDetails = new Billing_Customized_Entities())
     {
         return(allSalesDetails.CreditBills.ToList());
     }
 }
 public List <WholeSaleBillSalesDetail> RetrieveAllWholesaleProductSalesDetails()
 {
     using (Billing_Customized_Entities allSalesDetails = new Billing_Customized_Entities())
     {
         return(allSalesDetails.WholeSaleBillSalesDetails.ToList());
     }
 }
Exemplo n.º 12
0
 public void UpdateWholeSaleBillSalesDetails(List <WholeSaleBillSalesDetail> purchasedProductDetails)
 {
     using (Billing_Customized_Entities addBilledProducts = new Billing_Customized_Entities())
     {
         addBilledProducts.WholeSaleBillSalesDetails.AddRange(purchasedProductDetails);
         addBilledProducts.SaveChanges();
     }
 }
Exemplo n.º 13
0
 public void AddCreditBillTransactions(CreditBillTransaction creditBillTransaction)
 {
     using (Billing_Customized_Entities addBilledProducts = new Billing_Customized_Entities())
     {
         addBilledProducts.CreditBillTransactions.Add(creditBillTransaction);
         addBilledProducts.SaveChanges();
     }
 }
Exemplo n.º 14
0
 public void AddNewExpenseDetails(ExpenseDetail expenseDetail)
 {
     using (Billing_Customized_Entities expenseDetails = new Billing_Customized_Entities())
     {
         expenseDetails.ExpenseDetails.Add(expenseDetail);
         expenseDetails.SaveChanges();
     }
 }
Exemplo n.º 15
0
 public void AddSalesDetailsForWholeSaleBill(WholeSaleBill billedProducts)
 {
     using (Billing_Customized_Entities billedProductDetails = new Billing_Customized_Entities())
     {
         billedProductDetails.WholeSaleBills.Add(billedProducts);
         billedProductDetails.SaveChanges();
     }
 }
 public void AddLastLoggedOutTimeForLoggedAdmin(string loggedInAdminUserId)
 {
     using (Billing_Customized_Entities allAdmin = new Billing_Customized_Entities())
     {
         allAdmin.AdminDetails.Where(obj => obj.UserId.Equals(loggedInAdminUserId)).ToList().ForEach(obj => obj.Last_LoggedOut_Time = DateTime.Now);
         allAdmin.SaveChanges();
     }
 }
 public bool SaveProduct(StockDetail newStock)
 {
     using (Billing_Customized_Entities saveProductDetails = new Billing_Customized_Entities())
     {
         saveProductDetails.StockDetails.Add(newStock);
         saveProductDetails.SaveChanges();
         return(true);
     }
 }
Exemplo n.º 18
0
 public void UpdateQuantity(List <Products> productDetails)
 {
     using (Billing_Customized_Entities billedProductDetails = new Billing_Customized_Entities())
     {
         foreach (Products details in productDetails)
         {
             billedProductDetails.StockDetails.Where(obj => obj.ProductId == details.ProductId).ToList().ForEach(obj => obj.Quantity -= details.Quantity);
         }
         billedProductDetails.SaveChanges();
     }
 }
Exemplo n.º 19
0
 public void AddCreditBillTransaction(CreditBillTransaction creditBillTransaction)
 {
     using (Billing_Customized_Entities creditTransactions = new Billing_Customized_Entities())
     {
         creditTransactions.CreditBillTransactions.Add(creditBillTransaction);
         var bill = creditTransactions.CreditBills.FirstOrDefault(obj => obj.BillNos.Equals(creditBillTransaction.BillNos) && obj.SoldDate == creditBillTransaction.BillDate);
         if (bill != null)
         {
             bill.PaidAmount += creditBillTransaction.PaidAmount;
         }
         creditTransactions.SaveChanges();
     }
 }
Exemplo n.º 20
0
        public void DeleteSalesDetailsForReturnBill(dynamic productSales, dynamic billDetails, int billType)
        {
            using (Billing_Customized_Entities allsalesdetails = new Billing_Customized_Entities())
            {
                if (billType.Equals(1))
                {
                    if (billDetails != null)
                    {
                        allsalesdetails.RetailBills.Attach(billDetails);
                        allsalesdetails.Entry(billDetails).State = EntityState.Deleted;
                    }
                    foreach (var item in productSales)
                    {
                        allsalesdetails.RetailBillSalesDetails.Attach(item);
                        allsalesdetails.Entry(item).State = EntityState.Deleted;
                    }
                }
                else if (billType.Equals(2))
                {
                    if (billDetails != null)
                    {
                        allsalesdetails.WholeSaleBills.Attach(billDetails);
                        allsalesdetails.Entry(billDetails).State = EntityState.Deleted;
                    }
                    foreach (var item in productSales)
                    {
                        allsalesdetails.WholeSaleBillSalesDetails.Attach(item);
                        allsalesdetails.Entry(item).State = EntityState.Deleted;
                    }
                }
                else
                {
                    if (billDetails != null)
                    {
                        allsalesdetails.CreditBills.Attach(billDetails);
                        allsalesdetails.Entry(billDetails).State = EntityState.Deleted;
                    }
                    foreach (var item in productSales)
                    {
                        allsalesdetails.CreditBillSalesDetails.Attach(item);
                        allsalesdetails.Entry(item).State = EntityState.Deleted;
                    }
                }

                allsalesdetails.SaveChanges();
            }
        }
        public bool DeleteProduct(long productId)
        {
            bool isProductdeleted = false;

            using (Billing_Customized_Entities deleteProduct = new Billing_Customized_Entities())
            {
                StockDetail stockDetail = deleteProduct.StockDetails.FirstOrDefault(obj => obj.ProductId == productId);
                if (stockDetail != null)
                {
                    deleteProduct.StockDetails.Remove(stockDetail);
                    isProductdeleted = true;
                    deleteProduct.SaveChanges();
                }

                return(isProductdeleted);
            }
        }