Пример #1
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();
     }
 }
Пример #2
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();
     }
 }
Пример #3
0
 public void SaveAdmin(AdminDetail newAdmin)
 {
     using (Store_BillingEntities addAdmin = new Store_BillingEntities())
     {
         addAdmin.AdminDetails.Add(newAdmin);
         addAdmin.SaveChanges();
     }
 }
Пример #4
0
 public void AddSalesDetails(List <SalesDetail> billedProducts)
 {
     using (Store_BillingEntities billedProductDetails = new Store_BillingEntities())
     {
         billedProductDetails.SalesDetails.AddRange(billedProducts);
         billedProductDetails.SaveChanges();
     }
 }
Пример #5
0
 public bool SaveProduct(StockDetail newStock)
 {
     using (Store_BillingEntities saveProductDetails = new Store_BillingEntities())
     {
         saveProductDetails.StockDetails.Add(newStock);
         saveProductDetails.SaveChanges();
         return(true);
     }
 }
Пример #6
0
 public bool SaveCashier(CashierDetail newCashier)
 {
     using (Store_BillingEntities saveCashierDetails = new Store_BillingEntities())
     {
         saveCashierDetails.CashierDetails.Add(newCashier);
         saveCashierDetails.SaveChanges();
         return(true);
     }
 }
Пример #7
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();
     }
 }
Пример #8
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);
            }
        }
Пример #9
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);
            }
        }
Пример #10
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);
            }
        }
Пример #11
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);
            }
        }