예제 #1
0
 public void DeleteDepartmentByID(MDepartment objdept)
 {
     StringBuilder sb = new StringBuilder();
     sb.Append("delete from tb_department where ID=@ID");
     SqlParameter[] param ={
                               SQLDbHelper.GetParameter("@ID",SqlDbType.Int,4,"ID",objdept.ID)
                           };
     SQLDbHelper.ExecuteSql(sb.ToString(), param);
 }
예제 #2
0
 public DataTable SelectDepartmentByID(MDepartment objdept)
 {
     StringBuilder sb = new StringBuilder();
     sb.Append("select * from tb_department where ID=@ID");
     SqlParameter[] param ={
                               SQLDbHelper.GetParameter("@ID",SqlDbType.Int,4,"ID",objdept.ID)
                           };
     DataTable dt = SQLDbHelper.ExecuteDt(sb.ToString(),param);
     return dt;
 }
 protected void imgBtnSave_Click(object sender, ImageClickEventArgs e)
 {
     department dept = new department();
     MDepartment objdept = new MDepartment();
     objdept.Name = txtName.Text.Trim().ToString();
     objdept.Duty_description = txtContent.Text.Trim().ToString();
     bool bl = dept.InsertIntoDepartment(objdept);
     if (bl)
     {
         this.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('新建部门成功!');</script>");
     }
     else
     {
         this.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('新建部门失败!');</script>");
     }
 }
예제 #4
0
 public bool InsertIntoDepartment(MDepartment objdepartment)
 {
     StringBuilder sb = new StringBuilder();
     sb.Append("insert into tb_department (name,duty_description) values(@DeptName,@Duty)");
     SqlParameter[] param ={
                               SQLDbHelper.GetParameter("@DeptName",SqlDbType.VarChar,50,"name",objdepartment.Name),
                               SQLDbHelper.GetParameter("@Duty",SqlDbType.Text,"duty_description",objdepartment.Duty_description)
                           };
     bool is_succeed = SQLDbHelper.ExecuteSql(sb.ToString(), param);
     if (is_succeed)
     {
         return true;
     }
     else
     {
         return false;
     }
 }
예제 #5
0
 public bool UpdateDepartmentByID(MDepartment objdept)
 {
     StringBuilder sb = new StringBuilder();
     sb.Append("update tb_department set Name=@DeptName,duty_description=@Duty where ID=@ID");
     SqlParameter[] param ={
                               SQLDbHelper.GetParameter("@DeptName",SqlDbType.VarChar,50,"name",objdept.Name),
                               SQLDbHelper.GetParameter("@Duty",SqlDbType.Text,"duty_description",objdept.Duty_description),
                               SQLDbHelper.GetParameter("@ID",SqlDbType.Int,4,"ID",objdept.ID)
                           };
     bool is_succeed = SQLDbHelper.ExecuteSql(sb.ToString(), param);
     if (is_succeed)
     {
         return true;
     }
     else
     {
         return false;
     }
 }
예제 #6
0
 public bool UpdateDepartmentByID(MDepartment objdept)
 {
     return dept.UpdateDepartmentByID(objdept);
 }
예제 #7
0
 public DataTable SelectDepartmentByID(MDepartment objdept)
 {
     return dept.SelectDepartmentByID(objdept);
 }
예제 #8
0
 public bool InsertIntoDepartment(MDepartment objdepartment)
 {
     return dept.InsertIntoDepartment(objdepartment);
 }
예제 #9
0
 public void DeleteDepartmentByID(MDepartment objdept)
 {
     dept.DeleteDepartmentByID(objdept);
 }