Example #1
0
 public ReportBalanceTable(ReportBalance reportBalance, Product product, StoreCell storeCell, Storehouse storehouse)
 {
     this.product       = product;
     this.storehouse    = storehouse;
     this.storeCell     = storeCell;
     this.reportBalance = reportBalance;
 }
Example #2
0
 public bool queryAddReportBalance(ReportBalance c)
 {
     if (LoginInfo.Position == 1 || LoginInfo.Position == 2)//Начальник склада, Бухгалтер
     {
         using (DataBaseContext db = new DataBaseContext())
         {
             try
             {
                 db.ReportBalances.Add(c);
                 db.SaveChanges();
             }
             catch (Exception e)
             {
                 return(false);
             }
             return(true);
         }
     }
     return(false);
 }
Example #3
0
        /*public bool queryUpdateReportBalance(ReportBalance c)
         * {
         *  using (DataBaseContext db = new DataBaseContext())
         *  {
         *      try
         *      {
         *          ReportBalance p = db.ReportBalances.Find(c.Id);
         *
         *          p.Amount = c.Amount;
         *          p.ProductId = c.ProductId;
         *          p.Date = c.Date;
         *          p.StoreCellId = c.StoreCellId;
         *
         *          db.SaveChanges();
         *      }
         *      catch (Exception e)
         *      {
         *          return false;
         *      }
         *      return true;
         *  }
         * }*/

        public bool queryDeleteReportBalance(int Id)
        {
            if (LoginInfo.Position == 1 || LoginInfo.Position == 2)//Начальник склада, Бухгалтер
            {
                using (DataBaseContext db = new DataBaseContext())
                {
                    try
                    {
                        ReportBalance p = db.ReportBalances.Find(Id);
                        db.ReportBalances.Remove(p);

                        db.SaveChanges();
                    }
                    catch (Exception e)
                    {
                        return(false);
                    }
                    return(true);
                }
            }
            return(false);
        }