protected void gvDepartment_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Delete") { int rowIndex = Convert.ToInt32(e.CommandArgument); GridViewRow row = gvDepartment.Rows[rowIndex]; int Id = Convert.ToInt32((row.FindControl("lblId") as Label).Text); string name = (row.FindControl("lblName") as Label).Text; DepartmentBS departmentBS = new DepartmentBS(); ClsDepartmentResult result = departmentBS.ProcessRemove(new DepartmentBO() { Id = Id, Name = name }); if (result.Success) { ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Deparment Name: " + name + "');", true); } else { ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('" + result.ErrorDesc + "');", true); } } }
public DepartmentDal() { studentEntities = new DataAccessLayour.StudentEntities(); result = new ClsDepartmentResult() { Success = true }; }
public void CreateDepartment() { var Name = "Physics"; DepartmentBS departmentBS = new DepartmentBS(); ClsDepartmentResult result = departmentBS.ProcessSave(new DepartmentBO() { Name = Name }); }
public void DeleteDepartment() { int Id = 1; string name = "Physics"; DepartmentBS departmentBS = new DepartmentBS(); ClsDepartmentResult result = departmentBS.ProcessRemove(new DepartmentBO() { Id = Id, Name = name }); }
protected void btn_Click(object sender, EventArgs e) { var Name = txtDepartment.Text; DepartmentBS departmentBS = new DepartmentBS(); ClsDepartmentResult result = departmentBS.ProcessSave(new DepartmentBO() { Name = Name }); if (result.Success) { ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Inserted');", true); } else { ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('" + result.ErrorDesc + "');", true); } }