Example #1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            PositionBLL positionBLL = new PositionBLL();

            Position  temp = new  Position();

            temp.Position_name = txtbPositionname.Text.Trim();
            temp.Position_description = txtbPositionDes.Text.Trim();

            if (positionBLL.Add(temp) !=-1)
            {
                MessageBox.ShowAndRedirect(this, "添加成功", "PositionList.aspx");
            }
            else
            {
                MessageBox.ShowAndRedirect(this, "添加失败", "PositionList.aspx");
            }
        }
Example #2
0
    private void BindPositionDLL()
    {
        string strWhere = " OrganID = " + Session["OrganID"].ToString();
        IList<Position> dt = new PositionBLL().GetModelList(strWhere);

        Position p = new Position();
        p.PosiCode = "0";
        p.PosiName = "无";
        if (dt != null)
        {
            dt.Add(p);
        }

        ddl_Father.DataSource = dt;
        ddl_Father.DataValueField = "PosiCode";
        ddl_Father.DataTextField = "PosiName";
        ddl_Father.DataBind();

        ddl_Father.SelectedIndex = dt.Count - 1;
    }
Example #3
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;
    }