Ejemplo n.º 1
0
 private string DoEdit(int _id)
 {
     try
     {
         BLL.department   bll   = new BLL.department();
         Model.department model = bll.GetModel(_id);
         manager = GetAdminInfo();
         string content = string.Empty;
         model.de_type     = string.IsNullOrEmpty(ddltype.SelectedValue) ? (byte)0 : Utils.ObjToByte(ddltype.SelectedValue);
         model.de_parentid = int.Parse(ddlParentId.SelectedValue);
         if (model.de_name != txtTitle.Text.Trim())
         {
             content += "机构名称:" + model.de_name + "→<font color='red'>" + txtTitle.Text.Trim() + "</font><br/>";
         }
         model.de_name = txtTitle.Text.Trim();
         if (model.de_isUse != cbIsUse.Checked)
         {
             content += "状态:" + Common.BusinessDict.isUseStatus(1)[model.de_isUse] + "→<font color='red'>" + Common.BusinessDict.isUseStatus(1)[cbIsUse.Checked] + "</font>";
         }
         model.de_isUse = cbIsUse.Checked;
         model.de_sort  = Convert.ToInt32(txtSortId.Text.Trim());
         return(bll.Update(model, content, manager.user_name, manager.real_name));
     }
     catch (Exception e)
     {
         return(e.Message);
     }
 }
Ejemplo n.º 2
0
        private void ShowInfo(int _id)
        {
            BLL.department   bll   = new BLL.department();
            Model.department model = bll.GetModel(_id);

            ddlParentId.SelectedValue = model.parent_id.ToString();
            txtSortId.Text            = model.sort_id.ToString();
            if (model.is_lock == 1)
            {
                cbIsLock.Checked = true;
            }

            txtTitle.Text = model.department_name;
            txtTitle.Attributes.Add("ajaxurl", "../../tools/admin_ajax.ashx?action=department_validate&old_name=" + Utils.UrlEncode(model.department_name));
            txtTitle.Focus(); //设置焦点,防止JS无法提交
            if (model.is_sys == 1)
            {
                ddlParentId.Enabled = false;
                txtTitle.ReadOnly   = true;
            }
            txtRemark.Text = model.remark;

            this.page = DTRequest.GetQueryInt("page", 1);
            //txtKeywords.Text = this.keywords;
            BLL.manager bllManager = new BLL.manager();
            this.rptList.DataSource = bllManager.GetList(this.pageSize, this.page, "department_id=" + _id + "", "add_time asc,id desc", out this.totalCount);
            this.rptList.DataBind();

            //绑定页码
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("department_edit.aspx", "page={0}&action={1}&id={2}", "__id__", "pagedepartment", _id.ToString());

            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
Ejemplo n.º 3
0
        private void ShowInfo(int _id)
        {
            BLL.department   bll   = new BLL.department();
            Model.department model = bll.GetModel(_id);

            TreeBind();
            ddlParentId.SelectedValue = model.de_parentid.ToString();
            string _treeText = string.Empty, _treeid = string.Empty;

            bll.getDepartText(_id, out _treeText, out _treeid, out string area);
            labDepartText.Text = _treeText;
            initData();
            ddltype.SelectedValue = model.de_type.ToString();
            txtSortId.Text        = model.de_sort.ToString();
            txtTitle.Text         = model.de_name;
            txtSubTitle.Text      = model.de_subname;
            txtArea.Text          = model.de_area;
            isgroupDiv.Visible    = false;
            if (model.de_isGroup.Value)
            {
                labIsGroup.Text   = "是";
                cbIsGroup.Checked = true;
            }
            else
            {
                labIsGroup.Text   = "否";
                cbIsGroup.Checked = false;
            }
            if (model.de_isUse.Value)
            {
                cbIsUse.Checked = true;
            }
            else
            {
                cbIsUse.Checked = false;
            }
            if (model.de_type == 2 || model.de_type == 3)
            {
                dlsubtitle.Visible = false;
                dlarea.Visible     = false;
                dlgroup.Visible    = false;
            }
            txtSubTitle.Enabled = false;
            txtArea.Enabled     = false;
            ddlParentId.Enabled = false;
            ddltype.Enabled     = false;
        }
Ejemplo n.º 4
0
        private bool DoEdit(int _id)
        {
            try
            {
                BLL.department   bll   = new BLL.department();
                Model.department model = bll.GetModel(_id);

                model.department_name = txtTitle.Text.Trim();
                model.sort_id         = int.Parse(txtSortId.Text.Trim());
                model.is_lock         = 0;
                if (cbIsLock.Checked == true)
                {
                    model.is_lock = 1;
                }
                model.remark = txtRemark.Text.Trim();
                if (model.is_sys == 0)
                {
                    int parentId = int.Parse(ddlParentId.SelectedValue);
                    //如果选择的父ID不是自己,则更改
                    if (parentId != model.id)
                    {
                        model.parent_id = parentId;
                    }
                }

                if (bll.Update(model))
                {
                    AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "修改部门信息:" + model.department_name); //记录日志
                    return(true);
                }
            }
            catch
            {
                return(false);
            }
            return(false);
        }