예제 #1
0
 public List <StockDetail> GetAllStock()
 {
     using (Store_BillingEntities getAllStock = new Store_BillingEntities())
     {
         return(getAllStock.StockDetails.ToList());
     }
 }
예제 #2
0
 public List <AdminDetail> GetAllAdmin()
 {
     using (Store_BillingEntities allAdmin = new Store_BillingEntities())
     {
         return(allAdmin.AdminDetails.ToList());
     }
 }
예제 #3
0
 public List <CashierDetail> GetAllCashier()
 {
     using (Store_BillingEntities getAllCashier = new Store_BillingEntities())
     {
         return(getAllCashier.CashierDetails.ToList());
     }
 }
예제 #4
0
 public void CheckDbConnection()
 {
     using (Store_BillingEntities billingEntities = new Store_BillingEntities())
     {
         billingEntities.AdminDetails.ToList();
     }
 }
예제 #5
0
 public List <SalesDetail> RetrieveAllSalesDetails()
 {
     using (Store_BillingEntities allSalesDetails = new Store_BillingEntities())
     {
         return(allSalesDetails.SalesDetails.ToList());
     }
 }
예제 #6
0
 public void AddLastLoggedOutTimeForLoggedAdmin(string loggedInAdminUserId)
 {
     using (Store_BillingEntities allAdmin = new Store_BillingEntities())
     {
         allAdmin.AdminDetails.Where(obj => obj.UserId.Equals(loggedInAdminUserId)).ToList().ForEach(obj => obj.Last_LoggedOut_Time = DateTime.Now);
         allAdmin.SaveChanges();
     }
 }
예제 #7
0
 public void SaveAdmin(AdminDetail newAdmin)
 {
     using (Store_BillingEntities addAdmin = new Store_BillingEntities())
     {
         addAdmin.AdminDetails.Add(newAdmin);
         addAdmin.SaveChanges();
     }
 }
예제 #8
0
 public void AddCashierLastLogoutTime(int cashierId)
 {
     using (Store_BillingEntities addLastLogoutTime = new Store_BillingEntities())
     {
         addLastLogoutTime.CashierDetails.Where(obj => obj.CashierID == cashierId).ToList().ForEach(obj => obj.Last_LoggedOut_Time = DateTime.Now);
         addLastLogoutTime.SaveChanges();
     }
 }
예제 #9
0
 public void AddSalesDetails(List <SalesDetail> billedProducts)
 {
     using (Store_BillingEntities billedProductDetails = new Store_BillingEntities())
     {
         billedProductDetails.SalesDetails.AddRange(billedProducts);
         billedProductDetails.SaveChanges();
     }
 }
예제 #10
0
 public bool SaveProduct(StockDetail newStock)
 {
     using (Store_BillingEntities saveProductDetails = new Store_BillingEntities())
     {
         saveProductDetails.StockDetails.Add(newStock);
         saveProductDetails.SaveChanges();
         return(true);
     }
 }
예제 #11
0
 public bool SaveCashier(CashierDetail newCashier)
 {
     using (Store_BillingEntities saveCashierDetails = new Store_BillingEntities())
     {
         saveCashierDetails.CashierDetails.Add(newCashier);
         saveCashierDetails.SaveChanges();
         return(true);
     }
 }
예제 #12
0
 public void QuantityReduction(List <SalesDetail> purchasedProductDetails)
 {
     using (Store_BillingEntities reduceQuantityForPurchasedProduct = new Store_BillingEntities())
     {
         foreach (StockDetail stockUpdate in reduceQuantityForPurchasedProduct.StockDetails)
         {
             foreach (SalesDetail billedProducts in purchasedProductDetails)
             {
                 if (billedProducts.ProductId == stockUpdate.ProductId)
                 {
                     stockUpdate.QuantityAvailable -= billedProducts.Quantity;
                     break;
                 }
             }
         }
         reduceQuantityForPurchasedProduct.SaveChanges();
     }
 }
예제 #13
0
        public bool UpdateProductDetails(int productId, decimal productPrice, int availableQty)
        {
            bool isProductDetailsUpdated = false;

            using (Store_BillingEntities updateProductDetails = new Store_BillingEntities())
            {
                foreach (StockDetail productDetails in updateProductDetails.StockDetails)
                {
                    if (productDetails.ProductId == productId)
                    {
                        productDetails.Price             = productPrice;
                        productDetails.QuantityAvailable = availableQty;
                        isProductDetailsUpdated          = true;
                        break;
                    }
                }
                updateProductDetails.SaveChanges();
                return(isProductDetailsUpdated);
            }
        }
예제 #14
0
        public bool UpdateCashierDetails(CashierDetail cashier)
        {
            bool isCashierDetailsUpdated = false;

            using (Store_BillingEntities updateCashierDetails = new Store_BillingEntities())
            {
                foreach (CashierDetail cashierDetails in updateCashierDetails.CashierDetails)
                {
                    if (cashierDetails.CashierID == cashier.CashierID)
                    {
                        cashierDetails.CashierName  = cashier.CashierName;
                        cashierDetails.MobileNumber = cashier.MobileNumber;
                        cashierDetails.Password     = cashier.Password;
                        isCashierDetailsUpdated     = true;
                        break;
                    }
                }
                updateCashierDetails.SaveChanges();
                return(isCashierDetailsUpdated);
            }
        }
예제 #15
0
        public bool DeleteProduct(int productId)
        {
            bool        isProductdeleted           = false;
            StockDetail selecetdProductForDeletion = null;

            using (Store_BillingEntities deleteProduct = new Store_BillingEntities())
            {
                foreach (StockDetail productDetails in deleteProduct.StockDetails)
                {
                    if (productDetails.ProductId == productId)
                    {
                        selecetdProductForDeletion = productDetails;
                        break;
                    }
                }
                if (selecetdProductForDeletion != null)
                {
                    deleteProduct.StockDetails.Remove(selecetdProductForDeletion);
                    isProductdeleted = true;
                }
                deleteProduct.SaveChanges();
                return(isProductdeleted);
            }
        }
예제 #16
0
        public bool DeleteCashier(int cashierId)
        {
            bool          isCashierdeleted           = false;
            CashierDetail selecetdCashierForDeletion = null;

            using (Store_BillingEntities deleteCashier = new Store_BillingEntities())
            {
                foreach (CashierDetail cashierDetails in deleteCashier.CashierDetails)
                {
                    if (cashierDetails.CashierID == cashierId)
                    {
                        selecetdCashierForDeletion = cashierDetails;
                        break;
                    }
                }
                if (selecetdCashierForDeletion != null)
                {
                    deleteCashier.CashierDetails.Remove(selecetdCashierForDeletion);
                    isCashierdeleted = true;
                }
                deleteCashier.SaveChanges();
                return(isCashierdeleted);
            }
        }