Esempio n. 1
0
        public bool UserLogin(ref UserInfo user, ref string strError)
        {
            try
            {
                if (_db.UserLogin(ref user, ref strError))
                {
                    if (!string.IsNullOrEmpty(user.LoginIP))
                    {
                        _db.UpdateLoginTime(user);
                    }

                    UserGroup_Func       UGF      = new UserGroup_Func();
                    List <UserGroupInfo> lstGroup = new List <UserGroupInfo>();
                    if (UGF.GetUserGroupListByUser(ref lstGroup, user, false, null, ref strError))
                    {
                        user.lstUserGroup = lstGroup;
                    }

                    Menu_Func       MF      = new Menu_Func();
                    List <MenuInfo> lstMenu = new List <MenuInfo>();
                    if (MF.GetMenuListByUser(ref lstMenu, user, true, null, ref strError))
                    {
                        user.lstMenu = lstMenu;
                    }

                    Warehouse_Func       WHF          = new Warehouse_Func();
                    List <WarehouseInfo> lstWarehouse = new List <WarehouseInfo>();
                    if (WHF.GetWarehouseListByUser(ref lstWarehouse, user, false, null, ref strError))
                    {
                        user.lstWarehouse = lstWarehouse;
                    }

                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                Common_Func.IsSqlError(ex.Message, ref strError);
                return(false);
            }
        }
Esempio n. 2
0
        //UFSoft.U8.Framework.Login.UI.clsLogin netLogin = new UFSoft.U8.Framework.Login.UI.clsLogin();
        public string UserLoginForAndroid(string strUserJson)
        {
            UserInfo user     = new UserInfo();
            string   strError = string.Empty;

            try
            {
                user = JSONHelper.JsonToObject <UserInfo>(strUserJson);
                string password = user.Password;
                //user.Password = JiaMi(user.Password);
                //user.Password = netLogin.EnPassWord(user.Password);

                bool bResult = _db.UserLogin(ref user, ref strError);

                user.Password = password;

                if (bResult)
                {
                    //#region U8APILogin
                    //U8DAL.U8API.U8APICommon co = U8DAL.U8API.U8APICommon.GetU8APICommon();
                    //strError = co.errMsg;
                    //if (!string.IsNullOrEmpty(strError))
                    //{
                    //    user.Status = "E";
                    //    user.Message = strError;
                    //    return JSONHelper.ObjectToJson(user);
                    //}
                    //#endregion

                    if (!string.IsNullOrEmpty(user.LoginIP))
                    {
                        user.LoginTime = DateTime.Now;
                        _db.UpdateLoginTime(user);
                    }

                    user.Status     = "S";
                    user.LoginTime  = null;
                    user.CreateTime = null;
                    user.ModifyTime = null;

                    user.lstUserGroup = null;
                    //UserGroup_Func UGF = new UserGroup_Func();
                    //List<UserGroupInfo> lstGroup = new List<UserGroupInfo>();
                    //if (UGF.GetUserGroupListByUser(ref lstGroup, user, false,null, ref strError))
                    //{
                    //    user.lstUserGroup = lstGroup;
                    //}

                    Menu_Func       MF      = new Menu_Func();
                    List <MenuInfo> lstMenu = new List <MenuInfo>();
                    if (MF.GetMenuListByUser(ref lstMenu, user, false, null, ref strError))
                    {
                        user.lstMenu = lstMenu;
                    }

                    Warehouse_Func       WHF          = new Warehouse_Func();
                    List <WarehouseInfo> lstWarehouse = new List <WarehouseInfo>();
                    if (WHF.GetWarehouseListByUser(ref lstWarehouse, user, false, null, ref strError))
                    {
                        user.lstWarehouse = lstWarehouse;
                    }

                    return(JSONHelper.ObjectToJson(user));
                }
                else
                {
                    user.Status  = "E";
                    user.Message = strError;
                    return(JSONHelper.ObjectToJson(user));
                }
            }
            catch (Exception ex)
            {
                user.Status  = "E";
                user.Message = "Web异常:" + ex.Message + ex.StackTrace;
                if (Common_Func.IsSqlError(user.Message, ref strError))
                {
                    user.Message = strError;
                }
                return(JSONHelper.ObjectToJson(user));
            }
        }