Esempio n. 1
0
        public ActionResult ExamTypeGridViewPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] Qiyas.BusinessLogicLayer.Entity.PPM.ExamType item)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    if (!ExamTypeExists(item.Name, item.ExaminationTypeID))
                    {
                        BusinessLogicLayer.Entity.PPM.ExamType type = new BusinessLogicLayer.Entity.PPM.ExamType(item.ExaminationTypeID);
                        type.Name         = item.Name;
                        type.IsActive     = item.IsActive;
                        type.ModifiedDate = DateTime.Now;
                        type.Save();
                    }
                    else
                    {
                        ViewData["EditError"] = Resources.MainResource.ExamTypeExists;
                    }

                    // Insert here a code to update the item in your model
                }
                catch (Exception e)
                {
                    ViewData["EditError"] = e.Message;
                }
            }
            else
            {
                ViewData["EditError"] = Resources.MainResource.PleaseCorrectErrors;
            }
            var model = new BusinessLogicLayer.Components.PPM.ExamTypeLogic().GetAll();

            return(PartialView("_ExamTypeGridViewPartial", model));
        }
Esempio n. 2
0
        private bool ExamTypeExists(string name, int id)
        {
            var currentUser = new BusinessLogicLayer.Entity.PPM.ExamType(id);
            var checkUser   = new BusinessLogicLayer.Components.PPM.ExamTypeLogic().GetByName(name);

            if (checkUser == null)
            {
                return(false);
            }
            if (!currentUser.HasObject && checkUser != null)
            {
                return(true);
            }
            else if (currentUser.HasObject && checkUser != null && currentUser.ExaminationTypeID != checkUser.ExaminationTypeID)
            {
                return(true);
            }

            return(false);
        }
Esempio n. 3
0
        public ActionResult ExamTypeGridViewPartialDelete(System.Int32 ExaminationTypeID)
        {
            if (ExaminationTypeID >= 0)
            {
                try
                {
                    BusinessLogicLayer.Components.PPM.ExamTypeLogic logic = new BusinessLogicLayer.Components.PPM.ExamTypeLogic();
                    if (!logic.HasDependencies(ExaminationTypeID))
                    {
                        BusinessLogicLayer.Entity.PPM.ExamType type = new BusinessLogicLayer.Entity.PPM.ExamType(ExaminationTypeID);
                        type.Delete();
                    }

                    // Insert here a code to delete the item from your model
                }
                catch (Exception e)
                {
                    ViewData["EditError"] = e.Message;
                }
            }
            var model = new BusinessLogicLayer.Components.PPM.ExamTypeLogic().GetAll();

            return(PartialView("_ExamTypeGridViewPartial", model));
        }