public void Edit() { using (var ctx = new SPWEntities()) { var obj = ctx.USER.Where(x => x.USER_ID == _item.USER_ID).FirstOrDefault(); obj.USER_NAME = _item.USER_NAME; obj.PASSWORD = _item.PASSWORD; obj.EMPLOYEE_ID = _item.EMPLOYEE_ID; obj.UPDATE_DATE = _item.UPDATE_DATE; obj.UPDATE_EMPLOYEE_ID = _item.UPDATE_EMPLOYEE_ID; ctx.SaveChanges(); } }
public void Del(int id) { using (var ctx = new SPWEntities()) { PRODUCT_COLOR item = ctx.PRODUCT_COLOR.Where(x => x.PRODUCT_COLOR_ID == id).FirstOrDefault(); if (item != null) { ctx.PRODUCT_COLOR.Remove(item); } ctx.SaveChanges(); } }
public void AddList() { using (var ctx = new SPWEntities()) { foreach (var item in _lstItem) { if (item.Action == ActionEnum.Create) { ctx.ZONE.Add(item); } } ctx.SaveChanges(); } }
public void Edit() { using (var ctx = new SPWEntities()) { var obj = ctx.EMPLOYEE.Where(x => x.EMPLOYEE_ID == _item.EMPLOYEE_ID).FirstOrDefault(); obj.EMPLOYEE_NAME = _item.EMPLOYEE_NAME; obj.EMPLOYEE_SURNAME = _item.EMPLOYEE_SURNAME; obj.EMPLOYEE_CODE = _item.EMPLOYEE_CODE; obj.DEPARTMENT_ID = _item.DEPARTMENT_ID; obj.UPDATE_DATE = _item.UPDATE_DATE; obj.UPDATE_EMPLOYEE_ID = _item.UPDATE_EMPLOYEE_ID; ctx.SaveChanges(); } }
public void UpdateList() { using (var ctx = new SPWEntities()) { foreach (var item in _lstItem) { var obj = ctx.ORDER_DETAIL.Where(x => x.ORDER_DETAIL_ID == item.ORDER_DETAIL_ID).FirstOrDefault(); if (obj != null) { obj.PRODUCT_SEND_QTY = item.PRODUCT_SEND_QTY; obj.UPDATE_DATE = item.UPDATE_DATE; obj.UPDATE_EMPLOYEE_ID = item.UPDATE_EMPLOYEE_ID; } } ctx.SaveChanges(); } }
public void Delete() { using (var ctx = new SPWEntities()) { foreach (var item in _lstItem) { if (item.Action == ActionEnum.Delete) { var obj = ctx.EMPLOYEE.Where(x => x.EMPLOYEE_ID == item.EMPLOYEE_ID).FirstOrDefault(); if (obj != null) { ctx.EMPLOYEE.Remove(obj); } } } ctx.SaveChanges(); } }
public void Edit(PRODUCT_PROMOTION item) { using (var ctx = new SPWEntities()) { if (item.Action == ActionEnum.Update) { var obj = ctx.PRODUCT_PROMOTION.Where(x => x.PROMOTION_ID == item.PROMOTION_ID).FirstOrDefault(); if (obj != null) { obj.PRODUCT_CONDITION_QTY = item.PRODUCT_CONDITION_QTY; obj.PRODUCT_FREE_QTY = item.PRODUCT_FREE_QTY; obj.ZONE_ID = item.ZONE_ID; obj.UPDATE_DATE = item.UPDATE_DATE; obj.UPDATE_EMPLOYEE_ID = item.UPDATE_EMPLOYEE_ID; } } ctx.SaveChanges(); } }
public void EditList() { using (var ctx = new SPWEntities()) { foreach (var item in _lstItem) { if (item.Action == ActionEnum.Update) { var obj = ctx.ZONE.Where(x => x.ZONE_ID == item.ZONE_ID).FirstOrDefault(); if (obj != null) { obj.ZONE_CODE = _item.ZONE_CODE; obj.ZONE_NAME = _item.ZONE_NAME; obj.UPDATE_DATE = item.UPDATE_DATE; obj.UPDATE_EMPLOYEE_ID = item.UPDATE_EMPLOYEE_ID; } } } ctx.SaveChanges(); } }
public void AddUpdateList() { using (var ctx = new SPWEntities()) { foreach (var item in _lstItem) { if (item.Action == ActionEnum.Create) { ctx.PRODUCT_DETAIL.Add(item); } else if (item.Action == ActionEnum.Update) { var obj = ctx.PRODUCT_DETAIL.Where(x => x.PRODUCT_ID == item.PRODUCT_ID && x.ZONE_ID == item.ZONE_ID).FirstOrDefault(); if (obj != null) { obj.PRODUCT_PRICE = item.PRODUCT_PRICE; obj.UPDATE_DATE = item.UPDATE_DATE; obj.UPDATE_EMPLOYEE_ID = item.UPDATE_EMPLOYEE_ID; } } } ctx.SaveChanges(); } }