Example #1
0
        /// <summary>
        /// 根据账号密码获取信息
        /// </summary>
        /// <param name="loginname">账号</param>
        /// <param name="pwd">密码</param>
        /// <returns></returns>
        public static M_Users GetM_UserByUserName(string loginname, string pwd, string operateip)
        {
            pwd = ProBusiness.Encrypt.GetEncryptPwd(pwd, loginname);
            DataTable dt    = new M_UsersDAL().GetM_UserByUserName(loginname, pwd);
            M_Users   model = null;

            if (dt.Rows.Count > 0)
            {
                model = new M_Users();
                model.FillData(dt.Rows[0]);
                if (!string.IsNullOrEmpty(model.RoleID))
                {
                    model.Role = ManageSystemBusiness.GetRoleByID(model.RoleID);
                }
                //权限
                if (model.Role != null && model.Role.IsDefault == 1)
                {
                    model.Menus = CommonBusiness.ClientMenus;
                }
                else if (model.IsAdmin == 1)
                {
                    model.Menus = CommonBusiness.ClientMenus;
                }
                else
                {
                    model.Menus = model.Role.Menus;
                }
            }
            return(model);
        }
Example #2
0
        public static List <M_Users> GetUsersRelationList(int pageSize, int pageIndex, ref int totalCount, ref int pageCount, string userid, int type = -1, int status = -1, string keyWords = "", string colmonasc = "a.AutoID", bool isasc = false,
                                                          string rebatemin = "", string rebatemax = "", string accountmin = "", string accountmax = "", bool myselft = false)
        {
            string whereSql = " where a.layers>0 and a.Status<>9  ";

            if (!string.IsNullOrEmpty(rebatemax))
            {
                whereSql += " and a.Rebate<='" + rebatemax + "' ";
            }
            if (!string.IsNullOrEmpty(rebatemin))
            {
                whereSql += " and a.Rebate>'" + rebatemin + "' ";
            }
            if (type > -1)
            {
                whereSql += " and a.type=" + type + " ";
            }
            if (!string.IsNullOrEmpty(accountmax))
            {
                whereSql += " and b.AccountFee<='" + accountmax + "' ";
            }
            if (!string.IsNullOrEmpty(accountmin))
            {
                whereSql += " and b.AccountFee>'" + accountmin + "' ";
            }
            if (status > -1)
            {
                whereSql += " and a.Status=" + status;
            }
            if (!string.IsNullOrEmpty(keyWords))
            {
                whereSql += " and (a.UserName like '%" + keyWords + "%' or a.LoginName like'%" + keyWords + "%') ";
            }
            string orswhere = "";

            if (!string.IsNullOrEmpty(userid))
            {
                orswhere = " and ( c.ParentID='" + userid + "' " + (myselft ? " or a.userid='" + userid + "'" : "") + " ) ";;
            }

            string         clumstr = " select  a.*,b.AccountFee  from M_Users a join UserAccount b on a.UserID=b.Userid join UserRelation c on a.UserID=c.UserID  " + orswhere + " " + whereSql;
            DataTable      dt      = M_UsersDAL.GetDataTable(clumstr);
            List <M_Users> list    = new List <M_Users>();
            M_Users        model;

            foreach (DataRow item in dt.Rows)
            {
                model = new M_Users();
                model.FillData(item);
                list.Add(model);
            }

            return(list);
        }
Example #3
0
        public static Product GetProductDetail(int id)
        {
            DataTable dt = M_UsersDAL.GetDataTable("select  *  from products where autoid=" + id);
            Product   pt = new Product();

            foreach (DataRow row in dt.Rows)
            {
                pt.FillData(row);
            }
            return(pt);
        }
Example #4
0
        public static UserAccount GetUserAccount(string id)
        {
            string      clumstr = " select a.*  from UserAccount a where  a.UserID='" + id + "'";
            DataTable   dt      = M_UsersDAL.GetDataTable(clumstr);
            UserAccount model   = new UserAccount();

            foreach (DataRow item in dt.Rows)
            {
                model.FillData(item);
            }
            return(model);
        }
Example #5
0
        /// <summary>
        /// 根据账号密码获取信息(登录)
        /// </summary>
        /// <param name="loginname">账号</param>
        /// <returns></returns>
        public static M_Users GetM_UserByUserName(string loginname)
        {
            DataTable dt    = new M_UsersDAL().GetM_UserByLoginName(loginname);
            M_Users   model = null;

            if (dt.Rows.Count > 0)
            {
                model = new M_Users();
                model.FillData(dt.Rows[0]);
            }
            return(model);
        }
Example #6
0
        public static M_UserRelation GetParentByChildID(string childID)
        {
            string    clumstr = " select  c.*,a.UserName  from M_Users a join UserRelation c on a.UserID=c.UserID and  c.UserID='" + childID + "' where a.Status<>9";
            DataTable dt      = M_UsersDAL.GetDataTable(clumstr);

            M_UserRelation model = new M_UserRelation();

            foreach (DataRow item in dt.Rows)
            {
                model.FillData(item);
            }

            return(model);
        }
Example #7
0
        public static M_Users GetUserDetailByLoginName(string loginName)
        {
            DataTable dt = M_UsersDAL.GetDataTable("select *  from M_Users where Status<>9 and LoginName='" + loginName + "'");

            M_Users model = null;

            if (dt.Rows.Count == 1)
            {
                model = new M_Users();
                model.FillData(dt.Rows[0]);
            }

            return(model);
        }
Example #8
0
        public static List <M_UserRelation> GetUsersListByParent(string parentid)
        {
            string                clumstr = " select  c.*,a.UserName  from M_Users a join UserRelation c on a.UserID=c.UserID and  c.ParentID='" + parentid + "' where a.layers>0 and a.Status<>9";
            DataTable             dt      = M_UsersDAL.GetDataTable(clumstr);
            List <M_UserRelation> list    = new List <M_UserRelation>();
            M_UserRelation        model;

            foreach (DataRow item in dt.Rows)
            {
                model = new M_UserRelation();
                model.FillData(item);
                list.Add(model);
            }

            return(list);
        }
Example #9
0
        public static List <M_Users> GetUsersRelationList(string userid, bool myselft = false)
        {
            string         whereSql = myselft ? " or a.userid='" + userid + "'" : "";
            string         clumstr  = " select  a.*  from M_Users a join UserRelation c on a.UserID=c.UserID and ( c.ParentID='" + userid + "' " + whereSql + "  ) where a.layers>0 and a.Status<>9";
            DataTable      dt       = M_UsersDAL.GetDataTable(clumstr);
            List <M_Users> list     = new List <M_Users>();
            M_Users        model;

            foreach (DataRow item in dt.Rows)
            {
                model = new M_Users();
                model.FillData(item);
                list.Add(model);
            }

            return(list);
        }
Example #10
0
        /// <summary>
        /// 根据账号密码获取信息(登录)
        /// </summary>
        /// <param name="loginname">账号</param>
        /// <param name="pwd">密码</param>
        /// <returns></returns>
        public static M_Users GetM_UserByUserName(string loginname, string pwd, string operateip)
        {
            pwd = CloudSalesTool.Encrypt.GetEncryptPwd(pwd);
            DataTable dt    = new M_UsersDAL().GetM_UserByUserName(loginname, pwd);
            M_Users   model = null;

            if (dt.Rows.Count > 0)
            {
                model = new M_Users();
                model.FillData(dt.Rows[0]);
            }

            //记录登录日志
            LogBusiness.AddLoginLog(loginname, model != null, CloudSalesEnum.EnumSystemType.Manage, operateip);

            return(model);
        }
Example #11
0
        /// <summary>
        /// 根据账号密码获取信息(登录)
        /// </summary>
        /// <param name="loginname"></param>
        /// <param name="pwd"></param>
        /// <param name="operateip"></param>
        /// <param name="result"></param>
        /// <returns></returns>
        public static M_Users GetM_UserByProUserName(string loginname, string pwd, string operateip, out int result, EnumUserOperateType type = EnumUserOperateType.Login, int sourceType = 0)
        {
            pwd = ProBusiness.Encrypt.GetEncryptPwd(pwd, loginname);
            DataSet ds    = new M_UsersDAL().GetM_UserByProUserName(loginname, pwd, sourceType, out result);
            M_Users model = null;

            if (ds.Tables.Contains("M_User") && ds.Tables["M_User"].Rows.Count > 0)
            {
                model = new M_Users();
                model.FillData(ds.Tables["M_User"].Rows[0]);
                if (!string.IsNullOrEmpty(model.RoleID))
                {
                    model.Role = ManageSystemBusiness.GetRoleByIDCache(model.RoleID);
                }
                //权限
                if (model.Role != null && model.Role.IsDefault == 1)
                {
                    model.Menus = CommonBusiness.ManageMenus;
                }
                else if (model.IsAdmin == 1)
                {
                    model.Menus = CommonBusiness.ManageMenus;
                }
                else
                {
                    model.Menus = new List <Menu>();
                    foreach (DataRow dr in ds.Tables["Permission"].Rows)
                    {
                        Menu menu = new Menu();
                        menu.FillData(dr);
                        model.Menus.Add(menu);
                    }
                }
            }
            if (model != null && model.Status == 1)
            {
                LogBusiness.AddLoginLog(loginname, operateip, model != null ? model.UserID : "", type);
                LogBusiness.UpdateLastIP(model != null ? model.UserID : "", operateip);
            }
            return(model);
        }
Example #12
0
        /// <summary>
        /// 根据账号密码获取信息(登录)
        /// </summary>
        /// <param name="loginname"></param>
        /// <param name="pwd"></param>
        /// <param name="operateip"></param>
        /// <param name="result"></param>
        /// <returns></returns>
        public static M_Users GetM_UserByProUserName(string loginname, string pwd, string operateip, out int result)
        {
            pwd = CloudSalesTool.Encrypt.GetEncryptPwd(pwd, loginname);
            DataSet ds    = new M_UsersDAL().GetM_UserByProUserName(loginname, pwd, out result);
            M_Users model = null;

            if (ds.Tables.Contains("M_User") && ds.Tables["M_User"].Rows.Count > 0)
            {
                model = new M_Users();
                model.FillData(ds.Tables["M_User"].Rows[0]);
                if (!string.IsNullOrEmpty(model.RoleID))
                {
                    model.Role = ManageSystemBusiness.GetRoleByIDCache(model.RoleID);
                }
                //权限
                if (model.Role != null && model.Role.IsDefault == 1)
                {
                    model.Menus = CommonBusiness.ManageMenus;
                }
                else if (model.IsAdmin == 1)
                {
                    model.Menus = CommonBusiness.ManageMenus;
                }
                else
                {
                    model.Menus = new List <Menu>();
                    foreach (DataRow dr in ds.Tables["Permission"].Rows)
                    {
                        Menu menu = new Menu();
                        menu.FillData(dr);
                        model.Menus.Add(menu);
                    }
                }
            }
            //记录登录日志
            LogBusiness.AddLoginLog(loginname, model != null, IntFactoryEnum.EnumSystemType.Manage, operateip, "", "");

            return(model);
        }
Example #13
0
        public static int GetM_UserCountByLoginName(string loginname)
        {
            DataTable dt = new M_UsersDAL().GetM_UserByLoginName(loginname);

            return(dt.Rows.Count);
        }