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

                        contract.TechCardId = c.TechCardId;
                        contract.Amount     = c.Amount;
                        contract.Date       = c.Date;

                        db.SaveChanges();
                    }
                    catch (Exception e)
                    {
                        return(false);
                    }
                    return(true);
                }
            }
            return(false);
        }
Beispiel #2
0
 public bool queryAddContractTechOperation(ContractTechOperation c)
 {
     if (LoginInfo.Position == 1 || LoginInfo.Position == 3) //Начальник или Кладовщик
     {
         using (DataBaseContext db = new DataBaseContext())
         {
             try
             {
                 db.ContractTechOperations.Add(c);
                 db.SaveChanges();
             }
             catch (Exception e)
             {
                 return(false);
             }
             return(true);
         }
     }
     return(false);
 }
Beispiel #3
0
        public bool queryDeleteContractTechOperation(int Id)
        {
            if (LoginInfo.Position == 1 || LoginInfo.Position == 3) //Начальник или Кладовщик
            {
                using (DataBaseContext db = new DataBaseContext())
                {
                    try
                    {
                        ContractTechOperation contract = db.ContractTechOperations.Find(Id);
                        db.ContractTechOperations.Remove(contract);

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