Beispiel #1
0
 public Boolean SaveStore(Store_Info storeinfo)
 {
     if (string.IsNullOrEmpty(storeinfo.Store_Info_ID.ToString())) // New Record
     {
         using (UtilitySaleDBContext dbContext = new UtilitySaleDBContext())
         {
             dbContext.Store_Info.Add(storeinfo);
             dbContext.SaveChanges();
             return(true);
         }
     }
     else // Update Record
     {
         using (UtilitySaleDBContext dbContext = new UtilitySaleDBContext())
         {
             Store_Info info = dbContext.Store_Info.Where(x => x.Store_Info_ID == storeinfo.Store_Info_ID).FirstOrDefault();
             info.Store_Name = storeinfo.Store_Name;
             info.Is_Active  = storeinfo.Is_Active;
             info.Updated_On = DateTime.Now;
             info.Updated_By = "User";
             dbContext.SaveChanges();
             return(true);
         }
     }
 }
 public Boolean SaveUtility(Utility.Data.Utility utility)
 {
     if (string.IsNullOrEmpty(utility.Utility_ID.ToString()))  // New Record
     {
         using (UtilitySaleDBContext dbContext = new UtilitySaleDBContext())
         {
             dbContext.Utilities.Add(utility);
             dbContext.SaveChanges();
             return(true);
         }
     }
     else  // Update Record
     {
         using (UtilitySaleDBContext dbContext = new UtilitySaleDBContext())
         {
             Utility.Data.Utility Utility = dbContext.Utilities.Where(x => x.Utility_ID == utility.Utility_ID).FirstOrDefault();
             Utility.Utility_Name = utility.Utility_Name;
             Utility.Is_Active    = utility.Is_Active;
             Utility.City_ID      = utility.City_ID;
             Utility.Updated_On   = DateTime.Now;
             Utility.Updated_By   = "user";
             return(true);
         }
     }
 }
Beispiel #3
0
 public Boolean SaveSaleData(Store_Sale storeSale)
 {
     if (string.IsNullOrEmpty(storeSale.Store_Sale_ID.ToString())) // New Record
     {
         using (UtilitySaleDBContext dbContext = new UtilitySaleDBContext())
         {
             dbContext.Store_Sale.Add(storeSale);
             dbContext.SaveChanges();
             return(true);
         }
     }
     else // Update Record
     {
         using (UtilitySaleDBContext dbContext = new UtilitySaleDBContext())
         {
             Store_Sale storesale = dbContext.Store_Sale.Where(x => x.Store_Sale_ID == storeSale.Store_Sale_ID).FirstOrDefault();
             dbContext.SaveChanges();
             return(true);
         }
     }
 }
Beispiel #4
0
 public Boolean SaveStoreBranch(Store_Branches storeBranch)
 {
     if (string.IsNullOrEmpty(storeBranch.Store_Branch_ID.ToString())) // New Record
     {
         using (UtilitySaleDBContext dbContext = new UtilitySaleDBContext())
         {
             dbContext.Store_Branches.Add(storeBranch);
             dbContext.SaveChanges();
             return(true);
         }
     }
     else // Update Record
     {
         using (UtilitySaleDBContext dbContext = new UtilitySaleDBContext())
         {
             Store_Branches branches = dbContext.Store_Branches.Where(x => x.Store_Branch_ID == storeBranch.Store_Branch_ID).FirstOrDefault();
             branches.Branch_Address = storeBranch.Branch_Address;
             branches.Branch_Name    = storeBranch.Branch_Name;
             branches.Is_Active      = storeBranch.Is_Active;
             dbContext.SaveChanges();
             return(true);
         }
     }
 }