Ejemplo n.º 1
0
        /// <summary>
        /// 绑定列表
        /// </summary>
        private void RptBind()
        {
            BLL.wx_hotel_user          dcBll       = new BLL.wx_hotel_user();
            List <Model.wx_hotel_user> hotelAdmins = dcBll.GetModelList("hotelId=" + hotelid);

            BLL.manager managerBll = new BLL.manager();
            DataSet     dsData     = new DataSet();

            if (hotelAdmins.Any())
            {
                string strWhere = string.Empty;
                for (int index = 0; index <= hotelAdmins.Count - 1; index++)
                {
                    strWhere += "," + hotelAdmins[index].ManagerId;
                }

                strWhere = "(" + strWhere.Substring(1) + ")";

                dsData             = managerBll.GetList(0, "id in " + strWhere, string.Empty);
                rptList.DataSource = dsData;
            }
            else
            {
                rptList.DataSource = new List <Model.manager>();
            }

            rptList.DataBind();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 绑定列表
        /// </summary>
        private void RptBind()
        {
            BLL.wx_hotel_user dcBll = new BLL.wx_hotel_user();
            List<Model.wx_hotel_user> hotelAdmins = dcBll.GetModelList("hotelId=" + hotelid);

            BLL.manager managerBll = new BLL.manager();
            DataSet dsData = new DataSet();
            if (hotelAdmins.Any())
            {
                string strWhere = string.Empty;
                for (int index = 0; index <= hotelAdmins.Count - 1; index++)
                {
                    strWhere += "," + hotelAdmins[index].ManagerId;
                }

                strWhere = "(" + strWhere.Substring(1) + ")";

                dsData = managerBll.GetList(0, "id in " + strWhere, string.Empty);
                rptList.DataSource = dsData;
            }
            else
            {
                rptList.DataSource = new List<Model.manager>();
            }

            rptList.DataBind();
        }
Ejemplo n.º 3
0
        private bool IsHotelAdmin(int id)
        {
            BLL.wx_hotel_admin   dBll       = new BLL.wx_hotel_admin();
            Model.wx_hotel_admin hotelAdmin = dBll.GetModel(id);

            //酒店管理员
            if (hotelAdmin != null)
            {
                return(true);
            }

            BLL.wx_hotel_user   suBll     = new BLL.wx_hotel_user();
            Model.wx_hotel_user hotelUser = suBll.GetModel(id);

            if (hotelUser != null)
            {
                return(true);
            }

            return(false);
        }
Ejemplo n.º 4
0
        public int GetHotelId()
        {
            if (IsAdminLogin())
            {
                Model.manager        admin         = GetAdminInfo();
                BLL.wx_hotel_admin   hotelAdminBll = new BLL.wx_hotel_admin();
                Model.wx_hotel_admin hotelAdmin    = hotelAdminBll.GetModel(admin.id);
                if (hotelAdmin != null)
                {
                    return(hotelAdmin.HotelId);
                }

                BLL.wx_hotel_user   suBll     = new BLL.wx_hotel_user();
                Model.wx_hotel_user hotelUser = suBll.GetModel(admin.id);

                if (hotelUser != null)
                {
                    return(hotelUser.HotelId);
                }

                return(0);
            }
            return(0);
        }
Ejemplo n.º 5
0
        private bool DoAdd()
        {
            Model.manager adminEntity = GetAdminInfo(); //取得管理员信息

            Model.manager model = new Model.manager();
            BLL.manager   bll   = new BLL.manager();

            //固定为餐饮管理员的角色

            model.role_id   = int.Parse(ddlRoleId.SelectedValue);
            model.role_type = new BLL.manager_role().GetModel(model.role_id).role_type;

            model.is_lock = MyCommFun.Str2Int(rblIsLock.SelectedValue);
            //检测用户名是否重复
            if (bll.Exists(txtUserName.Text.Trim()))
            {
                return(false);
            }

            model.user_name = txtUserName.Text.Trim();
            //获得6位的salt加密字符串
            model.salt = Utils.GetCheckCode(6);
            //以随机生成的6位字符串做为密钥加密
            model.password   = DESEncrypt.Encrypt(txtPassword.Text.Trim(), model.salt);
            model.real_name  = txtRealName.Text.Trim();
            model.telephone  = txtTelephone.Text.Trim();
            model.email      = txtEmail.Text.Trim();
            model.add_time   = DateTime.Now;
            model.wxNum      = 0;
            model.agentId    = GetAdminInfo().id;
            model.qq         = string.Empty;
            model.email      = txtEmail.Text;
            model.reg_ip     = MXRequest.GetIP();
            model.agentLevel = -1;
            model.remark     = txtRemark.Text;
            model.agentId    = adminEntity.id;
            int addId = bll.Add(model);

            if (addId > 0)
            {
                //添加商铺与管理人员的关联
                BLL.wx_hotel_user   hotelUserBll = new BLL.wx_hotel_user();
                Model.wx_hotel_user hotelUser    = new Model.wx_hotel_user();
                hotelUser.ManagerId = addId;
                hotelUser.HotelId   = hotelid;
                hotelUser.AdminId   = GetAdminInfo().id;
                int addhotelAdminId = hotelUserBll.Add(hotelUser);

                if (addhotelAdminId <= 0)
                {
                    bll.Delete(addId);
                    addId = 0;
                }
            }

            if (addId > 0)
            {
                AddAdminLog(MXEnums.ActionEnum.Add.ToString(), "添加酒店管理员:" + model.user_name); //记录日志
                return(true);
            }
            return(false);
        }
Ejemplo n.º 6
0
        private bool DoAdd()
        {
            Model.manager adminEntity = GetAdminInfo(); //取得管理员信息

            Model.manager model = new Model.manager();
            BLL.manager bll = new BLL.manager();

            //固定为餐饮管理员的角色

            model.role_id = int.Parse(ddlRoleId.SelectedValue);
            model.role_type = new BLL.manager_role().GetModel(model.role_id).role_type;
            
            model.is_lock = MyCommFun.Str2Int(rblIsLock.SelectedValue);
            //检测用户名是否重复
            if (bll.Exists(txtUserName.Text.Trim()))
            {
                return false;
            }

            model.user_name = txtUserName.Text.Trim();
            //获得6位的salt加密字符串
            model.salt = Utils.GetCheckCode(6);
            //以随机生成的6位字符串做为密钥加密
            model.password = DESEncrypt.Encrypt(txtPassword.Text.Trim(), model.salt);
            model.real_name = txtRealName.Text.Trim();
            model.telephone = txtTelephone.Text.Trim();
            model.email = txtEmail.Text.Trim();
            model.add_time = DateTime.Now;
            model.wxNum = 0;
            model.agentId = GetAdminInfo().id;
            model.qq = string.Empty;
            model.email = txtEmail.Text;
            model.reg_ip = MXRequest.GetIP();
            model.agentLevel = -1;
            model.remark = txtRemark.Text;
            model.agentId = adminEntity.id;
            int addId = bll.Add(model);

            if (addId > 0)
            {
                //添加商铺与管理人员的关联
                BLL.wx_hotel_user hotelUserBll = new BLL.wx_hotel_user();
                Model.wx_hotel_user hotelUser = new Model.wx_hotel_user();
                hotelUser.ManagerId = addId;
                hotelUser.HotelId = hotelid;
                hotelUser.AdminId = GetAdminInfo().id;
                int addhotelAdminId = hotelUserBll.Add(hotelUser);

                if (addhotelAdminId <= 0)
                {
                    bll.Delete(addId);
                    addId = 0;
                }

            }

            if (addId > 0)
            {
                AddAdminLog(MXEnums.ActionEnum.Add.ToString(), "添加酒店管理员:" + model.user_name); //记录日志
                return true;
            }
            return false;
        }