Beispiel #1
0
        public bool queryUpdateContractMove(ContractMove c)
        {
            if (LoginInfo.Position == 1 || LoginInfo.Position == 3) //Начальник или Кладовщик
            {
                using (DataBaseContext db = new DataBaseContext())
                {
                    try
                    {
                        ContractMove contract = db.ContractMoves.Find(c.Id);

                        contract.StoreCellToId   = c.StoreCellToId;
                        contract.StoreCellFromId = c.StoreCellFromId;
                        contract.ProductId       = c.ProductId;
                        contract.Amount          = c.Amount;
                        contract.Date            = c.Date;

                        db.SaveChanges();
                    }
                    catch (Exception e)
                    {
                        return(false);
                    }
                    return(true);
                }
            }
            return(false);
        }
Beispiel #2
0
 public ContractMoveTable(ContractMove contractMove, StoreCell storeCellFrom, StoreCell storeCellTo, Storehouse storehouseFrom, Storehouse storehouseTo)
 {
     this.contractMove   = contractMove;
     this.storeCellFrom  = storeCellFrom;
     this.storeCellTo    = storeCellTo;
     this.storehouseFrom = storehouseFrom;
     this.storehouseTo   = storehouseTo;
 }
Beispiel #3
0
 public ContractMove queryFindContractMoveById(int Id)
 {
     if (LoginInfo.Position == 1 || LoginInfo.Position == 3) //Начальник или Кладовщик
     {
         using (DataBaseContext db = new DataBaseContext())
         {
             ContractMove c = db.ContractMoves.Find(Id);
             c.StoreCellFromObj = c.StoreCellFromObj;
             c.StoreCellToObj   = c.StoreCellToObj;
             //StoreCellTable sct = new StoreCellTable(c.StoreCellFromObj,
             return(c);
         }
     }
     return(null);
 }
Beispiel #4
0
 public bool queryAddContractMove(ContractMove c)
 {
     if (LoginInfo.Position == 1 || LoginInfo.Position == 3) //Начальник или Кладовщик
     {
         using (DataBaseContext db = new DataBaseContext())
         {
             try
             {
                 db.ContractMoves.Add(c);
                 db.SaveChanges();
             }
             catch (Exception e)
             {
                 return(false);
             }
             return(true);
         }
     }
     return(false);
 }
Beispiel #5
0
        public bool queryDeleteContractMove(int Id)
        {
            if (LoginInfo.Position == 1 || LoginInfo.Position == 3) //Начальник или Кладовщик
            {
                using (DataBaseContext db = new DataBaseContext())
                {
                    try
                    {
                        ContractMove contract = db.ContractMoves.Find(Id);
                        db.ContractMoves.Remove(contract);

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