Пример #1
0
        public ActionResult Home_Page()
        {
            UserInfo          user    = Common.Commom.ReadUserInfo();
            T_MENU_Func       tmfun   = new T_MENU_Func();
            List <T_MenuInfo> lstMenu = new List <T_MenuInfo>();

            if (tmfun.GetModelListBySql(user, ref lstMenu, true))
            {
                lstMenu = lstMenu.Where(t => t.MenuType == 1 && t.MenuStatus == 1 && t.IsChecked == true).ToList();
                var lstMenuParent = lstMenu.Where(t => t.ParentID == 0).OrderBy(t => t.NodeSort).ToList();

                foreach (var item in lstMenuParent)
                {
                    item.lstSubMenu = lstMenu.FindAll(t => t.ParentID == item.ID);
                }
                ViewData["lstMenu"] = lstMenuParent;
            }

            return(View());
        }
Пример #2
0
        public bool UserLogin(ref UserInfo user, ref string strError)
        {
            try
            {
                UserInfo model;
                User_DB  _db = new User_DB();
                DateTime CurrentTime;

                model = _db.GetModelBySql(user);

                if (model == null)
                {
                    int iSucc = _db.GetScalarBySql(user);
                    if (iSucc <= 0)
                    {
                        strError = "该用户不存在,请检查大小写是否输入正确!";
                        return(false);
                    }
                    else
                    {
                        strError = "密码输入错误,忘记密码请联系管理员重置!";
                        return(false);
                    }
                }

                CurrentTime = model.CurrentTime;

                if (model.UserStatus == 2)
                {
                    strError = string.Format("用户【{0}】已停用", model.UserName);
                    return(false);
                }

                if (model.IsDel == 2)
                {
                    strError = string.Format("用户【{0}】已删除", model.UserName);
                    return(false);
                }

                user = model;

                T_UserGroup_Func       ugf      = new T_UserGroup_Func();
                List <T_UserGroupInfo> lstGroup = new List <T_UserGroupInfo>();

                if (ugf.GetModelListBySql(user, ref lstGroup))
                {
                    user.lstUserGroup = lstGroup;
                }

                T_MENU_Func       tmfun   = new T_MENU_Func();
                List <T_MenuInfo> lstMenu = new List <T_MenuInfo>();

                if (tmfun.GetModelListBySql(user, ref lstMenu, true))
                {
                    //user.lstMenu = lstMenu.Where(t => t.MenuType <= 3).ToList();
                    lstMenu = lstMenu.Where(t => t.MenuType == 1 && t.MenuStatus == 1 && t.IsChecked == true).ToList();
                    var lstMenuParent = lstMenu.Where(t => t.ParentID == 0).OrderBy(t => t.NodeSort).ToList();

                    foreach (var item in lstMenuParent)
                    {
                        item.lstSubMenu = lstMenu.FindAll(t => t.ParentID == item.ID);
                    }
                    user.lstMenu = lstMenuParent;
                }

                T_WareHouse_Func       twfun        = new T_WareHouse_Func();
                List <T_WareHouseInfo> lstWarehouse = new List <T_WareHouseInfo>();
                if (twfun.GetModelListBySql(user, ref lstWarehouse))
                {
                    user.lstWarehouse = lstWarehouse;
                }

                return(true);
            }
            catch (Exception ex)
            {
                strError = ex.Message + ex.StackTrace;
                return(false);
            }
        }
Пример #3
0
        public string UserLoginADF(string UserJson)
        {
            BaseMessage_Model <UserInfo> messageModel = new BaseMessage_Model <UserInfo>();

            try
            {
                UserInfo model;
                User_DB  _db = new User_DB();
                DateTime CurrentTime;

                LogNet.LogInfo("UserLoginADF---" + UserJson);
                UserInfo user = BILBasic.JSONUtil.JSONHelper.JsonToObject <UserInfo>(UserJson);
                //UserInfo user = JsonConvert.DeserializeObject<UserInfo>(UserJson);

                model = _db.GetModelBySql(user);

                if (model == null)
                {
                    int iSucc = _db.GetScalarBySql(user);
                    if (iSucc <= 0)
                    {
                        messageModel.Message      = "该用户不存在,请检查大小写是否输入正确!";
                        messageModel.HeaderStatus = "E";
                        return(BILBasic.JSONUtil.JSONHelper.ObjectToJson <BaseMessage_Model <UserInfo> >(messageModel));
                    }
                    else
                    {
                        messageModel.Message      = "密码输入错误,忘记密码请联系管理员重置!";
                        messageModel.HeaderStatus = "E";
                        return(BILBasic.JSONUtil.JSONHelper.ObjectToJson <BaseMessage_Model <UserInfo> >(messageModel));
                    }
                }

                CurrentTime = model.CurrentTime;

                if (user.WarehouseID != -100)
                {
                    if (!model.WarehouseCode.Contains(user.WarehouseID.ToString()))
                    {
                        messageModel.Message      = "登录账户与所选仓库不一致!";
                        messageModel.HeaderStatus = "E";
                        return(BILBasic.JSONUtil.JSONHelper.ObjectToJson <BaseMessage_Model <UserInfo> >(messageModel));
                    }
                }


                if (model.UserStatus == 2)
                {
                    messageModel.Message      = string.Format("用户【{0}】已停用", model.UserName);
                    messageModel.HeaderStatus = "E";
                    return(BILBasic.JSONUtil.JSONHelper.ObjectToJson <BaseMessage_Model <UserInfo> >(messageModel));
                }

                if (model.IsDel == 2)
                {
                    messageModel.Message      = string.Format("用户【{0}】已删除", model.UserName);
                    messageModel.HeaderStatus = "E";
                    return(BILBasic.JSONUtil.JSONHelper.ObjectToJson <BaseMessage_Model <UserInfo> >(messageModel));
                }

                model.WarehouseID = user.WarehouseID;
                user = model;

                T_UserGroup_Func       ugf      = new T_UserGroup_Func();
                List <T_UserGroupInfo> lstGroup = new List <T_UserGroupInfo>();

                if (ugf.GetModelListBySql(user, ref lstGroup))
                {
                    user.lstUserGroup = lstGroup;
                }

                //暂时屏蔽
                T_MENU_Func       tmfun   = new T_MENU_Func();
                List <T_MenuInfo> lstMenu = new List <T_MenuInfo>();

                if (tmfun.GetModelListBySql(user, ref lstMenu, false))
                {
                    user.lstMenu = lstMenu.Where(t => t.MenuType == 4).ToList();
                }

                //根据用户配置的仓库ID,获取对应的收货,发货库位
                T_Area_Func       tafun   = new T_Area_Func();
                List <T_AreaInfo> lstArea = new List <T_AreaInfo>();

                if (tafun.GetModelListBySql(user.WarehouseID, ref lstArea))
                {
                    T_AreaInfo areaInfo = new T_AreaInfo();
                    //查找收货待检库位
                    areaInfo = lstArea.Find(t => t.AreaType == 2);
                    if (areaInfo != null)
                    {
                        user.ReceiveHouseID       = areaInfo.HouseID;
                        user.ReceiveAreaID        = areaInfo.ID;
                        user.ReceiveAreaNo        = areaInfo.AreaNo;
                        user.ReceiveWareHouseNo   = areaInfo.WarehouseNo;
                        user.ReceiveHouseNo       = areaInfo.HouseNo;
                        user.ReceiveWareHouseName = areaInfo.WarehouseName;
                        user.QuanUserNo           = areaInfo.QuanUserNo;
                        user.QuanUserName         = areaInfo.QuanUserName;
                        //user.lstQuanUser = _db.GetQuanUser(user.QuanUserNo);
                    }

                    //查找拣货临时库位
                    areaInfo = lstArea.Find(t => t.AreaType == 3);
                    if (areaInfo != null)
                    {
                        user.PickHouseID       = areaInfo.HouseID;
                        user.PickAreaID        = areaInfo.ID;
                        user.PickWareHouseID   = areaInfo.WarehouseID;
                        user.PickAreaNo        = areaInfo.AreaNo;
                        user.PickWareHouseNo   = areaInfo.WarehouseNo;
                        user.PickHouseNo       = areaInfo.HouseNo;
                        user.PickWareHouseName = areaInfo.WarehouseName;
                    }

                    areaInfo = lstArea.Find(t => t.AreaType == 4);
                    if (areaInfo != null)
                    {
                        user.ToSampWareHouseNo = areaInfo.WarehouseNo;
                        user.ToSampAreaNo      = areaInfo.AreaNo;
                    }
                }

                //T_WareHouse_Func twfun = new T_WareHouse_Func();
                //List<T_WareHouseInfo> lstWarehouse = new List<T_WareHouseInfo>();
                //if (twfun.GetModelListBySql(user, ref lstWarehouse))
                //{
                //    user.lstWarehouse = lstWarehouse;
                //}

                messageModel.Message      = "登录成功!";
                messageModel.HeaderStatus = "S";
                messageModel.ModelJson    = user;
                return(BILBasic.JSONUtil.JSONHelper.ObjectToJson <BaseMessage_Model <UserInfo> >(messageModel));


                //return JsonConvert.SerializeObject(messageModel);
            }
            catch (Exception ex)
            {
                messageModel.Message      = ex.Message;
                messageModel.HeaderStatus = "E";
                return(BILBasic.JSONUtil.JSONHelper.ObjectToJson <BaseMessage_Model <UserInfo> >(messageModel));
            }
        }
Пример #4
0
        public bool SaveT_UserGroupMenu(UserInfo user, T_MenuInfo t_Menu, int UserGroupID, ref string strError)
        {
            T_MENU_Func tfunc = new T_MENU_Func();

            return(tfunc.SaveUserGroupMenuToDB(user, t_Menu, UserGroupID, ref strError));
        }
Пример #5
0
        public bool UpdateT_MenuStatus(UserInfo user, ref T_MenuInfo t_menu, int NewStatus, ref string strError)
        {
            T_MENU_Func tfunc = new T_MENU_Func();

            return(tfunc.UpdateModelStatus(user, ref t_menu, NewStatus, ref strError));
        }
Пример #6
0
        public bool GetMenuListByUserGroupID(ref List <T_MenuInfo> modelList, ref string strError, int UserGroupID, bool IncludNoCheck = true)
        {
            T_MENU_Func tfunc = new T_MENU_Func();

            return(tfunc.GetMenuListByUserGroupID(ref modelList, ref strError, UserGroupID, IncludNoCheck));
        }
Пример #7
0
        public bool GetAllT_MenuByHeaderID(ref List <T_MenuInfo> modelList, int headerID, ref string strError)
        {
            T_MENU_Func tfunc = new T_MENU_Func();

            return(tfunc.GetModelListByHeaderID(ref modelList, headerID, ref strError));
        }
Пример #8
0
        public bool GetT_MenuListByPage(ref List <T_MenuInfo> modelList, UserInfo user, T_MenuInfo t_menu, ref DividPage page, ref string strError)
        {
            T_MENU_Func tfunc = new T_MENU_Func();

            return(tfunc.GetModelListByPage(ref modelList, user, t_menu, ref page, ref strError));
        }
Пример #9
0
        public bool GetT_MenuByID(ref T_MenuInfo model, ref string strError)
        {
            T_MENU_Func tfunc = new T_MENU_Func();

            return(tfunc.GetModelByID(ref model, ref strError));
        }
Пример #10
0
        public bool DeleteT_MenuByModel(UserInfo user, T_MenuInfo model, ref string strError)
        {
            T_MENU_Func tfunc = new T_MENU_Func();

            return(tfunc.DeleteModelByModel(user, model, ref strError));
        }
Пример #11
0
        public bool SaveT_Menu(UserInfo user, ref T_MenuInfo t_menu, ref string strError)
        {
            T_MENU_Func tfunc = new T_MENU_Func();

            return(tfunc.SaveModelToDB(user, ref t_menu, ref strError));
        }