public async Task <ActionResult> GiveAttendance() { string UserID = UserHelperInfo.GetUserId(); var Student = await _studentService.GetStudentByUserIdAsync(UserID); if (Student != null) { var todayAttendance = await _studentAttendanceService.GetToday(Student.ID); if (todayAttendance == null) { StudentAttendance model = new StudentAttendance() { Agent = UserInfo.Agent(), IP = UserInfo.IP(), Latitude = "N/A", Longitude = "N/A", StudentId = Student.ID }; return(View("ClockIn", model)); } else { return(View("ClockOut", todayAttendance)); } } else { return(new HttpNotFoundResult("Student Not Found In Database")); } }
public async Task <ActionResult> Confirm(int id = 0) { var selectedGateway = await _paymentGateWayService.GetById(id); string UserId = UserHelperInfo.GetUserId(); var selectedStudent = _studentService.GetStudentByUserId(UserId); if (selectedStudent == null) { return(HttpNotFound("Student Not Found In DB")); } var LastAdmission = await _admissionService.GetLastAdmission(selectedStudent.ID); FeePayment feePayment = new FeePayment { PaymentGateway = selectedGateway, PaymentGatewayId = selectedGateway.ID, Id = 0, AdmissionId = LastAdmission.AdmissionID, IP = UserInfo.IP(), Agent = UserInfo.Agent() }; return(View(feePayment)); }
public JsonResult UploadPictures() { var files = Request.Files; JsonResult jsonResult = new JsonResult(); List <Picture> listPics = new List <Picture>(); for (int i = 0; i < files.Count; i++) { var picture = files[i]; var pathToImagesFolder = Server.MapPath("~/Images/Course/"); var fileName = Guid.NewGuid() + Path.GetExtension(picture.FileName); var filePath = pathToImagesFolder + fileName; picture.SaveAs(filePath); Picture dbPicture = new Picture { URL = fileName, UserID = UserHelperInfo.GetUserId(), IP = UserInfo.IP(), Agent = UserInfo.Agent(), Location = UserInfo.Location(), ModifiedOn = DateTime.Now }; DashboardService dashboardService = new DashboardService(); if (dashboardService.SavePicture(dbPicture)) { listPics.Add(dbPicture); } } jsonResult.Data = listPics; return(jsonResult); }
public JsonResult Action(DepartmentActionModel departmentActionModel) { JsonResult jsonResult = new JsonResult(); if (departmentActionModel.ID > 0) { departmentActionModel.ModifiedOn = DateTimeHelper.Now(); departmentActionModel.UserID = UserHelperInfo.GetUserId(); departmentActionModel.IP = UserInfo.IP(); departmentActionModel.Agent = UserInfo.Agent(); departmentActionModel.Location = UserInfo.Location(); var(IsSaved, Error) = departmentService.UpdateDepartment(departmentActionModel); jsonResult.Data = new { Success = IsSaved, Msg = Error }; } else { Department department = new Department { Name = departmentActionModel.Name, Description = departmentActionModel.Description, ModifiedOn = DateTimeHelper.Now(), UserID = UserHelperInfo.GetUserId(), IP = UserInfo.IP(), Agent = UserInfo.Agent(), Location = UserInfo.Location() }; var(IsSaved, Error) = departmentService.SaveDepartment(department); jsonResult.Data = new { Success = IsSaved, Msg = Error }; } return(jsonResult); }
public JsonResult ApproveAdmission(AdmissionActionModel admissionActionModel) { JsonResult jsonResult = new JsonResult(); var OldAdmission = service.GetByID(admissionActionModel.AdmissionID); if (OldAdmission != null) { Admission admission = new Admission() { AdmissionID = OldAdmission.AdmissionID, StudentID = OldAdmission.StudentID, CourseID = OldAdmission.CourseID, IsConfirmed = true, UserID = UserHelperInfo.GetUserId(), ModifiedOn = DateTime.Now, IP = UserInfo.IP(), Agent = UserInfo.Agent(), Location = UserInfo.Location() }; var(IsTrue, Msg) = service.ApproveAdmission(admission); jsonResult.Data = new { Success = IsTrue, Message = Msg }; } else { jsonResult.Data = new { Success = false, Message = "No Admission Found In DB" }; } return(jsonResult); }
public async Task <ActionResult> GiveAttendance() { string UserID = UserHelperInfo.GetUserId(); var Employee = await _employeeAttendanceService.GetEmployee(UserID); if (Employee != null) { var todayAttendance = await _employeeAttendanceService.GetTodayAttendance(Employee.ID); if (todayAttendance == null) { EmployeeAttendance employeeAttendance = new EmployeeAttendance() { Agent = UserInfo.Agent(), IP = UserInfo.IP(), Latitude = "N/A", Longitude = "N/A", TakenById = Employee.ID, EmployeeId = Employee.ID }; return(View("ClockIn", employeeAttendance)); } else { return(View("ClockOut", todayAttendance)); } } else { return(new HttpNotFoundResult()); } }
public async Task <ActionResult> Action(int?ID) { ViewBag.Categories = await _service2.GetAll(); if (ID.HasValue) { Course course = service.GetByID(ID.Value); course.UserID = UserHelperInfo.GetUserId(); course.IP = UserInfo.IP(); course.Agent = UserInfo.Agent(); course.Location = UserInfo.Location(); return(View("_Action", course)); } else { Course course = new Course { UserID = UserHelperInfo.GetUserId(), IP = UserInfo.IP(), Location = UserInfo.Location(), Agent = UserInfo.Agent() }; return(View("_Action", course)); } }
public async Task <ActionResult> GetList() { string UserID = UserHelperInfo.GetUserId(); if (!await _employeeAttendanceService.IsEmployee(UserID)) { return(HttpNotFound("Employee Not Found In Database Only Employee Can Give Attendance")); } return(View("_List", await _employeeAttendanceService.GetEmployeeAttendances())); }
public JsonResult Action(VoucherTypeActionModel model) { bool result; VoucherType objectFirst; string msg = ""; if (model.Id > 0) { objectFirst = service.GetByID(model.Id); objectFirst.Id = model.Id; objectFirst.Name = model.Name; objectFirst.AddedById = UserHelperInfo.GetUserId(); objectFirst.DateTime = DateTime.Now; objectFirst.IP = UserInfo.IP(); objectFirst.Agent = UserInfo.Agent(); objectFirst.Location = UserInfo.Location(); try { result = service.Update(objectFirst); } catch (Exception exc) { msg = exc.Message.ToString(); result = false; } } else { objectFirst = new VoucherType { Name = model.Name, DateTime = DateTime.Now, AddedById = UserHelperInfo.GetUserId(), IP = UserInfo.IP(), Agent = UserInfo.Agent(), Location = UserInfo.Location(), }; try { result = service.Save(objectFirst); } catch (Exception exc) { msg = exc.Message.ToString(); result = false; } } JsonResult jsonResult = new JsonResult { Data = result ? (new { Success = true, Msg = msg }) : (new { Success = false, Msg = msg }) }; return(jsonResult); }
public ActionResult Create() { AccountType accountType = new AccountType() { IP = UserInfo.IP(), Agent = UserInfo.Agent(), AddedById = UserHelperInfo.GetUserId() }; return(View(accountType)); }
public async Task <ActionResult> Create() { ChartOfAccount accountType = new ChartOfAccount() { IP = UserInfo.IP(), Agent = UserInfo.Agent(), UserID = UserHelperInfo.GetUserId() }; ViewBag.AccountTypesList = await accountTypeService.GetAccountTypesAsync(); return(View(accountType)); }
public async Task <ActionResult> Index() { string UserID = UserHelperInfo.GetUserId(); var(admissions, _) = await _studentService.GetCoursesAsync(UserID); StudentModel studentModel = new StudentModel { SelectedAdmissions = admissions }; return(View(studentModel)); }
public JsonResult ApplyNow(StudentsActionModel studentsActionModel) { JsonResult jsonResult = new JsonResult(); Student student = new Student { ID = studentsActionModel.ID, FirstName = studentsActionModel.FirstName, LastName = studentsActionModel.LastName, CNIC = studentsActionModel.CNIC, FatherName = studentsActionModel.FatherName, FatherCNIC = studentsActionModel.FatherCNIC, FatherProfession = studentsActionModel.FatherProfession, StudentContact = studentsActionModel.StudentContact, FatherContact = studentsActionModel.FatherContact, EmergencyContact = studentsActionModel.EmergencyContact, DateOfBirth = studentsActionModel.DateOfBirth, Gender = studentsActionModel.Gender, PresentAddress = studentsActionModel.PresentAddress, PermenantAddress = studentsActionModel.PermenantAddress, UserID = UserHelperInfo.GetUserId(), ModifiedOn = DateTimeHelper.Now(), IP = UserInfo.IP(), Agent = UserInfo.Agent(), Location = UserInfo.Location(), MaritalStatus = studentsActionModel.MaritalStatus, CityID = studentsActionModel.CityID, BloodGroupID = studentsActionModel.BloodGroupID }; Admission admission = new Admission { CourseID = studentsActionModel.CourseID, StudentID = studentsActionModel.ID, UserID = UserHelperInfo.GetUserId(), ModifiedOn = DateTimeHelper.Now(), IP = UserInfo.IP(), Agent = UserInfo.Agent(), Location = UserInfo.Location() }; AdmissionService admissionService = new AdmissionService(); var(isTrue, Msg) = admissionService.Admission(student, admission); if (Msg.Contains("StudentAndCourseUnique")) { Msg = "You have already applied for this course"; } jsonResult.Data = new { Success = isTrue, Message = Msg }; return(jsonResult); }
public JsonResult Action(VoucherTypeActionModel model) { bool result; VoucherType voucherType = new VoucherType() { Name = model.Name, AddedById = UserHelperInfo.GetUserId(), IP = UserInfo.IP(), Agent = UserInfo.Agent(), Longitude = model.Longitude, Latitude = model.Latitude, ModifiedOn = DateTimeHelper.Now() }; string msg = ""; if (model.Id > 0) { voucherType.Id = model.Id; try { result = service.Update(voucherType); } catch (Exception exc) { msg = exc.Message.ToString(); result = false; } } else { try { result = service.Save(voucherType); } catch (Exception exc) { msg = exc.Message.ToString(); result = false; } } JsonResult jsonResult = new JsonResult { Data = result ? (new { Success = true, Msg = msg }) : (new { Success = false, Msg = msg }) }; return(jsonResult); }
public async Task <ActionResult> Index() { string UserID = UserHelperInfo.GetUserId(); var Student = await _studentService.GetStudentByUserIdAsync(UserID); int StudentId = Student.ID; if (Student == null) { return(HttpNotFound("Student Not Found In Database Only Student Can Give Attendance")); } else { return(View(await _studentAttendanceService.GetByStudentId(StudentId))); } }
public async Task <ActionResult> Action(int ID = 0) { if (ID == 0) { PaymentGateway paymentGateway = new PaymentGateway { IP = UserInfo.IP(), Agent = UserInfo.Agent(), Location = "N/A", UserID = UserHelperInfo.GetUserId() }; return(View("_Action", paymentGateway)); } else { return(View("_Action", await _service.GetById(ID))); } }
public async Task <ActionResult> Index() { string UserId = UserHelperInfo.GetUserId(); var selectedStudent = _studentService.GetStudentByUserId(UserId); if (selectedStudent == null) { return(HttpNotFound("Student Not Found In DB")); } var LastAdmission = await _admissionService.GetLastAdmission(selectedStudent.ID); StudentPaymentModel model = new StudentPaymentModel() { FeePayments = await _feePaymentService.GetByAdmissionId(LastAdmission.AdmissionID), PaymentGateways = await _paymentGateWayService.Get() }; return(View(model)); }
// GET: Apply public ActionResult Index(int courseID) { Student student = studentService.GetStudentByUserId(UserHelperInfo.GetUserId()); if (student != null) { StudentsActionModel studentsActionModel = new StudentsActionModel { ID = student.ID, FirstName = student.FirstName, LastName = student.LastName, CNIC = student.CNIC, FatherName = student.FatherName, FatherCNIC = student.FatherCNIC, FatherProfession = student.FatherProfession, StudentContact = student.StudentContact, FatherContact = student.FatherContact, EmergencyContact = student.EmergencyContact, DateOfBirth = student.DateOfBirth, Gender = student.Gender, PresentAddress = student.PresentAddress, PermenantAddress = student.PermenantAddress, MaritalStatus = student.MaritalStatus, CityID = student.CityID, BloodGroupID = student.BloodGroupID, BloodGroups = bloodGroupService.GetAll(), Cities = cityService.GetAll(), CourseID = courseID }; return(View(studentsActionModel)); } else { StudentsActionModel studentsActionModel = new StudentsActionModel { BloodGroups = bloodGroupService.GetAll(), Cities = cityService.GetAll(), CourseID = courseID }; return(View(studentsActionModel)); } }
public async Task <ActionResult> Action(Ledger ledger) { ledger.UserID = UserHelperInfo.GetUserId(); ledger.IP = UserInfo.IP(); ledger.Agent = UserInfo.Agent(); var(IsTrue, ResponseMsg) = await _ledger.AddAsync(ledger); if (IsTrue) { return(RedirectToAction("Index")); } else { LedgerDTO model = new LedgerDTO { Ledgers = await _ledger.GetLedgersAsync() }; ViewBag.Message = ResponseMsg; return(View("Index", model.Ledgers)); } }
public JsonResult Action(CourseCategoryActionModel model) { bool result; if (model.ID > 0) { CourseCategory objectFirst = service.GetByID(model.ID); objectFirst.ID = model.ID; objectFirst.Name = model.Name; objectFirst.UserID = UserHelperInfo.GetUserId(); objectFirst.ModifiedOn = DateTime.Now; objectFirst.IP = UserInfo.IP(); objectFirst.Agent = UserInfo.Agent(); objectFirst.Location = UserInfo.Location(); result = service.Update(objectFirst); } else { CourseCategory objectFirst = new CourseCategory { Name = model.Name, UserID = UserHelperInfo.GetUserId(), ModifiedOn = DateTime.Now, IP = UserInfo.IP(), Agent = UserInfo.Agent(), Location = UserInfo.Location() }; result = service.Save(objectFirst); } JsonResult jsonResult = new JsonResult { Data = result ? (new { Success = true, Msg = "" }) : (new { Success = false, Msg = "Unable to Save Course" }) }; return(jsonResult); }
public async Task <ActionResult> Action(int?ID) { TimingActionModel model = new TimingActionModel(); if (ID.HasValue) { Timing timing = await service.Details(ID.Value); model.ID = timing.ID; model.Day = timing.Day; model.Number = timing.Number; model.OpeningTime = timing.OpeningTime; model.ClosingTime = timing.ClosingTime; model.ModifiedOn = DateTime.Now; model.UserID = UserHelperInfo.GetUserId(); model.IP = UserInfo.IP(); model.Agent = UserInfo.Agent(); model.Location = UserInfo.Location(); } else { } return(PartialView("_Action", model)); }
public JsonResult Action(CourseActionModel model) { bool result; Course objectFirst; string msg = ""; if (model.ID > 0) { objectFirst = service.GetByID(model.ID); objectFirst.Title = model.Title; objectFirst.Duration = model.Duration; objectFirst.Fee = model.Fee; objectFirst.UserID = UserHelperInfo.GetUserId(); objectFirst.ModifiedOn = DateTime.Now; objectFirst.IP = UserInfo.IP(); objectFirst.Agent = UserInfo.Agent(); objectFirst.Location = UserInfo.Location(); try { objectFirst.CoursePictures.Clear(); List <int> PictureListIDs = (!string.IsNullOrEmpty(model.PictureIDs) ? model.PictureIDs.Split(',').Select(x => int.Parse(x)).ToList() : new List <int>()); var pictures = dashboardService.GetPictures(PictureListIDs); objectFirst.CoursePictures = new List <CoursePicture>(); objectFirst.CoursePictures.AddRange(pictures.Select(x => new CoursePicture() { CourseID = model.ID, PictureID = x.ID })); result = service.Update(objectFirst); } catch (Exception exc) { msg = exc.Message.ToString(); result = false; } } else { objectFirst = new Course { Title = model.Title, Duration = model.Duration, Fee = model.Fee, ModifiedOn = DateTime.Now, UserID = UserHelperInfo.GetUserId(), IP = UserInfo.IP(), Agent = UserInfo.Agent(), Location = UserInfo.Location(), }; try { List <int> PictureListIDs = (!string.IsNullOrEmpty(model.PictureIDs) ? model.PictureIDs.Split(',').Select(x => int.Parse(x)).ToList() : new List <int>()); var pictures = dashboardService.GetPictures(PictureListIDs); objectFirst.CoursePictures = new List <CoursePicture>(); objectFirst.CoursePictures.AddRange(pictures.Select(x => new CoursePicture() { PictureID = x.ID })); result = service.Save(objectFirst); } catch (Exception exc) { msg = exc.Message.ToString(); result = false; } } JsonResult jsonResult = new JsonResult { Data = result ? (new { Success = true, Msg = msg }) : (new { Success = false, Msg = msg }) }; return(jsonResult); }
public JsonResult Action(TimingActionModel model) { bool result; string msg = ""; JsonResult jsonResult = new JsonResult(); if (model.ID == 0) { Timing timing = new Timing { Day = model.Day, Number = model.Number, OpeningTime = model.OpeningTime, ClosingTime = model.ClosingTime, ModifiedOn = DateTime.Now, UserID = UserHelperInfo.GetUserId(), IP = UserInfo.IP(), Agent = UserInfo.Agent(), Location = UserInfo.Location() }; try { result = service.Save(timing); msg += "success"; } catch (DbEntityValidationException e) { result = false; foreach (var eve in e.EntityValidationErrors) { foreach (var ve in eve.ValidationErrors) { msg += "" + string.Format("- Property: \"{0}\", Error: \"{1}\"", ve.PropertyName, ve.ErrorMessage); } } } catch (Exception exc) { msg += exc.Message.ToString() + " Detail : " + exc.InnerException.ToString(); result = false; } jsonResult.Data = result ? (new { Success = result, Msg = msg }) : (new { Success = false, Msg = msg }); } else { Timing timing = new Timing { ID = model.ID, Day = model.Day, Number = model.Number, OpeningTime = model.OpeningTime, ClosingTime = model.ClosingTime, ModifiedOn = DateTime.Now, UserID = UserHelperInfo.GetUserId(), IP = UserInfo.IP(), Agent = UserInfo.Agent(), Location = UserInfo.Location() }; try { result = service.Update(timing); msg += "success"; } catch (DbEntityValidationException e) { result = false; foreach (var eve in e.EntityValidationErrors) { foreach (var ve in eve.ValidationErrors) { msg += "" + string.Format("- Property: \"{0}\", Error: \"{1}\"", ve.PropertyName, ve.ErrorMessage); } } } catch (Exception exc) { msg += exc.Message.ToString() + " Detail : " + exc.InnerException.ToString(); result = false; } jsonResult.Data = result ? (new { Success = result, Msg = msg }) : (new { Success = result, Msg = msg }); } return(jsonResult); }
public JsonResult Save(CompanyViewModel model) { string msg = string.Empty; bool result; if (model.ID > 0) { Company objectFirst = service.GetByID(model.ID); objectFirst.Name = model.Name; objectFirst.Cell = model.Cell; objectFirst.Phone = model.Phone; objectFirst.ModifiedOn = DateTime.Now; objectFirst.Email = model.Email; objectFirst.Address = model.Address; objectFirst.UserID = UserHelperInfo.GetUserId(); objectFirst.IP = UserInfo.IP(); objectFirst.Agent = UserInfo.Agent(); objectFirst.Location = UserInfo.Location(); try { result = service.Update(objectFirst); msg += ""; } catch (Exception exc) { result = false; msg += exc.ToString(); } } else { Company objectFirst = new Company { Name = model.Name, Cell = model.Cell, Phone = model.Phone, Email = model.Email, Address = model.Address, ModifiedOn = DateTime.Now, UserID = UserHelperInfo.GetUserId(), IP = UserInfo.IP(), Agent = UserInfo.Agent(), Location = UserInfo.Location() }; try { result = service.Save(objectFirst); } catch (Exception exc) { result = false; msg += exc.ToString(); } } JsonResult jsonResult = new JsonResult { Data = result ? (new { Success = true, Msg = msg }) : (new { Success = false, Msg = msg }) }; return(jsonResult); }
public JsonResult Action(StudentActionModel model) { bool result; string msg = ""; if (model.ID > 0) { Student objectFirst = service.GetByID(model.ID); try { result = service.Update(objectFirst); } catch (Exception exc) { result = false; msg = exc.Message.ToString(); } } else { Student objectFirst = new Student { FirstName = model.FirstName, LastName = model.LastName, CNIC = model.CNIC, FatherName = model.FatherName, FatherCNIC = model.FatherCNIC, FatherProfession = model.FatherProfession, StudentContact = model.StudentContact, FatherContact = model.FatherContact, EmergencyContact = model.EmergencyContact, DateOfBirth = model.DateOfBirth, BloodGroupID = model.BloodGroupID, Gender = model.Gender, MaritalStatus = model.MaritalStatus, CityID = model.CityID, PresentAddress = model.PresentAddress, PermenantAddress = model.PermenantAddress, IP = UserInfo.IP(), Agent = UserInfo.Agent(), Location = UserInfo.Location(), ModifiedOn = DateTime.Now, UserID = UserHelperInfo.GetUserId() }; try { result = service.Save(objectFirst); } catch (DbEntityValidationException exc) { foreach (var validationException in exc.EntityValidationErrors) { foreach (var ve in validationException.ValidationErrors) { msg += ve.PropertyName + "" + ve.ErrorMessage; } } result = false; } catch (Exception exc) { result = false; msg = exc.InnerException.ToString(); } } JsonResult jsonResult = new JsonResult { Data = result ? (new { Success = true, Msg = msg }) : (new { Success = false, Msg = msg }) }; return(jsonResult); }