public void Update(PRODUCT entity)
 {
     try
     {
         using (StudioDB db = new StudioDB())
         {
             var obj = from o in db.PRODUCTs
                       where o.id_product == entity.id_product
                       select o;
             obj.ToList()[0].title     = entity.title;
             obj.ToList()[0].category  = entity.category;
             obj.ToList()[0].size      = entity.size;
             obj.ToList()[0].color     = entity.color;
             obj.ToList()[0].photo     = entity.photo;
             obj.ToList()[0].price     = entity.price;
             obj.ToList()[0].count     = entity.count;
             obj.ToList()[0].id_supply = entity.id_supply;
             db.SaveChanges();
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Пример #2
0
 public void Update(CLIENT entity)
 {
     try
     {
         using (StudioDB db = new StudioDB())
         {
             var obj = from o in db.CLIENTs
                       where o.id_client == entity.id_client
                       select o;
             obj.ToList()[0].name         = entity.name;
             obj.ToList()[0].surname      = entity.surname;
             obj.ToList()[0].patronymic   = entity.patronymic;
             obj.ToList()[0].login        = entity.login;
             obj.ToList()[0].password     = entity.password;
             obj.ToList()[0].access_level = entity.access_level;
             obj.ToList()[0].password     = entity.password;
             obj.ToList()[0].mail         = entity.mail;
             obj.ToList()[0].phone_number = entity.phone_number;
             obj.ToList()[0].sex          = entity.sex;
             obj.ToList()[0].growth       = entity.growth;
             obj.ToList()[0].chest        = entity.chest;
             obj.ToList()[0].waist        = entity.waist;
             obj.ToList()[0].hip          = entity.hip;
             db.SaveChanges();
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
 public void Add(SUPPLY entity)
 {
     try
     {
         using (StudioDB db = new StudioDB())
         {
             db.SUPPLies.Add(entity);
             db.SaveChanges();
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
 public void Add(PRODUCT entity)
 {
     try
     {
         using (StudioDB db = new StudioDB())
         {
             db.PRODUCTs.Add(entity);
             db.SaveChanges();
         }
     }
     catch (Exception e)
     {
         throw e; //ERROR!
     }
 }
 public void Add(PRODUCT_STRUCTURE entity)
 {
     try
     {
         using (StudioDB db = new StudioDB())
         {
             db.PRODUCT_STRUCTURE.Add(entity);
             db.SaveChanges();
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
 public void Add(MATERIAL entity)
 {
     try
     {
         using (StudioDB db = new StudioDB())
         {
             db.MATERIALs.Add(entity);
             db.SaveChanges();
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Пример #7
0
 public void Add(CLIENT entity)
 {
     try
     {
         using (StudioDB db = new StudioDB())
         {
             db.CLIENTs.Add(entity);
             db.SaveChanges();
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
 public void Update(SUPPLY entity)
 {
     try
     {
         using (StudioDB db = new StudioDB())
         {
             var obj = from o in db.SUPPLies
                       where o.id_supply == entity.id_supply
                       select o;
             obj.ToList()[0].delivery_date = entity.delivery_date;
             db.SaveChanges();
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
 public void Update(MATERIAL entity)
 {
     try
     {
         using (StudioDB db = new StudioDB())
         {
             var obj = from o in db.MATERIALs
                       where o.id_material == entity.id_material
                       select o;
             obj.ToList()[0].name  = entity.name;
             obj.ToList()[0].count = entity.count;
             db.SaveChanges();
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Пример #10
0
 public void Delete(ORDER entity)
 {
     try
     {
         using (StudioDB db = new StudioDB())
         {
             ORDER order = db.ORDERs.
                           FirstOrDefault(c => c.id_order == entity.id_order);
             if (order != null)
             {
                 db.ORDERs.Remove(order);
                 db.SaveChanges();
             }
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
 public void Delete(PRODUCT entity)
 {
     try
     {
         using (StudioDB db = new StudioDB())
         {
             PRODUCT product = db.PRODUCTs.
                               FirstOrDefault(c => c.id_product == entity.id_product);
             if (product != null)
             {
                 db.PRODUCTs.Remove(product);
                 db.SaveChanges();
             }
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
 public void Delete(MATERIAL entity)
 {
     try
     {
         using (StudioDB db = new StudioDB())
         {
             MATERIAL material = db.MATERIALs.
                                 FirstOrDefault(c => c.id_material == entity.id_material);
             if (material != null)
             {
                 db.MATERIALs.Remove(material);
                 db.SaveChanges();
             }
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
 public void Update(PRODUCT_STRUCTURE entity)
 {
     try
     {
         using (StudioDB db = new StudioDB())
         {
             var obj = from o in db.PRODUCT_STRUCTURE
                       where o.id_product_structure == entity.id_product_structure
                       select o;
             obj.ToList()[0].count       = entity.count;
             obj.ToList()[0].id_material = entity.id_material;
             obj.ToList()[0].id_product  = entity.id_product;
             db.SaveChanges();
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
 public void Delete(BASKET entity)
 {
     try
     {
         using (StudioDB db = new StudioDB())
         {
             BASKET basket = db.BASKETs.
                             FirstOrDefault(c => c.id_basket == entity.id_basket);
             if (basket != null)
             {
                 db.BASKETs.Remove(basket);
                 db.SaveChanges();
             }
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Пример #15
0
 public void Delete(CLIENT entity)
 {
     try
     {
         using (StudioDB db = new StudioDB())
         {
             CLIENT client = db.CLIENTs.
                             FirstOrDefault(c => c.id_client == entity.id_client);
             if (client != null)
             {
                 db.CLIENTs.Remove(client);
                 db.SaveChanges();
             }
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
 public void Delete(SUPPLY entity)
 {
     try
     {
         using (StudioDB db = new StudioDB())
         {
             SUPPLY supply = db.SUPPLies.
                             FirstOrDefault(c => c.id_supply == entity.id_supply);
             if (supply != null)
             {
                 db.SUPPLies.Remove(supply);
                 db.SaveChanges();
             }
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
 public void Update(BASKET entity)
 {
     try
     {
         using (StudioDB db = new StudioDB())
         {
             var obj = from o in db.BASKETs
                       where o.id_basket == entity.id_basket
                       select o;
             obj.ToList()[0].count      = entity.count;
             obj.ToList()[0].id_client  = entity.id_client;
             obj.ToList()[0].id_product = entity.id_product;
             obj.ToList()[0].id_order   = entity.id_order;
             db.SaveChanges();
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Пример #18
0
 public void Update(ORDER entity)
 {
     try
     {
         using (StudioDB db = new StudioDB())
         {
             var obj = from o in db.ORDERs
                       where o.id_order == entity.id_order
                       select o;
             obj.ToList()[0].order_date   = entity.order_date;
             obj.ToList()[0].order_time   = entity.order_date;
             obj.ToList()[0].order_status = entity.order_status;
             obj.ToList()[0].total_sum    = entity.total_sum;
             db.SaveChanges();
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Пример #19
0
 public void ChangeParametrs(string login, string mail, string phone_number,
                             int growth, int chest, int waist, int hip)
 {
     try
     {
         using (StudioDB db = new StudioDB())
         {
             var tmpclient = from cl in db.CLIENTs
                             where cl.login == login
                             select cl;
             (tmpclient as CLIENT).mail         = mail;
             (tmpclient as CLIENT).phone_number = phone_number;
             (tmpclient as CLIENT).growth       = growth;
             (tmpclient as CLIENT).chest        = chest;
             (tmpclient as CLIENT).waist        = waist;
             (tmpclient as CLIENT).hip          = hip;
             db.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }