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); }
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>"); } }
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; } }
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; } }
public bool UpdateDepartmentByID(MDepartment objdept) { return dept.UpdateDepartmentByID(objdept); }
public DataTable SelectDepartmentByID(MDepartment objdept) { return dept.SelectDepartmentByID(objdept); }
public bool InsertIntoDepartment(MDepartment objdepartment) { return dept.InsertIntoDepartment(objdepartment); }
public void DeleteDepartmentByID(MDepartment objdept) { dept.DeleteDepartmentByID(objdept); }