Пример #1
0
 public void Delete(string strOrderId)
 {
     using (var context = new MesEntities())
     {
         Order order = context.Orders.Find(Convert.ToInt32(strOrderId));
         context.Orders.Remove(order);
         context.SaveChanges();
     }
 }
Пример #2
0
 public void Delete(string strWareHouseId)
 {
     using (var context = new MesEntities())
     {
         WareHouse wareHouse = context.WareHouses.Find(Convert.ToInt32(strWareHouseId));
         context.WareHouses.Remove(wareHouse);
         context.SaveChanges();
     }
 }
Пример #3
0
        public void InsertWareHouse(string[] strArray)
        {
            using (var context = new MesEntities())
            {
                var WareHouses = context.Set <WareHouse>();
                WareHouses.Add(new WareHouse
                {
                    WareHouseId = Convert.ToInt32(strArray[0]),
                    AreaSize    = Convert.ToInt32(strArray[1]),
                    EmployeeId  = Convert.ToInt32(strArray[2]),
                    PhoneNumber = strArray[3],
                });


                context.SaveChanges();
            }
        }
Пример #4
0
        public void InsertOrder(string[] strArray)
        {
            // insert
            using (var context = new MesEntities())
            {
                var orders = context.Set <Order>();
                orders.Add(new Order
                {
                    OrderId    = Convert.ToInt32(strArray[0]),
                    ResourceId = Convert.ToInt32(strArray[1]),
                    Date       = Convert.ToDateTime(strArray[2]),
                    EmployeeId = Convert.ToInt32(strArray[3]),
                    Quantity   = Convert.ToInt32(strArray[4]),
                    SellerName = strArray[5]
                });

                context.SaveChanges();
            }
        }
Пример #5
0
        public void UpdateWareHouse(List <string> list)
        {
            int id = Convert.ToInt32(list[0]);

            using (var context = new MesEntities())
            {
                var result = context.WareHouses.SingleOrDefault(x => x.WareHouseId == id);

                if (result != null)
                {
                    result.WareHouseId = id;
                    result.AreaSize    = Convert.ToInt32(list[1]);
                    result.EmployeeId  = Convert.ToInt32(list[2]);
                    result.PhoneNumber = list[3];
                }

                context.SaveChanges();
            }
        }
Пример #6
0
        public void InsertEmployee(List <string> list)
        {
            // insert
            using (var context = new MesEntities())
            {
                var orders = context.Set <Employee>();
                orders.Add(new Employee
                {
                    EmployeeId  = Convert.ToInt32(list[0]),
                    Name        = list[1],
                    Position    = list[2],
                    BossId      = Convert.ToInt32(list[3]),
                    Address     = list[4],
                    PhoneNumber = list[5],
                    Team        = list[6],
                    Password    = list[7]
                });

                context.SaveChanges();
            }
        }
Пример #7
0
        public void UpdateOrder(List <string> list)
        {
            int id    = Convert.ToInt32(list[0]);
            int rscId = Convert.ToInt32(list[1]);

            using (var context = new MesEntities())
            {
                var result = context.Orders.SingleOrDefault(x => x.OrderId == id);

                if (result != null)
                {
                    result.OrderId    = Convert.ToInt32(list[0]);
                    result.ResourceId = rscId;
                    result.Date       = Convert.ToDateTime(list[2]);
                    result.EmployeeId = Convert.ToInt32(list[3]);
                    result.Quantity   = Convert.ToInt32(list[4]);
                    result.SellerName = list[5];
                }

                context.SaveChanges();
            }
        }
Пример #8
0
        public void UpdateEmployee(List <string> list)
        {
            int id = Convert.ToInt32(list[0]);

            using (var context = new MesEntities())
            {
                var result = context.Employees.SingleOrDefault(x => x.EmployeeId == id);

                if (result != null)
                {
                    result.EmployeeId  = id;
                    result.Name        = list[1];
                    result.Position    = list[2];
                    result.BossId      = Convert.ToInt32(list[3]);
                    result.Address     = list[4];
                    result.PhoneNumber = list[5];
                    result.Team        = list[6];
                    result.Password    = list[7];
                }

                context.SaveChanges();
            }
        }