protected void tblGeneral_RowCommand(object sender, GridViewCommandEventArgs e) { int tempsessionId = GeneralUtility.GetCurrentSessionId(); string SessionId = ddlyear.SelectedValue.ToString(); string Lga = ddlLgda.SelectedValue.ToString(); string id = e.CommandArgument.ToString(); lblSchoolId.Text = id; if (e.CommandName.ToLower() == "doapprove") { string CountApproved = GeneralUtility.ApproveSchool(int.Parse(id), tempsessionId); int i = 0; if (int.TryParse(CountApproved, out i) && int.Parse(CountApproved) > 0) { DropDownManager.ShowPopUp("Operation Successful, " + CountApproved + " Records Approved"); return; } else { DropDownManager.ShowPopUp("Operation Not Successful, No Records Approved"); return; } } else if (e.CommandName.ToLower() == "doview") { LoadAllStudents(tempsessionId, int.Parse(id)); panelStudent.Visible = true; PnlSchool.Visible = false; } }
protected void btnSecEntryReject_Click(object sender, EventArgs e) { if (inspectorServices.ApproveOrRejectSchedule(false, SessionUser.SchoolId, ddlExam1.SelectedValue, ddlYear1.SelectedValue)) { DropDownManager.ShowPopUp("Approved Successfully !!!"); //PopulateAttendancePri(SessionUser.SchoolId.ToString()); } }
protected void btnAttendApprove_Click(object sender, EventArgs e) { if (inspectorServices.ApproveOrRejectAttendance(true, SessionUser.SchoolId, ddlExam.SelectedValue, ddlSubject.SelectedValue, ddlYear.SelectedValue)) { DropDownManager.ShowPopUp("Approved Successfully !!!"); PopulateAttendancePri(SessionUser.SchoolId.ToString()); } }
protected void btnSubmit_Click(object sender, EventArgs e) { if (ValidateInputs()) { var manager = Context.GetOwinContext().GetUserManager <ApplicationUserManager>(); var signInManager = Context.GetOwinContext().Get <ApplicationSignInManager>(); var user = new ApplicationUser() { UserName = txtEmail.Value, Email = txtEmail.Value, PhoneNumber = txtMobileNo.Value }; IdentityResult result = manager.Create(user, "@1234567"); if (result.Succeeded) { // For more information on how to enable account confirmation and password reset please visit https://go.microsoft.com/fwlink/?LinkID=320771 //string code = manager.GenerateEmailConfirmationToken(user.Id); //string callbackUrl = IdentityHelper.GetUserConfirmationRedirectUrl(code, user.Id, Request); manager.AddToRole(user.Id, "School"); //manager.SendEmail(user.Id, "Confirm your account", "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>."); int selectedRadio = 0; if (radPublic.Checked == true) { selectedRadio = int.Parse(radPublic.Value); } else { selectedRadio = int.Parse(radPrivate.Value); } var school = new Models.School() { Name = txtname.Value, Address = txtAddress.Value, Email = txtEmail.Value, MobileNo = Convert.ToDecimal(txtMobileNo.Value), NameOfPrincipal = ddlTitle.SelectedItem.Text + " " + txtPrincipal.Value, DateOfIncorporation = Convert.ToDateTime(txtdate.Value), SchoolTypeId = selectedRadio, CategoryId = int.Parse(ddlSchoolCat.SelectedValue), LocalGovernmentID = int.Parse(ddlLGA.SelectedValue), UserId = user.Id, CreatedBy = "", DateCreated = DateTime.Now }; unitOfWork.School.Insert(school); unitOfWork.Save(); //signInManager.SignIn(user, isPersistent: false, rememberBrowser: false); DropDownManager.ShowPopUp("School Added Successfully !!!"); //IdentityHelper.RedirectToReturnUrl("Registration/School", Response); ClearInput(); } else { ErrorMessage.Text = result.Errors.FirstOrDefault(); } } }
protected void gvExam_RowCommand(object sender, GridViewCommandEventArgs e) { string id = e.CommandArgument.ToString(); string[] Ids = id.Split(','); string ExamId = Ids[0]; string StudentId = Ids[1]; string schoolId = Ids[2]; DropDownManager.ShowPopUp(ExamId + " " + StudentId + " " + schoolId); }
protected void Page_Load(object sender, EventArgs e) { if (SessionUser.SchoolType == 1) { var result = GeneralUtility.HasSchoolBeenAssignedQuota(SessionUser.SchoolId); if (!result) { DropDownManager.ShowPopUp("Quota Has not been Assigned For this Year"); return; } } }
protected void btnUpload_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(xlsxSchol.PostedFile.FileName)) { DataTable table = new DataTable(); table.Columns.Add("ID"); table.Columns.Add("SN"); table.Columns.Add("REG_NUM"); table.Columns.Add("FULLNAME"); table.Columns.Add("DATE_OF_BIRTH"); table.Columns.Add("GENDER"); table.Columns.Add("EXAM_YEAR"); table.Columns.Add("ADDRESS"); table.Columns.Add("PICTURES"); lblFileName.Text = GeneralUtility.GetExcelFile(xlsxSchol); string extenstion = Path.GetExtension(lblFileName.Text); if (extenstion != ".xml") { DataSet ds = new DataSet(); ds.ReadXml(lblFileName.Text); int counter = 0; for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { string ID = ds.Tables[0].Rows[i]["ID"].ToString(); string RegNum = ds.Tables[0].Rows[i]["REG_NUMBER"].ToString(); string LastName = ds.Tables[0].Rows[i]["SURNAME"].ToString(); string FirstName = ds.Tables[0].Rows[i]["LASTNAME"].ToString(); string OtherName = ds.Tables[0].Rows[i]["OTHERNAME"].ToString(); string FullName = ds.Tables[0].Rows[i]["FULLNAME"].ToString(); string DateofBirth = ds.Tables[0].Rows[i]["DATE_OF_BIRTH"].ToString(); string Gender = ds.Tables[0].Rows[i]["GENDER"].ToString(); string ExamYear = ds.Tables[0].Rows[i]["EXAM_YEAR"].ToString(); string Address = ds.Tables[0].Rows[i]["ADDRESS"].ToString(); string Base64Picture = $"data:image/png;base64,{ ds.Tables[0].Rows[i]["PICTURE"].ToString()}"; // SponosorId = int.Parse(ds.Tables[0].Rows[i]["SPONOSORID"].ToString()) Base64Picture = $"<img src=\"{Base64Picture}\">"; ++counter; table.Rows.Add(ID, counter, RegNum, FullName, DateofBirth, Gender, ExamYear, Address, Base64Picture); } gvResults.DataSource = table; gvResults.DataBind(); excelDiv.Visible = true; gvResults.HeaderRow.TableSection = TableRowSection.TableHeader; } } else { DropDownManager.ShowPopUp("Please Upload a file"); } }
protected void btnSave_Click(object sender, EventArgs e) { int exam = 0; int studentId = 0; int subjectToBeUploaded = 0; int sessionToBeUploaded = 0; int counter = 0; string exam_no = ""; string attendance = ""; int.TryParse(ddlSubject.SelectedValue, out subjectToBeUploaded); int.TryParse(ddlExam.SelectedValue, out exam); int.TryParse(ddlYear.SelectedValue, out sessionToBeUploaded); string mark = ""; string remarks = ""; bool attend = false; for (int i = 0; i < gvResults.Rows.Count; i++) { int.TryParse(gvResults.Rows[i].Cells[0].Text, out studentId); exam_no = Convert.ToString(gvResults.Rows[i].Cells[3].Text); attendance = Convert.ToString(gvResults.Rows[i].Cells[4].Text); mark = Convert.ToString(gvResults.Rows[i].Cells[5].Text); remarks = Convert.ToString(gvResults.Rows[i].Cells[6].Text); if (attendance == "Present") { attend = true; } else { attend = false; } var registeredExam = unitOfWork.ExamRegistered.Get(filter: x => x.ExamId == exam && x.SchoolId == SessionUser.SchoolId && x.StudentId == studentId && x.SubjectId == subjectToBeUploaded && x.SessionId == sessionToBeUploaded).SingleOrDefault(); registeredExam.Attendance = attend; registeredExam.AttendanceRemarks = remarks; registeredExam.StudentRegNum = exam_no; registeredExam.TotalScore = decimal.Parse(mark); unitOfWork.ExamRegistered.Update(registeredExam); unitOfWork.Save(); ++counter; } DropDownManager.ShowPopUp($"{counter} attendance was successfully uploaded"); excelDiv.Visible = false; }
public void PopulateInspector(string id) { int lgaId = 0; int.TryParse(id, out lgaId); var inspector = inspectorServices.GetInspector(lgaId); if (inspector != null) { txtFirstName.Value = inspector.CIEName; txtEmail.Value = inspector.Email; } else { Multiview1.ActiveViewIndex = 1; DropDownManager.ShowPopUp("No Inspector for this local Government, Kindly Create One"); } }
protected void btnSave_Click(object sender, EventArgs e) { int count = 0; int ErrorLine = 0; Models.School school = new Models.School(); for (int i = 0; i < gvResult.Rows.Count; i++) { string ID = gvResult.Rows[i].Cells[0].Text; string Name = gvResult.Rows[i].Cells[1].Text; string Lastname = gvResult.Rows[i].Cells[2].Text; string Othername = gvResult.Rows[i].Cells[4].Text; string Address = gvResult.Rows[i].Cells[5].Text; string Origin = gvResult.Rows[i].Cells[3].Text; string LGA = gvResult.Rows[i].Cells[6].Text; string DOB = gvResult.Rows[i].Cells[7].Text; string Sex = gvResult.Rows[i].Cells[8].Text; string GName = gvResult.Rows[i].Cells[9].Text; string GAddress = gvResult.Rows[i].Cells[10].Text; string GPhone = gvResult.Rows[i].Cells[11].Text; string GEmail = gvResult.Rows[i].Cells[12].Text; string Relation = gvResult.Rows[i].Cells[13].Text; var lgaid = DropDownManager.GetLGAIdByName(LGA); var relation = DropDownManager.GetRelationShipByName(Relation); var sex = DropDownManager.GetGenderByName(Sex); if (InsertStudent(Name, Lastname, Othername, DOB, sex, lgaid, Address, GName, GAddress, GPhone, GEmail, relation)) { ++count; } else { ErrorLine = Convert.ToInt32(gvResult.Rows[i].Cells[0].Text); } } DropDownManager.ShowPopUp($"{count} students was successfully added !!"); if (ErrorLine != 0) { DropDownManager.ShowPopUp("Record at Row " + ErrorLine + " was not Inserted#"); } }
protected void btnSave_Click(object sender, EventArgs e) { if (ValidateInputs()) { if (Page.IsValid) { string userId = HttpContext.Current.User.Identity.GetUserId(); var schoolId = DropDownManager.GetSchoolId(userId); var student = new Student() { FirstName = txtFirstName.Value, LastName = txtLastName.Value, MiddleName = txtMidName.Value, DateOfBirth = txtdate.Value, Sex = ddlSex.SelectedValue, LocalGovernmentID = int.Parse(ddlLGA.SelectedValue), Address = txtAddress.Value, DateCreated = DateTime.Now.ToShortDateString(), SchoolId = schoolId, CreatedBy = userId }; unitOfWork.studentData.Insert(student); unitOfWork.Save(); var guardianDetails = new StudentGuardianDetial() { StudentId = student.StudentId, FullName = txtFullname.Value, Address = txtGAddress.Value, MobileNo = txtGMobile.Value, RelationShip = int.Parse(ddlRelation.SelectedValue), Email = txtGEmail.Value }; unitOfWork.GuardianDetails.Insert(guardianDetails); unitOfWork.Save(); ClearInputs(); DropDownManager.ShowPopUp("Student Added Successfull"); } } }
protected void btnSubmit_Click(object sender, EventArgs e) { if (ValidateInput()) { QuotaViewModel quota = new QuotaViewModel() { SchoolId = int.Parse(ddlSchool.SelectedValue), SessionId = int.Parse(ddlYear.SelectedValue), Year = ddlYear.SelectedItem.Text, Quota = int.Parse(txtQuota.Value) }; var result = GeneralUtility.AddQuota(quota); if (result) { DropDownManager.ShowPopUp("Quota Successfully Assigned to School"); } else { DropDownManager.ShowPopUp("Quota Failed to Assign, Try Again"); } } }
protected void btnNext_Click(object sender, EventArgs e) { bool selected = false; foreach (GridViewRow gvRow in gvExam.Rows) { CheckBox chkExam = (CheckBox)gvRow.FindControl("chkExam"); Label lblExamId = (Label)gvRow.FindControl("lblExamId"); if (chkExam.Checked == true) { selected = true; } } if (selected == false) { DropDownManager.ShowPopUp("Please Select atleast one Exam to register "); } else { mutilView1.ActiveViewIndex = 1; PopulateStudent(); } }
protected void btnSave_Click(object sender, EventArgs e) { IList <XmlStudent> student = new List <XmlStudent>(); IList <XmlStudentUpload> uploads = new List <XmlStudentUpload>(); IList <XmlSponosorUpload> sponosorUploads = new List <XmlSponosorUpload>(); XmlStudentUpload newUploads; XmlSponosorUpload sponosorUpload; DataSet ds = new DataSet(); ds.ReadXml(lblFileName.Text); if (ds.Tables.Count > 0) { int counter = 0; for (int i = 0; i < ds.Tables["Student"].Rows.Count; i++) { newUploads = new XmlStudentUpload() { ID = int.Parse(ds.Tables[0].Rows[i]["ID"].ToString()), RegNum = ds.Tables[0].Rows[i]["REG_NUMBER"].ToString(), LastName = ds.Tables[0].Rows[i]["SURNAME"].ToString(), FirstName = ds.Tables[0].Rows[i]["LASTNAME"].ToString(), OtherName = ds.Tables[0].Rows[i]["OTHERNAME"].ToString(), FullName = ds.Tables[0].Rows[i]["FULLNAME"].ToString(), DateofBirth = ds.Tables[0].Rows[i]["DATE_OF_BIRTH"].ToString(), Gender = ds.Tables[0].Rows[i]["GENDER"].ToString(), ExamYear = ds.Tables[0].Rows[i]["EXAM_YEAR"].ToString(), Address = ds.Tables[0].Rows[i]["ADDRESS"].ToString(), Base64Picture = ds.Tables[0].Rows[i]["PICTURE"].ToString(), SponosorId = int.Parse(ds.Tables[0].Rows[i]["SPONOSORID"].ToString()) }; if (newUploads.Gender == "Male") { newUploads.Gender = "M"; } else { newUploads.Gender = "F"; } uploads.Add(newUploads); for (int j = 0; j < ds.Tables["SPONOSOR_DETAIL"].Rows.Count; j++) { sponosorUpload = new XmlSponosorUpload() { SponosorId = int.Parse(ds.Tables["SPONOSOR_DETAIL"].Rows[j]["ID"].ToString()), SponosorName = ds.Tables["SPONOSOR_DETAIL"].Rows[j]["FULLNAME"].ToString(), SponosorEmail = ds.Tables["SPONOSOR_DETAIL"].Rows[j]["EMAIL"].ToString(), SponosorPhone = ds.Tables["SPONOSOR_DETAIL"].Rows[j]["PHONE_NUMBER"].ToString(), SponosorAddress = ds.Tables["SPONOSOR_DETAIL"].Rows[j]["ADDRESS"].ToString(), SponosorRelationship = ds.Tables["SPONOSOR_DETAIL"].Rows[j]["RELATIONSHIP"].ToString(), }; sponosorUploads.Add(sponosorUpload); if (sponosorUpload.SponosorId == newUploads.SponosorId) { var result = GeneralUtility.HasQuotaFinished(SessionUser.SchoolId); if (result) { ++counter; GeneralUtility.AddStudent(sponosorUpload, newUploads); } } } } DropDownManager.ShowPopUp($"{counter} students upload successfully"); Response.Redirect("~/Modules/School/AllStudents"); } }
protected void btnSave_Click(object sender, EventArgs e) { try { int count = 0; int ErrorLine = 0; Models.School school = new Models.School(); for (int i = 0; i < gvResult.Rows.Count; i++) { //string student_id = gvr.Cells[1].Text; string id = gvResult.Rows[i].Cells[0].Text; string name = gvResult.Rows[i].Cells[1].Text; string Address = gvResult.Rows[i].Cells[2].Text; string Email = gvResult.Rows[i].Cells[4].Text; string MobileNo = gvResult.Rows[i].Cells[5].Text; string LGA = gvResult.Rows[i].Cells[3].Text; string Type = gvResult.Rows[i].Cells[6].Text; string category = gvResult.Rows[i].Cells[7].Text; string DateOfInCorporation = gvResult.Rows[i].Cells[8].Text; string PrincipalName = gvResult.Rows[i].Cells[9].Text; if (Type == "Public") { Type = "1"; } else { Type = "2"; } if (category == "Primary") { category = "1"; } else { category = "2"; } var lgaid = DropDownManager.GetLGAIdByName(LGA); //Create User var manager = Context.GetOwinContext().GetUserManager <ApplicationUserManager>(); var signInManager = Context.GetOwinContext().Get <ApplicationSignInManager>(); var user = new ApplicationUser() { UserName = Email, Email = Email, PhoneNumber = MobileNo }; IdentityResult result = manager.Create(user, "@Ab1234567"); if (result.Succeeded) { // For more information on how to enable account confirmation and password reset please visit https://go.microsoft.com/fwlink/?LinkID=320771 //string code = manager.GenerateEmailConfirmationToken(user.Id); //string callbackUrl = IdentityHelper.GetUserConfirmationRedirectUrl(code, user.Id, Request); manager.AddToRole(user.Id, "School"); school.Name = name; school.Address = Address; school.Email = Email; school.MobileNo = Convert.ToDecimal(MobileNo); school.SchoolTypeId = int.Parse(Type); school.NameOfPrincipal = PrincipalName; school.LocalGovernmentID = lgaid; school.DateOfIncorporation = Convert.ToDateTime(DateOfInCorporation); school.DateCreated = DateTime.Now; school.CategoryId = int.Parse(category); school.CreatedBy = User.Identity.GetUserId(); school.UserId = user.Id; unitOfWork.School.Insert(school); unitOfWork.Save(); count++; } else { ErrorLine = Convert.ToInt32(gvResult.Rows[i].Cells[0].Text); } } DropDownManager.ShowPopUp(count.ToString() + " Records Successfully Inserted !!!"); if (ErrorLine != 0) { DropDownManager.ShowPopUp("Record at Row " + ErrorLine + " was not Inserted#"); } } catch (Exception ex) { // lblError.Text = ErrorLog.InsertErrorLog(ex.Message) + " Please Contact Admin"; } }
protected void btnSubMit_Click(object sender, EventArgs e) { string subjectCode = string.Empty; string selectedExam = string.Empty; string selectSubject; string schoolId = lblSchoolId.Text; int subjects = 0; int noStudent = 0; // string studentId = lblStudent.Text; IList <ExaminationRegistered> Exams = new List <ExaminationRegistered>(); ExaminationRegistered Exam = null; foreach (GridViewRow gvRow in gvExam.Rows) { CheckBox chkExam = (CheckBox)gvRow.FindControl("chkExam"); Label lblExamId = (Label)gvRow.FindControl("lblExamId"); Label lblExamCode = (Label)gvRow.FindControl("lblExamCode"); lblExamCode1.Text = lblExamCode.Text; if (chkExam.Checked == true) { selectedExam = lblExamId.Text; foreach (GridViewRow gvstudent in gvStudents.Rows) { CheckBox chkStudent = (CheckBox)gvstudent.FindControl("chkStudent"); Label _lblStudentId = (Label)gvstudent.FindControl("lblStudentId"); if (chkStudent.Checked == true) { noStudent++; foreach (GridViewRow gvSub in gvSubject.Rows) { lblStudentR.Text = _lblStudentId.Text; CheckBox chkSubject = (CheckBox)gvSub.FindControl("chkSubject"); Label lblSubjectId = (Label)gvSub.FindControl("lblSubjectId"); Label lblSubjectCode = (Label)gvSub.FindControl("lblSubjectCode"); if (chkSubject.Checked == true) { subjects++; Exam = new ExaminationRegistered(); selectSubject = lblSubjectId.Text; Exam.SchoolId = int.Parse(schoolId); Exam.StudentId = int.Parse(lblStudentR.Text); Exam.SubjectId = int.Parse(selectSubject); Exam.ExamId = int.Parse(selectedExam); Exam.SchoolTypeId = int.Parse(lblSchoolType.Text); Exam.CategoryId = int.Parse(lblSchoolCat.Text); Exam.DateRegistered = DateTime.Now; Exam.SubjectCode = lblSubjectCode.Text; Exams.Add(Exam); } } if (subjects >= 8 || subjects == 9) { unitOfWork.ExamRegistered.InsertBulk(Exams); unitOfWork.Save(); lblID.Text = Exams.FirstOrDefault().RegistrationId.ToString(); } else { DropDownManager.ShowPopUp("Subject selected is below or above required no of subjects :: Minimum of 8 subject and Maximun is 9"); mutilView1.ActiveViewIndex = 2; } } noOfStudent.Text = noStudent.ToString(); } } } DropDownManager.ShowPopUp(noStudent + " Student Registered Successfully"); mutilView1.ActiveViewIndex = 3; LoadRecipt(); }