public static bool SaveSponosorDetail(XmlSponosorUpload model, int StudentId) { try { var relationship = DropDownManager.GetRelationShipByName(model.SponosorRelationship); var sponosor = new StudentGuardianDetial() { FullName = model.SponosorName, Email = model.SponosorEmail, MobileNo = model.SponosorPhone, Address = model.SponosorAddress, RelationShip = relationship, StudentId = StudentId }; unitofwork.GuardianDetails.Insert(sponosor); unitofwork.Save(); UpdateStudentData(sponosor.ID, StudentId); // InsertAudit("Student Sponosor Details", sponosor.Id, "Insert"); // AddStudent(xmlStudent, sponosor.ID); return(true); } catch (Exception ex) { return(false); } }
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"); } } }
public bool InsertStudent(string fName, string lName, string oName, string dob, string sex, int lgaId, string address, string gName, string gAddress, string gPhone, string gEmail, int relation) { try { var student = new Student() { FirstName = fName, LastName = lName, MiddleName = oName, DateOfBirth = dob, Sex = sex, LocalGovernmentID = lgaId, Address = address, DateCreated = DateTime.Now.ToShortDateString(), SchoolId = SessionUser.SchoolId, CreatedBy = SessionUser.UserId }; unitOfWork.studentData.Insert(student); unitOfWork.Save(); var guardianDetails = new StudentGuardianDetial() { StudentId = student.StudentId, FullName = gName, Address = gAddress, MobileNo = gPhone, RelationShip = relation, Email = gEmail }; unitOfWork.GuardianDetails.Insert(guardianDetails); unitOfWork.Save(); return(true); } catch (Exception) { return(false); } }