public dynamic DoLogin(DTO.LABURNUM.COM.LoginModel model) { if (new FrontEndApi.ApiClientApi().IsClientValid(model.ApiClientModel.UserName, model.ApiClientModel.Password)) { if (model.LoginBy == DTO.LABURNUM.COM.Utility.UserType.GetValue(DTO.LABURNUM.COM.Utility.EnumUserType.STUDENT)) { DTO.LABURNUM.COM.StudentModel studentmodel = new DTO.LABURNUM.COM.StudentModel() { StudentUserName = model.UserName, StudentPassword = model.Password, ApiClientModel = model.ApiClientModel, IsStudentLogin = true }; return(new API.LABURNUM.COM.Controllers.StudentController().ParentStudentLogin(studentmodel)); } if (model.LoginBy == DTO.LABURNUM.COM.Utility.UserType.GetValue(DTO.LABURNUM.COM.Utility.EnumUserType.PARENT)) { DTO.LABURNUM.COM.StudentModel studentmodel = new DTO.LABURNUM.COM.StudentModel() { ParentUserName = model.UserName, ParentPassword = model.Password, ApiClientModel = model.ApiClientModel, IsStudentLogin = false }; return(new API.LABURNUM.COM.Controllers.StudentController().ParentStudentLogin(studentmodel)); } if (model.LoginBy == DTO.LABURNUM.COM.Utility.UserType.GetValue(DTO.LABURNUM.COM.Utility.EnumUserType.FACULTY)) { DTO.LABURNUM.COM.FacultyModel facultyModel = new DTO.LABURNUM.COM.FacultyModel() { UserName = model.UserName, Password = model.Password, ApiClientModel = model.ApiClientModel }; return(new API.LABURNUM.COM.Controllers.FacultyController().FacultyLogin(facultyModel)); } return(model); } else { return(null); } }
public void UpdateParentProfile(DTO.LABURNUM.COM.StudentModel model) { if (new FrontEndApi.ApiClientApi().IsClientValid(model.ApiClientModel.UserName, model.ApiClientModel.Password)) { new FrontEndApi.StudentApi().UpdateParentProfile(model); } }
private DTO.LABURNUM.COM.StudentModel MapCore(API.LABURNUM.COM.Student student) { DTO.LABURNUM.COM.StudentModel dtoClass = new DTO.LABURNUM.COM.StudentModel() { StudentId = student.StudentId, ClassId = student.ClassId, SectionId = student.SectionId, Address = student.Address, BusRouteNumber = student.BusRouteNumber, ClassStartWithId = student.ClassStartWithId, DOB = student.DOB, EmailId = student.EmailId, FatherAadharNumber = student.FatherAadharNumber, FatherMobile = student.FatherMobile, FatherName = student.FatherName, FatherProfession = student.FatherProfession, FirstName = student.FirstName, Landline = student.Landline, LastName = student.LastName, MiddleName = student.MiddleName, Mobile = student.Mobile, MotherAadharNumber = student.MotherAadharNumber, MotherMobile = student.MotherMobile, MotherName = student.MotherName, MotherProfession = student.MotherProfession, PAN = student.PAN, SalutationId = student.SalutationId, StudentAadharNumber = student.StudentAadharNumber, CreatedOn = student.CreatedOn, IsActive = student.IsActive, LastUpdated = student.LastUpdated }; return(dtoClass); }
public void UpdateStatus(DTO.LABURNUM.COM.StudentModel model) { if (new FrontEndApi.ApiClientApi().IsClientValid(model.ApiClientModel.UserName, model.ApiClientModel.Password)) { new FrontEndApi.StudentApi().UpdateIsActive(model); } }
public DTO.LABURNUM.COM.StudentModel ParentStudentLogin(DTO.LABURNUM.COM.StudentModel model) { if (new FrontEndApi.ApiClientApi().IsClientValid(model.ApiClientModel.UserName, model.ApiClientModel.Password)) { DTO.LABURNUM.COM.StudentModel studentmodel = new DTO.LABURNUM.COM.StudentModel(); long studentId; if (model.IsStudentLogin) { studentId = new FrontEndApi.StudentApi().IsStudentValid(model.StudentUserName, model.StudentPassword); } else { studentId = new FrontEndApi.StudentApi().IsParentValid(model.ParentUserName, model.ParentPassword); } if (studentId > 0) { studentmodel = new StudentHelper(new FrontEndApi.StudentApi().GetStudentByStudentId(studentId)).MapSingle(); } return(studentmodel); } else { return(null); } }
public DTO.LABURNUM.COM.StudentModel Update(DTO.LABURNUM.COM.StudentModel model) { if (new FrontEndApi.ApiClientApi().IsClientValid(model.ApiClientModel.UserName, model.ApiClientModel.Password)) { return(new StudentHelper(new FrontEndApi.StudentApi().Update(model)).MapSingle()); } else { return(null); } }
public List <DTO.LABURNUM.COM.StudentModel> SearchStudentByAdvanceSearch(DTO.LABURNUM.COM.StudentModel model) { if (new FrontEndApi.ApiClientApi().IsClientValid(model.ApiClientModel.UserName, model.ApiClientModel.Password)) { return(new StudentHelper(new FrontEndApi.StudentApi().GetStudentByAdvanceSearch(model)).Map()); } else { return(null); } }
public long Add(DTO.LABURNUM.COM.StudentModel model) { if (new FrontEndApi.ApiClientApi().IsClientValid(model.ApiClientModel.UserName, model.ApiClientModel.Password)) { return(new FrontEndApi.StudentApi().Add(model)); } else { return(-1); } }
public DTO.LABURNUM.COM.SessionModel DoLogin(DTO.LABURNUM.COM.LoginModel model) { if (new FrontEndApi.ApiClientApi().IsClientValid(model.ApiClientModel.UserName, model.ApiClientModel.Password)) { DTO.LABURNUM.COM.SessionModel sessionmodel = new DTO.LABURNUM.COM.SessionModel(); // model.Password = GetEncryptedPassword(model.Password); if (model.LoginBy == DTO.LABURNUM.COM.Utility.UserType.GetValue(DTO.LABURNUM.COM.Utility.EnumUserType.STUDENT)) { DTO.LABURNUM.COM.StudentModel studentmodel = new DTO.LABURNUM.COM.StudentModel() { StudentUserName = model.UserName, StudentPassword = model.Password, ApiClientModel = model.ApiClientModel, IsStudentLogin = true }; sessionmodel.StudentModel = new API.LABURNUM.COM.Controllers.StudentController().ParentStudentLogin(studentmodel); sessionmodel.LoginByUserId = sessionmodel.StudentModel.StudentId; sessionmodel.LoginBy = model.LoginBy; } if (model.LoginBy == DTO.LABURNUM.COM.Utility.UserType.GetValue(DTO.LABURNUM.COM.Utility.EnumUserType.PARENT)) { DTO.LABURNUM.COM.StudentModel studentmodel = new DTO.LABURNUM.COM.StudentModel() { ParentUserName = model.UserName, ParentPassword = model.Password, ApiClientModel = model.ApiClientModel }; sessionmodel.StudentModel = new API.LABURNUM.COM.Controllers.StudentController().ParentStudentLogin(studentmodel); sessionmodel.LoginByUserId = sessionmodel.StudentModel.StudentId; sessionmodel.LoginBy = model.LoginBy; } if (model.LoginBy == DTO.LABURNUM.COM.Utility.UserType.GetValue(DTO.LABURNUM.COM.Utility.EnumUserType.FACULTY)) { DTO.LABURNUM.COM.FacultyModel facultyModel = new DTO.LABURNUM.COM.FacultyModel() { UserName = model.UserName, Password = model.Password, ApiClientModel = model.ApiClientModel }; sessionmodel.FacultyModel = new API.LABURNUM.COM.Controllers.FacultyController().FacultyLogin(facultyModel); sessionmodel.LoginByUserId = sessionmodel.FacultyModel.FacultyId; sessionmodel.LoginBy = sessionmodel.FacultyModel.UserTypeId; } API.LABURNUM.COM.AcademicYearTable acy = new FrontEndApi.AcademicYearTableApi().GetAcademicYearByYear(new Component.Utility().GetISTDateTime().Year); sessionmodel.AcademicYear = acy.AcademicYear; sessionmodel.AcademicYearId = acy.AcademicYearTableId; sessionmodel.LastLoginAt = new FrontEndApi.LoginActivityApi().GetLastLogin(sessionmodel.LoginByUserId, sessionmodel.LoginBy); DTO.LABURNUM.COM.LoginActivityModel lmodel = new DTO.LABURNUM.COM.LoginActivityModel() { UserTypeId = sessionmodel.LoginBy, StudentId = sessionmodel.LoginByUserId, ClientId = new FrontEndApi.ApiClientApi().GetClientId(model.ApiClientModel.UserName, model.ApiClientModel.Password) }; sessionmodel.LoginActivityId = new FrontEndApi.LoginActivityApi().Add(lmodel); return(sessionmodel); } else { return(null); } }
private void sendmail(DTO.LABURNUM.COM.StudentModel user) { string from = Component.Constants.MAIL.MAILSENTFROM; string subject = Component.Constants.MAILSUBJECT.REGISTRATIONSUBJECT; string body = new API.LABURNUM.COM.Component.HtmlHelper().RenderViewToString("User", "~/Views/Partial/NewStudentRegistrationMail.cshtml", user); if (new Component.Mailer().MailSend(user.EmailId, "", body, from, subject)) { } else { } }
public API.LABURNUM.COM.Student Update(DTO.LABURNUM.COM.StudentModel model) { model.StudentId.TryValidate(); IQueryable <API.LABURNUM.COM.Student> iQuery = this._laburnum.Students.Where(x => x.StudentId == model.StudentId && x.IsActive == true); List <API.LABURNUM.COM.Student> dbStudents = iQuery.ToList(); if (dbStudents.Count == 0) { throw new Exception(API.LABURNUM.COM.Component.Constants.ERRORMESSAGES.NO_RECORD_FOUND); } if (dbStudents.Count > 1) { throw new Exception(API.LABURNUM.COM.Component.Constants.ERRORMESSAGES.MORE_THAN_ONE_RECORDFOUND); } dbStudents[0].AdmissionNumber = model.AdmissionNumber; dbStudents[0].StudentPhoto = model.StudentPhoto; dbStudents[0].ClassId = model.ClassId; dbStudents[0].ClassStartWithId = model.ClassStartWithId; dbStudents[0].FirstName = model.FirstName; dbStudents[0].MiddleName = model.MiddleName; dbStudents[0].LastName = model.LastName; dbStudents[0].SalutationId = model.SalutationId; dbStudents[0].EmailId = model.EmailId; dbStudents[0].Mobile = model.Mobile; dbStudents[0].Address = model.Address; dbStudents[0].DOB = model.DOB; dbStudents[0].Landline = model.Landline; dbStudents[0].FatherName = model.FatherName; dbStudents[0].FatherMobile = model.FatherMobile; dbStudents[0].FatherProfession = model.FatherProfession; dbStudents[0].MotherName = model.MotherName; dbStudents[0].MotherMobile = model.MotherMobile; dbStudents[0].MotherProfession = model.MotherProfession; dbStudents[0].FatherAadharNumber = model.FatherAadharNumber; dbStudents[0].MotherAadharNumber = model.MotherAadharNumber; dbStudents[0].PAN = model.PAN; dbStudents[0].SectionId = model.SectionId; dbStudents[0].IsTransportRqd = model.IsTransportRqd; dbStudents[0].BusRouteId = model.BusRouteId; dbStudents[0].StudentAadharNumber = model.StudentAadharNumber; //dbStudents[0].StudentUserName = model.StudentUserName; //dbStudents[0].StudentPassword = GetEncryptedPassword(model.StudentPassword); //dbStudents[0].ParentUserName = model.ParentUserName; //dbStudents[0].ParentPassword = GetEncryptedPassword(model.ParentPassword); dbStudents[0].LastUpdated = new Component.Utility().GetISTDateTime(); this._laburnum.SaveChanges(); return(dbStudents[0]); }
public static void TryValidate(this DTO.LABURNUM.COM.StudentModel item) { item.ClassId.TryValidate(); item.ClassStartWithId.TryValidate(); item.FirstName.TryValidate(); item.SalutationId.TryValidate(); item.EmailId.TryValidate(); item.Mobile.TryValidate(); item.Address.TryValidate(); item.FatherName.TryValidate(); item.FatherMobile.TryValidate(); item.FatherProfession.TryValidate(); item.MotherName.TryValidate(); item.MotherMobile.TryValidate(); item.MotherProfession.TryValidate(); }
public DTO.LABURNUM.COM.StudentModel Add(DTO.LABURNUM.COM.StudentModel model) { if (new FrontEndApi.ApiClientApi().IsClientValid(model.ApiClientModel.UserName, model.ApiClientModel.Password)) { DTO.LABURNUM.COM.StudentModel smodel = new StudentHelper(new FrontEndApi.StudentApi().Add(model)).MapSingle(); smodel.ParentPassword = model.ParentPassword; smodel.StudentPassword = model.StudentPassword; if (Component.Constants.DEFAULTVALUE.ISMAILSENDSTART) { sendmail(smodel); } return(smodel); } else { return(null); } }
public void UpdateIsActive(DTO.LABURNUM.COM.StudentModel model) { model.StudentId.TryValidate(); IQueryable <API.LABURNUM.COM.Student> iQuery = this._laburnum.Students.Where(x => x.StudentId == model.StudentId && x.IsActive == true); List <API.LABURNUM.COM.Student> dbStudents = iQuery.ToList(); if (dbStudents.Count == 0) { throw new Exception(API.LABURNUM.COM.Component.Constants.ERRORMESSAGES.NO_RECORD_FOUND); } if (dbStudents.Count > 1) { throw new Exception(API.LABURNUM.COM.Component.Constants.ERRORMESSAGES.MORE_THAN_ONE_RECORDFOUND); } dbStudents[0].IsActive = model.IsActive; dbStudents[0].LastUpdated = System.DateTime.Now; this._laburnum.SaveChanges(); }
public void UpdateParentProfile(DTO.LABURNUM.COM.StudentModel model) { model.StudentId.TryValidate(); IQueryable <API.LABURNUM.COM.Student> iQuery = this._laburnum.Students.Where(x => x.StudentId == model.StudentId && x.IsActive == true); List <API.LABURNUM.COM.Student> dbStudents = iQuery.ToList(); if (dbStudents.Count == 0) { throw new Exception(API.LABURNUM.COM.Component.Constants.ERRORMESSAGES.NO_RECORD_FOUND); } if (dbStudents.Count > 1) { throw new Exception(API.LABURNUM.COM.Component.Constants.ERRORMESSAGES.MORE_THAN_ONE_RECORDFOUND); } dbStudents[0].ParentPassword = model.NewPassword; dbStudents[0].LastUpdated = new Component.Utility().GetISTDateTime(); this._laburnum.SaveChanges(); }
private API.LABURNUM.COM.Student AddStudent(DTO.LABURNUM.COM.StudentModel model) { API.LABURNUM.COM.Student apiStudent = new Student() { AdmissionNumber = model.AdmissionNumber, StudentPhoto = model.StudentPhoto, ClassId = model.ClassId, ClassStartWithId = model.ClassStartWithId, FirstName = model.FirstName, MiddleName = model.MiddleName, LastName = model.LastName, SalutationId = model.SalutationId, EmailId = model.EmailId, Mobile = model.Mobile, Address = model.Address, DOB = model.DOB, Landline = model.Landline, FatherName = model.FatherName, FatherMobile = model.FatherMobile, FatherProfession = model.FatherProfession, MotherName = model.MotherName, MotherMobile = model.MotherMobile, MotherProfession = model.MotherProfession, FatherAadharNumber = model.FatherAadharNumber, MotherAadharNumber = model.MotherAadharNumber, PAN = model.PAN, StudentAadharNumber = model.StudentAadharNumber, SectionId = model.SectionId, IsTransportRqd = model.IsTransportRqd, BusRouteId = model.BusRouteId, StudentUserName = model.StudentUserName, StudentPassword = model.StudentPassword, //StudentPassword = GetEncryptedPassword(model.StudentPassword), ParentUserName = model.ParentUserName, ParentPassword = model.ParentPassword, //ParentPassword = GetEncryptedPassword(model.ParentPassword), CreatedOn = new Component.Utility().GetISTDateTime(), IsActive = true }; this._laburnum.Students.Add(apiStudent); this._laburnum.SaveChanges(); return(GetStudentByStudentId(apiStudent.StudentId)); }
public void UpdateStudentStatus(DTO.LABURNUM.COM.StudentModel model) { try { model.ApiClientModel = new LABURNUM.COM.Component.Common().GetApiClientModel(); HttpClient client = new LABURNUM.COM.Component.Common().GetHTTPClient("application/json"); HttpResponseMessage response = client.PostAsJsonAsync("Student/UpdateStatus", model).Result; if (response.IsSuccessStatusCode) { } else { } } catch (Exception) { throw new Exception("Error While Updating Student Status"); } }
public API.LABURNUM.COM.Student GetStudentByStudentId(long studentid) { studentid.TryValidate(); DTO.LABURNUM.COM.StudentModel model = new DTO.LABURNUM.COM.StudentModel() { StudentId = studentid }; List <API.LABURNUM.COM.Student> dbStudents = GetStudentByAdvanceSearch(model); if (dbStudents.Count == 0) { throw new Exception(API.LABURNUM.COM.Component.Constants.ERRORMESSAGES.NO_RECORD_FOUND); } if (dbStudents.Count > 1) { throw new Exception(API.LABURNUM.COM.Component.Constants.ERRORMESSAGES.MORE_THAN_ONE_RECORDFOUND); } return(dbStudents[0]); }
public dynamic UpdateParentProfile(DTO.LABURNUM.COM.StudentModel model) { if (new FrontEndApi.ApiClientApi().IsClientValid(model.ApiClientModel.UserName, model.ApiClientModel.Password)) { if (model.StudentId <= 0) { return(GetApiResponseModel("Student Id Cannnot be Zero or Less Than Zero.", false, null)); } if (model.ParentPassword == null || model.ParentPassword == "") { return(GetApiResponseModel("Password Cannnot be Null.", false, null)); } new FrontEndApi.StudentApi().UpdateStudentProfile(model); return(GetApiResponseModel("Profile Updated Successfully.", true, null)); } else { return(GetApiResponseModel("Api Access User Name or Password Invalid.", false, null)); } }
public List <DTO.LABURNUM.COM.StudentModel> GetStudentByAdvanceSearch(DTO.LABURNUM.COM.StudentModel model) { try { model.ApiClientModel = new LABURNUM.COM.Component.Common().GetApiClientModel(); HttpClient client = new LABURNUM.COM.Component.Common().GetHTTPClient("application/json"); HttpResponseMessage response = client.PostAsJsonAsync("Student/SearchStudentByAdvanceSearch", model).Result; if (response.IsSuccessStatusCode) { var data = response.Content.ReadAsStringAsync().Result; return(JsonConvert.DeserializeObject <List <DTO.LABURNUM.COM.StudentModel> >(data)); } else { return(null); } } catch (Exception) { throw new Exception("Error While Getting Student List"); } }
private long AddStudent(DTO.LABURNUM.COM.StudentModel model) { API.LABURNUM.COM.Student apiStudent = new Student() { ClassId = model.ClassId, ClassStartWithId = model.ClassStartWithId, FirstName = model.FirstName, MiddleName = model.MiddleName, LastName = model.LastName, SalutationId = model.SalutationId, EmailId = model.EmailId, Mobile = model.Mobile, Address = model.Address, DOB = model.DOB, Landline = model.Landline, FatherName = model.FatherName, FatherMobile = model.FatherMobile, FatherProfession = model.FatherProfession, MotherName = model.MotherName, MotherMobile = model.MotherMobile, MotherProfession = model.MotherProfession, FatherAadharNumber = model.FatherAadharNumber, MotherAadharNumber = model.MotherAadharNumber, PAN = model.PAN, StudentAadharNumber = model.StudentAadharNumber, SectionId = model.SectionId, BusRouteNumber = model.BusRouteNumber, StudentUserName = model.StudentUserName, StudentPassword = model.StudentPassword, ParentUserName = model.ParentUserName, ParentPassword = model.ParentPassword, CreatedOn = System.DateTime.Now, IsActive = true }; this._laburnum.Students.Add(apiStudent); this._laburnum.SaveChanges(); return(apiStudent.ClassId); }
public dynamic SearchStudentByStudentId(DTO.LABURNUM.COM.StudentModel model) { if (new FrontEndApi.ApiClientApi().IsClientValid(model.ApiClientModel.UserName, model.ApiClientModel.Password)) { if (model.StudentId <= 0) { return(GetApiResponseModel("Student Id Cannnot be Zero or Less Than Zero.", true, null)); } List <DTO.LABURNUM.COM.StudentModel> dbStudents = new StudentHelper(new FrontEndApi.StudentApi().GetStudentByAdvanceSearch(model)).Map(); if (dbStudents.Count == 0) { return(GetApiResponseModel("No Record Found For Given Student Id", true, null)); } if (dbStudents.Count > 1) { return(GetApiResponseModel("More Than One Record Found Please Contact Administrator", true, null)); } return(GetApiResponseModel("Successfully Performed.", true, dbStudents[0])); } else { return(GetApiResponseModel("Api Access User Name or Password Invalid.", false, null)); } }
public List <DTO.LABURNUM.COM.StudentFeeDetailModel> SearchPendingFeeByStudentModel(DTO.LABURNUM.COM.StudentModel model) { if (new FrontEndApi.ApiClientApi().IsClientValid(model.ApiClientModel.UserName, model.ApiClientModel.Password)) { API.LABURNUM.COM.Student dbstudent = new FrontEndApi.StudentApi().GetStudentByAdmissionNumber(model.AdmissionNumber); return(new StudentFeeDetailHelper(new FrontEndApi.StudentFeeDetailApi().GetStudentFeeDetailByAdvanceSearch(new DTO.LABURNUM.COM.StudentFeeDetailModel() { StudentId = dbstudent.StudentId, AcademicYearId = model.AcademicYearId })).Map()); } else { return(null); } }
private DTO.LABURNUM.COM.StudentModel MapCore(API.LABURNUM.COM.Student student) { DTO.LABURNUM.COM.StudentModel dtoStudent = new DTO.LABURNUM.COM.StudentModel() { StudentId = student.StudentId, AdmissionNumber = student.AdmissionNumber, StudentPhoto = student.StudentPhoto, ClassId = student.ClassId, SectionId = student.SectionId, Address = student.Address, BusRouteId = student.BusRouteId, IsTransportRqd = student.IsTransportRqd, ClassStartWithId = student.ClassStartWithId, DOB = student.DOB, EmailId = student.EmailId, FatherAadharNumber = student.FatherAadharNumber, FatherMobile = student.FatherMobile, FatherName = student.FatherName, FatherProfession = student.FatherProfession, FirstName = student.FirstName, Landline = student.Landline, LastName = student.LastName, MiddleName = student.MiddleName, Mobile = student.Mobile, MotherAadharNumber = student.MotherAadharNumber, MotherMobile = student.MotherMobile, MotherName = student.MotherName, MotherProfession = student.MotherProfession, PAN = student.PAN, SalutationId = student.SalutationId, StudentAadharNumber = student.StudentAadharNumber, CreatedOn = student.CreatedOn, IsActive = student.IsActive, LastUpdated = student.LastUpdated, StudentFullName = student.FirstName + " " + student.MiddleName + " " + student.LastName, StudentUserName = student.StudentUserName, StudentPassword = student.StudentPassword, ParentUserName = student.ParentUserName, ParentPassword = student.ParentPassword, }; if (student.Class != null && student.Section != null && student.Class1 != null && student.Salutation != null) { dtoStudent.ClassName = student.Class.ClassName; dtoStudent.SectionName = student.Section.SectionName; dtoStudent.ClassStartWithName = student.Class1.ClassName; dtoStudent.SalutationText = student.Salutation.Name; } long admissionTypeId = 0; if (student.ClassId == student.ClassStartWithId) { dtoStudent.IsNewAdmission = true; } if (dtoStudent.IsNewAdmission) { admissionTypeId = DTO.LABURNUM.COM.Utility.AdmissionType.GetValue(DTO.LABURNUM.COM.Utility.EnumAdmissionType.NEWADMISSION); } else { admissionTypeId = DTO.LABURNUM.COM.Utility.AdmissionType.GetValue(DTO.LABURNUM.COM.Utility.EnumAdmissionType.READMISSION); } dtoStudent.StudentFeeId = new FrontEndApi.StudentFeeApi().GetStudentFeeId(student.ClassId, student.StudentId, admissionTypeId); return(dtoStudent); }
public dynamic DoLogin(DTO.LABURNUM.COM.LoginModel model) { if (new FrontEndApi.ApiClientApi().IsClientValid(model.ApiClientModel.UserName, model.ApiClientModel.Password)) { DTO.LABURNUM.COM.SessionModel sessionmodel = new DTO.LABURNUM.COM.SessionModel(); //model.Password = GetEncryptedPassword(model.Password); try { if (model.LoginBy == 0) { return(GetApiResponseModel("Login By Cannot Be Null.", false, null)); } if (model.LoginBy == DTO.LABURNUM.COM.Utility.UserType.GetValue(DTO.LABURNUM.COM.Utility.EnumUserType.STUDENT)) { if (model.UserName == "" || model.Password == "") { return(GetApiResponseModel("Student UserName Or Password Cannnot Be Blank.", false, null)); } DTO.LABURNUM.COM.StudentModel studentmodel = new DTO.LABURNUM.COM.StudentModel() { StudentUserName = model.UserName, StudentPassword = model.Password, ApiClientModel = model.ApiClientModel, IsStudentLogin = true }; sessionmodel.StudentModel = new API.LABURNUM.COM.Controllers.StudentController().ParentStudentLogin(studentmodel); sessionmodel.LoginByUserId = sessionmodel.StudentModel.StudentId; } if (model.LoginBy == DTO.LABURNUM.COM.Utility.UserType.GetValue(DTO.LABURNUM.COM.Utility.EnumUserType.PARENT)) { if (model.UserName == "" || model.Password == "") { return(GetApiResponseModel("Parent UserName Or Password Cannnot Be Blank.", false, null)); } DTO.LABURNUM.COM.StudentModel studentmodel = new DTO.LABURNUM.COM.StudentModel() { ParentUserName = model.UserName, ParentPassword = model.Password, ApiClientModel = model.ApiClientModel }; sessionmodel.StudentModel = new API.LABURNUM.COM.Controllers.StudentController().ParentStudentLogin(studentmodel); sessionmodel.LoginByUserId = sessionmodel.StudentModel.StudentId; } if (model.LoginBy == DTO.LABURNUM.COM.Utility.UserType.GetValue(DTO.LABURNUM.COM.Utility.EnumUserType.FACULTY)) { if (model.UserName == "" || model.Password == "") { return(GetApiResponseModel("Faculty UserName Or Password Cannnot Be Blank.", false, null)); } DTO.LABURNUM.COM.FacultyModel facultyModel = new DTO.LABURNUM.COM.FacultyModel() { UserName = model.UserName, Password = model.Password, ApiClientModel = model.ApiClientModel }; sessionmodel.FacultyModel = new API.LABURNUM.COM.Controllers.FacultyController().FacultyLogin(facultyModel); sessionmodel.LoginByUserId = sessionmodel.FacultyModel.FacultyId; } sessionmodel.LoginBy = model.LoginBy; API.LABURNUM.COM.AcademicYearTable acy = new FrontEndApi.AcademicYearTableApi().GetAcademicYearByYear(new Component.Utility().GetISTDateTime().Year); sessionmodel.AcademicYear = acy.AcademicYear; sessionmodel.AcademicYearId = acy.AcademicYearTableId; sessionmodel.LastLoginAt = new FrontEndApi.LoginActivityApi().GetLastLogin(sessionmodel.LoginByUserId, sessionmodel.LoginBy); DTO.LABURNUM.COM.LoginActivityModel lmodel = new DTO.LABURNUM.COM.LoginActivityModel() { UserTypeId = sessionmodel.LoginBy, StudentId = sessionmodel.LoginByUserId, ClientId = new FrontEndApi.ApiClientApi().GetClientId(model.ApiClientModel.UserName, model.ApiClientModel.Password) }; sessionmodel.LoginActivityId = new FrontEndApi.LoginActivityApi().Add(lmodel); return(GetApiResponseModel("SuccessFully Performed", true, sessionmodel)); } catch (Exception ex) { return(GetApiResponseModel(ex.Message.ToString(), false, null)); } } else { return(GetApiResponseModel("Api Access User Name or Password Invalid.", false, null)); } }
public List <API.LABURNUM.COM.Student> GetStudentByAdvanceSearch(DTO.LABURNUM.COM.StudentModel model) { IQueryable <API.LABURNUM.COM.Student> iQuery = null; //Search By Student Id. if (iQuery != null) { if (model.StudentId > 0) { iQuery = iQuery.Where(x => x.StudentId == model.StudentId && x.IsActive == true); } } else { if (model.StudentId > 0) { iQuery = this._laburnum.Students.Where(x => x.StudentId == model.StudentId && x.IsActive == true); } } //Search By ClassId. if (iQuery != null) { if (model.ClassId > 0) { iQuery = iQuery.Where(x => x.ClassId == model.ClassId && x.IsActive == true); } } else { if (model.ClassId > 0) { iQuery = this._laburnum.Students.Where(x => x.ClassId == model.ClassId && x.IsActive == true); } } //Search By Class Start With Id. if (iQuery != null) { if (model.ClassStartWithId > 0) { iQuery = iQuery.Where(x => x.ClassStartWithId == model.ClassStartWithId && x.IsActive == true); } } else { if (model.ClassStartWithId > 0) { iQuery = this._laburnum.Students.Where(x => x.ClassStartWithId == model.ClassStartWithId && x.IsActive == true); } } //Search By FirstName. if (iQuery != null) { if (model.FirstName != null) { iQuery = iQuery.Where(x => x.FirstName.Trim().ToLower().Contains(model.FirstName.Trim().ToLower()) && x.IsActive == true); } } else { if (model.FirstName != null) { iQuery = this._laburnum.Students.Where(x => x.FirstName.Trim().ToLower().Contains(model.FirstName.Trim().ToLower()) && x.IsActive == true); } } //Search By MiddleName. if (iQuery != null) { if (model.MiddleName != null) { iQuery = iQuery.Where(x => x.MiddleName.Trim().ToLower().Contains(model.MiddleName.Trim().ToLower()) && x.IsActive == true); } } else { if (model.MiddleName != null) { iQuery = this._laburnum.Students.Where(x => x.MiddleName.Trim().ToLower().Contains(model.MiddleName.Trim().ToLower()) && x.IsActive == true); } } //Search By LastName. if (iQuery != null) { if (model.LastName != null) { iQuery = iQuery.Where(x => x.LastName.Trim().ToLower().Contains(model.LastName.Trim().ToLower()) && x.IsActive == true); } } else { if (model.LastName != null) { iQuery = this._laburnum.Students.Where(x => x.LastName.Trim().ToLower().Contains(model.LastName.Trim().ToLower()) && x.IsActive == true); } } //Search By SalutationId. if (iQuery != null) { if (model.SalutationId > 0) { iQuery = iQuery.Where(x => x.SalutationId == model.SalutationId && x.IsActive == true); } } else { if (model.SalutationId > 0) { iQuery = this._laburnum.Students.Where(x => x.SalutationId == model.SalutationId && x.IsActive == true); } } //Search By EmailId. if (iQuery != null) { if (model.EmailId != null) { iQuery = iQuery.Where(x => x.EmailId.Trim().Equals(model.EmailId.Trim()) && x.IsActive == true); } } else { if (model.EmailId != null) { iQuery = this._laburnum.Students.Where(x => x.EmailId.Trim().Equals(model.EmailId.Trim()) && x.IsActive == true); } } //Search By Mobile. if (iQuery != null) { if (model.Mobile != null) { iQuery = iQuery.Where(x => x.Mobile.Trim().Equals(model.Mobile.Trim()) && x.IsActive == true); } } else { if (model.Mobile != null) { iQuery = this._laburnum.Students.Where(x => x.Mobile.Trim().Equals(model.Mobile.Trim()) && x.IsActive == true); } } //Search By FatherName. if (iQuery != null) { if (model.FatherName != null) { iQuery = iQuery.Where(x => x.FatherName.Trim().ToLower().Contains(model.FatherName.Trim().ToLower()) && x.IsActive == true); } } else { if (model.FatherName != null) { iQuery = this._laburnum.Students.Where(x => x.FatherName.Trim().ToLower().Contains(model.FatherName.Trim().ToLower()) && x.IsActive == true); } } //Search By MotherName. if (iQuery != null) { if (model.MotherName != null) { iQuery = iQuery.Where(x => x.MotherName.Trim().ToLower().Contains(model.MotherName.Trim().ToLower()) && x.IsActive == true); } } else { if (model.MotherName != null) { iQuery = this._laburnum.Students.Where(x => x.MotherName.Trim().ToLower().Contains(model.MotherName.Trim().ToLower()) && x.IsActive == true); } } //Search By PAN. if (iQuery != null) { if (model.PAN != null) { iQuery = iQuery.Where(x => x.PAN.Equals(model.PAN) && x.IsActive == true); } } else { if (model.PAN != null) { iQuery = this._laburnum.Students.Where(x => x.PAN.Equals(model.PAN) && x.IsActive == true); } } //Search By FatherAadharNumber. if (iQuery != null) { if (model.FatherAadharNumber != null) { iQuery = iQuery.Where(x => x.FatherAadharNumber == x.FatherAadharNumber && x.IsActive == true); } } else { if (model.FatherAadharNumber != null) { iQuery = this._laburnum.Students.Where(x => x.FatherAadharNumber == x.FatherAadharNumber && x.IsActive == true); } } //Search By MotherAadharNumber. if (iQuery != null) { if (model.MotherAadharNumber != null) { iQuery = iQuery.Where(x => x.MotherAadharNumber == x.MotherAadharNumber && x.IsActive == true); } } else { if (model.MotherAadharNumber != null) { iQuery = this._laburnum.Students.Where(x => x.MotherAadharNumber == x.MotherAadharNumber && x.IsActive == true); } } //Search By StudentAadharNumber. if (iQuery != null) { if (model.StudentAadharNumber != null) { iQuery = iQuery.Where(x => x.StudentAadharNumber == x.StudentAadharNumber && x.IsActive == true); } } else { if (model.StudentAadharNumber != null) { iQuery = this._laburnum.Students.Where(x => x.StudentAadharNumber == x.StudentAadharNumber && x.IsActive == true); } } //Search By Bus Route No. if (iQuery != null) { if (model.BusRouteId > 0) { iQuery = iQuery.Where(x => x.BusRouteId == x.BusRouteId && x.IsActive == true); } } else { if (model.BusRouteId > 0) { iQuery = this._laburnum.Students.Where(x => x.BusRouteId == x.BusRouteId && x.IsActive == true); } } //Search By SectionId. if (iQuery != null) { if (model.SectionId > 0) { iQuery = iQuery.Where(x => x.SectionId == model.SectionId && x.IsActive == true); } } else { if (model.SectionId > 0) { iQuery = this._laburnum.Students.Where(x => x.SectionId == model.SectionId && x.IsActive == true); } } //Search By AdmissionNumber. if (iQuery != null) { if (model.AdmissionNumber != null) { iQuery = iQuery.Where(x => x.AdmissionNumber.Equals(model.AdmissionNumber) && x.IsActive == true); } } else { if (model.AdmissionNumber != null) { iQuery = this._laburnum.Students.Where(x => x.AdmissionNumber.Equals(model.AdmissionNumber) && x.IsActive == true); } } List <API.LABURNUM.COM.Student> dbStudents = iQuery.ToList(); return(dbStudents); }
public API.LABURNUM.COM.Student Add(DTO.LABURNUM.COM.StudentModel model) { return(AddValidation(model)); }
private API.LABURNUM.COM.Student AddValidation(DTO.LABURNUM.COM.StudentModel model) { model.TryValidate(); return(AddStudent(model)); }