public FileContentResult ExportToExcel() { DB_ClassEntities db = new DB_ClassEntities(); BusinessLayer bl = new BusinessLayer(); DataSet dt = bl.Student_Teacherdata(); string[] columns = { "Name", "Project", "Developer" }; byte[] filecontent = ExcelExportHelper.ExportExcel(dt, "Technology", true, columns); return(File(filecontent, ExcelExportHelper.ExcelContentType, "Technologies.xlsx")); }
///////////////////////////////////////////////////////////edit//////////////////////////////////////////////// public ActionResult Edit() { string studentId = Request.QueryString["stuId"].ToString(); DB_ClassEntities objentity = new DB_ClassEntities(); WebApplication5.Models.StudentInformation_Result objstudentdetail = new WebApplication5.Models.StudentInformation_Result(); objstudentdetail.StudentID = Int32.Parse(studentId.ToString()); BusinessLayer bl = new BusinessLayer(); DataSet dt = bl.GetStudentRecord(objstudentdetail); foreach (DataRow dr in dt.Tables[0].Rows) { objstudentdetail.StudentID = Int32.Parse(dr["StudentID"].ToString()); objstudentdetail.first_names = dr["first_name"].ToString(); objstudentdetail.last_names = dr["last_name"].ToString(); objstudentdetail.birthdate = dr.Field <System.DateTime>("birthdate"); objstudentdetail.contact = dr["contact"].ToString(); objstudentdetail.contact_emails = dr["contact_email"].ToString(); objstudentdetail.Gender = dr["Gender"].ToString(); objstudentdetail.AdharNumber = Int32.Parse(dr["Adharcard"].ToString()); objstudentdetail.middle_names = dr["middle_name"].ToString(); objstudentdetail.LocalAddress = dr["LocalAddress"].ToString(); objstudentdetail.PermanentAddress = dr["PermanentAddress"].ToString(); objstudentdetail.ClassTypeId = dr["ClassTypeId"].ToString(); } DataSet dt2 = bl.GetParentId(objstudentdetail.StudentID); int ContactId = 0; foreach (DataRow dr in dt2.Tables[0].Rows) { ContactId = Int32.Parse(dr["Contact_PersonID"].ToString()); } DataSet dt3 = bl.GetParentRecord(ContactId); foreach (DataRow dr in dt3.Tables[0].Rows) { objstudentdetail.Contact_PersonID = Int32.Parse(dr["Contact_PersonID"].ToString()); objstudentdetail.first_name = dr["first_name"].ToString(); objstudentdetail.last_name = dr["last_name"].ToString(); objstudentdetail.contact_number1 = (dr["contact_number1"].ToString()); objstudentdetail.contact_number2 = dr["contact_number2"].ToString(); objstudentdetail.contact_email = dr["contact_email"].ToString(); objstudentdetail.RelationWith_Student = dr["RelationWith_Student"].ToString(); objstudentdetail.middle_name = dr["middle_name"].ToString(); objstudentdetail.Address = dr["Address"].ToString(); } return(View(objstudentdetail)); }
public ActionResult Delete() { string studentId = Request.QueryString["stuId"].ToString(); DB_ClassEntities objentity = new DB_ClassEntities(); WebApplication5.Models.StudentInformation_Result objstudentdetail = new WebApplication5.Models.StudentInformation_Result(); objstudentdetail.StudentID = Int32.Parse(studentId.ToString()); BusinessLayer bl = new BusinessLayer(); DataSet dt2 = bl.GetParentId(objstudentdetail.StudentID); int ContactId = 0; foreach (DataRow dr in dt2.Tables[0].Rows) { ContactId = Int32.Parse(dr["Contact_PersonID"].ToString()); } bl.DeleteParentRecord(ContactId); bl.DeleteStudentRecord(objstudentdetail); return(Redirect("/Home/Student_registrar")); }