Ejemplo n.º 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);
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 3
0
 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>");
     }
 }
Ejemplo n.º 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;
     }
 }
Ejemplo n.º 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;
     }
 }
Ejemplo n.º 6
0
 public bool UpdateDepartmentByID(MDepartment objdept)
 {
     return dept.UpdateDepartmentByID(objdept);
 }
Ejemplo n.º 7
0
 public DataTable SelectDepartmentByID(MDepartment objdept)
 {
     return dept.SelectDepartmentByID(objdept);
 }
Ejemplo n.º 8
0
 public bool InsertIntoDepartment(MDepartment objdepartment)
 {
     return dept.InsertIntoDepartment(objdepartment);
 }
Ejemplo n.º 9
0
 public void DeleteDepartmentByID(MDepartment objdept)
 {
     dept.DeleteDepartmentByID(objdept);
 }