public Qiyas.BusinessLogicLayer.Entity.PPM.ExamPeriod GetByName(string name) { Qiyas.BusinessLogicLayer.Entity.PPM.ExamPeriod examType = null; var ex = db.ExamPeriods.Where(c => c.Name == name).FirstOrDefault(); if (ex != null) { examType = new Entity.PPM.ExamPeriod(ex); } return(examType); }
public ActionResult ExamPeriodGridViewPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] Qiyas.BusinessLogicLayer.Entity.PPM.ExamPeriod item) { ViewBag.ExamYear = Convert.ToInt32(BusinessLogicLayer.Tools.GregToHijriYear(DateTime.Today)); if (ModelState.IsValid) { try { if (!ExamPeriodExists(item.Name, item.ExamPeriodID)) { if (item.EndDate > item.StartDate) { ViewData["EditError"] = "تاريخ البداية يجب ان يكون اقل من تاريخ النهاية"; } else { BusinessLogicLayer.Entity.PPM.ExamPeriod period = new BusinessLogicLayer.Entity.PPM.ExamPeriod(item.ExamPeriodID); period.Name = item.Name; period.ExamTypeID = item.ExamTypeID; period.IsActive = item.IsActive; period.StudentGenderID = item.StudentGenderID; period.ExamYear = item.ExamYear; period.StartDate = item.StartDate; period.EndDate = item.EndDate; period.ModifiedDate = DateTime.Now; period.CreatedDate = DateTime.Now; period.Save(); } } else { ViewData["EditError"] = Resources.MainResource.ExamSpecialityTitle; } } catch (Exception e) { ViewData["EditError"] = e.Message; } } else { ViewData["EditError"] = Resources.MainResource.PleaseCorrectErrors; } var model = new BusinessLogicLayer.Components.PPM.ExamPeriodLogic().GetAll(); return(PartialView("_ExamPeriodGridViewPartial", model)); }