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); }