Exemplo n.º 1
0
 public static void Set_ListWareHouse_ByUser(decimal p_user_id, decimal User_Type)
 {
     try
     {
         User_WareHose_BL      _User_Custom_BL = new User_WareHose_BL();
         List <WareHouse_Info> _lst_W          = _User_Custom_BL.WareHouse_GetByUser(p_user_id, User_Type);
         SessionData.SetDataSession(NaviCommon.SystemParaKey.c_dic_USER_OF_WAREHOUSE + "_" + p_user_id.ToString(), _lst_W);
     }
     catch (Exception ex)
     {
         NaviCommon.Common.log.Error(ex.ToString());
     }
 }
Exemplo n.º 2
0
        public ActionResult User_WareHouse_List()
        {
            try
            {
                string _url = "/ModuleUser/User/UserList";
                string _ok  = CommonFunc.Nvs_Redirect_QuyenTruyCapUser(_url);
                if (_ok != "")
                {
                    return(Redirect(_ok));
                }

                decimal _user_id = 0;
                if (RouteData.Values["id"] != null)
                {
                    _user_id = Convert.ToDecimal(RouteData.Values["id"].ToString());
                }
                User_Info _userinfo = new User_Info();

                // lấy toàn bộ danh sách kho lên
                List <WareHouse_Info> _lstWareHouse = WareHouse_BL.WareHouse_GetAll();

                UserInfo_BL _UserInfo_BL = new UserInfo_BL();
                _userinfo = _UserInfo_BL.UserInfo_GetById(_user_id);

                // lấy các kho của user
                User_WareHose_BL      _User_WareHose_BL = new User_WareHose_BL();
                List <WareHouse_Info> _lst_UsWareHouse  = _User_WareHose_BL.WareHouse_GetByUser_Auz(_userinfo.User_Id);

                Hashtable _hs = new Hashtable();
                foreach (WareHouse_Info item in _lst_UsWareHouse)
                {
                    _hs[item.WareHouse_Id] = item;
                }

                // 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
                string _KeySession = "";
                ViewBag.KeySessionOnTab = _KeySession;
                Session["SessionListPackage" + _KeySession]          = _lstWareHouse;//Toàn bộ Kho
                Session["SessionListPackageException" + _KeySession] = _hs;
                ViewBag.UserName    = _userinfo.User_Name;
                ViewBag.User_id     = _userinfo.User_Id;
                ViewBag.List        = _lstWareHouse;
                ViewBag.HsException = _hs;
                return(View());
            }
            catch (Exception ex)
            {
                NaviCommon.Common.log.Error(ex.ToString());
                return(View());
            }
        }
Exemplo n.º 3
0
        public static void Set_ListWareHouse_AuzByUser(decimal p_user_id)
        {
            try
            {
                User_WareHose_BL             _User_Custom_BL    = new User_WareHose_BL();
                List <User_WareHose_Info>    _lst               = _User_Custom_BL.User_WareHouse_GetByUser_Auz(p_user_id);
                Dictionary <decimal, string> _dic_custom_byUser = new Dictionary <decimal, string>();
                foreach (User_WareHose_Info item in _lst)
                {
                    _dic_custom_byUser[item.WareHouse_Id] = item.WareHouse_Name;
                }

                SessionData.SetDataSession(NaviCommon.SystemParaKey.c_dic_USER_WAREHOUSE + "_" + p_user_id.ToString(), _dic_custom_byUser);
            }
            catch (Exception ex)
            {
                NaviCommon.Common.log.Error(ex.ToString());
            }
        }
Exemplo n.º 4
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 }));
     }
 }