protected void btn_Delete_Click(object sender, EventArgs e)
    {
        string idList = string.Empty;
        foreach (GridViewRow dr in GridView1.Rows)
        {
            CheckBox chk = (CheckBox)dr.FindControl("chk_XX");
            if (chk!=null && chk.Checked)
            {
                string _id = "'" + dr.Cells[1].Text.Trim() + "'";
                idList += _id + ",";
            }

        }
        if (idList.Length > 0)
        {
            idList = idList.TrimEnd(',');
            bool re = new ObjectGroupBLL().DeleteList(idList);
            if (re)
            {
                UtilityService.AlertAndRedirect(this.Page, "删除成功!", "ObjectGroupMgr.aspx");
            }
            else
            {
                UtilityService.Alert(this.Page, "删除失败!");
            }
        }
    }
 public void LoadService()
 {
     string code = Request.QueryString["Code"].ToString();
     ObjectGroup _p = new ObjectGroupBLL().GetModel(code);
     if (_p != null)
     {
         lab_Code.Text = _p.Code;
         txt_Name.Text = _p.Name;
         ddl_Type.SelectedValue = _p.TypeCode;
     }
 }
    protected void btn_Modity_Click(object sender, EventArgs e)
    {
        ObjectGroup r = new ObjectGroup();
        r.Code = lab_Code.Text.Trim();
        r.Name = txt_Name.Text.Trim();
        r.TypeCode = ddl_Type.SelectedValue.ToString();

        bool re = new ObjectGroupBLL().Update(r);
        if (re)
        {
            UtilityService.AlertAndRedirect(this, "修改成功!", "ObjectGroupMgr.aspx");
        }
        else
        {
            UtilityService.Alert(this, "修改失败!");
        }
    }
    protected void btn_Add_Click(object sender, EventArgs e)
    {
        ObjectGroup r = new ObjectGroup();
        r.Name = txt_Name.Text.Trim();
        r.TypeCode = ddl_Type.SelectedValue.ToString();
        r.OrganID = (int)Session["OrganID"];
        r.InputBy = Session["UserID"].ToString();

        int re = new ObjectGroupBLL().Add(r);
        if (re > 0)
        {
            UtilityService.AlertAndRedirect(this, "添加成功!", "ObjectGroupMgr.aspx");
        }
        else
        {
            UtilityService.Alert(this, "添加失败!");
        }
    }
Beispiel #5
0
    private string AddPosition(string name,int organID,string fatherName)
    {
        if (name == "0" || name == string.Empty)
        {
            return "";
        }
        PositionBLL pBLL = new PositionBLL();
        bool _re = pBLL.Exists(name, organID);
        if (!_re)
        {
            string _fatherCode = pBLL.GetPosiCode(fatherName, organID);
            if (string.IsNullOrEmpty(_fatherCode))
            {
                _fatherCode = "0";
            }
            Position p = new Position();
            p.PosiName = name;
            p.FatherCode = _fatherCode;
            p.OrganID = organID;
            p.InputBy = Session["UserID"].ToString();

            bool re = pBLL.Add(p);

            if (re)
            {
                //添加数据组
                string _groupName = name + "数据组";
                try
                {
                    ObjectGroup r = new ObjectGroup();
                    r.Name = _groupName;
                    r.TypeCode = "T0001";
                    r.OrganID = organID;
                    r.InputBy = Session["UserID"].ToString();
                    int reOG = new ObjectGroupBLL().Add(r);
                    if (reOG > 0)
                    {
                        string _groupCode = new ObjectGroupBLL().GetObjectGroupCode(_groupName, organID);
                        string _pCode = pBLL.GetPosiCode(name, organID);

                        List<string> ogList = new List<string>();
                        ogList.Add(_groupCode);

                        int reP2O = new PositionBLL().AddPosi2ObjectGroup(_pCode, ogList);

                    }
                }
                catch
                {

                }
            }
        }
        string _Code = pBLL.GetPosiCode(name, organID);
        return _Code;
    }