protected void gvStudent_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Delete") { int rowIndex = Convert.ToInt32(e.CommandArgument); GridViewRow row = gvStudent.Rows[rowIndex]; int Id = Convert.ToInt32((row.FindControl("lblId") as Label).Text); string Name = (row.FindControl("lblName") as Label).Text; int DepartmentId = Convert.ToInt32((row.FindControl("lblDepartmentId") as Label).Text); string DepartmentName = (row.FindControl("lblDepartmentName") as Label).Text; StudentDetailBS studentDetailBS = new StudentDetailBS(); ClsStudentResult result = studentDetailBS.ProcessRemove(new StudentDetailBO() { Id = Id, Name = Name, DepartmentId = DepartmentId, DepartmentName = DepartmentName }); if (result.Success) { ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Student Name: " + Name + "');", true); } else { ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('" + result.ErrorDesc + "');", true); } } }
public StudentDetailDal() { studentEntities = new DataAccessLayour.StudentEntities(); result = new ClsStudentResult() { Success = true }; }
public void CreateStudent() { var Name = "Preethi"; var DepartmentId = 1; StudentDetailBS studentDetailBS = new StudentDetailBS(); ClsStudentResult result = studentDetailBS.ProcessSave(new BusinessObject.StudentDetailBO() { Name = Name, DepartmentId = DepartmentId }); }
public void DeleteStudent() { int Id = 1; string Name = "Preethi"; int DepartmentId = 1; string DepartmentName = "Physics"; StudentDetailBS studentDetailBS = new StudentDetailBS(); ClsStudentResult result = studentDetailBS.ProcessRemove(new StudentDetailBO() { Id = Id, Name = Name, DepartmentId = DepartmentId, DepartmentName = DepartmentName }); }
protected void btn_Click(object sender, EventArgs e) { var Name = txtStudent.Text; var DepartmentId = Convert.ToInt32(ddlDepartment.SelectedValue); StudentDetailBS studentDetailBS = new StudentDetailBS(); ClsStudentResult result = studentDetailBS.ProcessSave(new BusinessObject.StudentDetailBO() { Name = Name, DepartmentId = DepartmentId }); if (result.Success) { ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Inserted');", true); } else { ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('" + result.ErrorDesc + "');", true); } }