示例#1
0
        /// <summary>
        /// 添加一个部门
        /// </summary>
        /// <returns>返回新部门的ID</returns>
        public int Add()
        {
            DepartmentDAL dal = new DepartmentDAL(connectionString);

            _id = dal.Add(_deptid, _deptname, _state);
            return(_id);
        }
示例#2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            DepartmentDAL  departDal  = new DepartmentDAL();
            DepartmentInfo departInfo = new DepartmentInfo();

            departInfo.DepName = txtDepName.Text;
            departInfo.Remark  = txtRemark.Value;

            if (hidparentID.Value == "")
            {
                departInfo.ParentID = 0;
            }
            else
            {
                departInfo.ParentID = Convert.ToInt32(hidparentID.Value);
            }
            bool result = departDal.Exists(0, departInfo.DepName);

            if (result)
            {
                int depID = 0;
                result = departDal.Add(departInfo, out depID);
                if (result)
                {
                    TsOAPage.ShowMsgRefresh(this.Page, lang.SaveSuccess);
                    return;
                }
                else
                {
                    TsOAPage.ShowMsgRefresh(this.Page, lang.SaveFail);
                    return;
                }
            }
            else
            {
                TsOAPage.ShowMsgRefresh(this.Page, string.Format(lang.NameExists, lang.DepName));
                return;
            }
        }
示例#3
0
        public bool Add(Department department)
        {
            bool isSaved = departmentDAL.Add(department);

            return(isSaved);
        }