예제 #1
0
 public ActionResult UserWareHouseInsert(decimal p_user_id, string p_list_warehouse)
 {
     try
     {
         decimal                   _rel           = 1;
         User_WareHose_BL          _objbl         = new User_WareHose_BL();
         string[]                  _ListIdpackWH  = p_list_warehouse.Split('|');
         List <User_WareHose_Info> _lstUserCustom = new List <User_WareHose_Info>();
         foreach (string _item in _ListIdpackWH)
         {
             if (!string.IsNullOrEmpty(_item))
             {
                 User_WareHose_Info _temp = new User_WareHose_Info();
                 _temp.User_Id      = p_user_id;
                 _temp.WareHouse_Id = Convert.ToDecimal(_item);
                 _temp.Created_By   = SessionData.CurrentUser.User_Name;
                 _temp.Created_Date = DateTime.Now;
                 _lstUserCustom.Add(_temp);
             }
         }
         //xóa trước
         _rel = _objbl.WareHouse_DeleteByUser(p_user_id);
         if (_rel > 0)// xóa thnahf công mới insert
         {
             _objbl.User_WareHouse_Insert_Batch(_lstUserCustom);
             //string _KeySession = SessionData.InnitSession();
             string _KeySession = "";// tạm thời để _KeySession = trống, sau này phải sinh ra để test trên các tab cùng trình duyệt
             Session["SessionListPackage" + _KeySession]          = null;
             Session["SessionListPackageException" + _KeySession] = null;
             return(Json(new { success = true }));
         }
         else
         {
             return(Json(new { success = false }));
         }
     }
     catch (Exception ex)
     {
         NaviCommon.Common.log.Error(ex.ToString());
         return(Json(new { success = false }));
     }
 }
예제 #2
0
        public bool User_WareHouse_Insert_Batch(List <User_WareHose_Info> p_lst)
        {
            try
            {
                int _count = p_lst.Count;

                for (int i = 0; i < _count; i++)
                {
                    User_WareHose_Info item = p_lst[i];
                    bool _ck = CommonData.c_serviceWCF.User_WareHouse_Insert(item.User_Id, item.WareHouse_Id, item.Created_By, item.Created_Date);
                    if (_ck == false)
                    {
                        return(false);
                    }
                }

                return(true);
            }
            catch (Exception ex)
            {
                NaviCommon.Common.log.Error(ex.ToString());
                return(false);
            }
        }