Esempio n. 1
0
        /// <summary>
        /// 编辑用户
        /// 20141124 未考虑用户同意(拒绝)的功能
        /// </summary>
        public void User_Edit()
        {
            int id = RequestTool.RequestInt("id", 0);
            Lebi_Supplier_User model = B_Lebi_Supplier_User.GetModel("Supplier_id=" + CurrentSupplier.id + " and id =" + id);

            if (model == null)
            {
                if (!Power("supplier_user_add", "添加用户"))
                {
                    AjaxNoPower();
                    return;
                }
                model = new Lebi_Supplier_User();
            }
            else
            {
                if (!Power("supplier_user_edit", "编辑用户"))
                {
                    AjaxNoPower();
                    return;
                }
            }
            string UserName = RequestTool.RequestSafeString("UserName");

            B_Lebi_Supplier_User.SafeBindForm(model);
            if (model.id == 0)
            {
                Lebi_User user = B_Lebi_User.GetModel("UserName=lbsql{'" + UserName + "'}");
                if (user == null)
                {
                    Response.Write("{\"msg\":\"" + Tag("用户不存在") + "\"}");
                    return;
                }
                int count = B_Lebi_Supplier_User.Counts("User_id=" + user.id + " and Supplier_id=" + CurrentSupplier.id + "");
                if (count > 0)
                {
                    Response.Write("{\"msg\":\"" + Tag("不能重复添加") + "\"}");
                    return;
                }
                model.User_id     = user.id;
                model.Supplier_id = CurrentSupplier.id;
                B_Lebi_Supplier_User.Add(model);
                model.id = B_Lebi_Supplier_User.GetMaxId();
                Log.Add("添加用户", "Supplier_User", model.id.ToString(), CurrentSupplier, "用户:" + CurrentUser.UserName);
            }
            else
            {
                if (model.User_id == CurrentSupplier.User_id)
                {
                    model.Type_id_SupplierUserStatus = 9011;//不能锁定所有者
                }
                B_Lebi_Supplier_User.Update(model);
                Log.Add("编辑用户", "Supplier_User", model.id.ToString(), CurrentSupplier, "用户:" + CurrentUser.UserName);
            }
            Response.Write("{\"msg\":\"OK\",\"id\":\"" + model.id + "\"}");
        }
Esempio n. 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Power("supplier_user_list", "用户列表"))
            {
                PageReturnMsg = PageNoPowerMsg();
            }
            PageSize     = RequestTool.getpageSize(25);
            key          = RequestTool.RequestString("key");
            status       = RequestTool.RequestInt("status", 0);
            string where = "Supplier_id=" + CurrentSupplier.id;
            if (key != "")
            {
                where += " and Name like lbsql{'%" + key + "%'}";
            }
            if (status > 0)
            {
                where += " and Type_id_SupplierUserStatus=" + status;
            }
            models = B_Lebi_Supplier_User.GetList(where, "", PageSize, page);
            int recordCount = B_Lebi_Supplier_User.Counts(where);

            PageString = Shop.Bussiness.Pager.GetPaginationString("?page={0}&status=" + status + "&key=" + key, page, PageSize, recordCount);
        }