Ejemplo n.º 1
0
        public ActionResult GridViewPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] Qiyas.BusinessLogicLayer.Entity.PPM.ExamSpeciality item)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    if (!ExamSpecialityExists(item.Name, item.ExamTypeID.Value, item.ExamSpecialityID))
                    {
                        BusinessLogicLayer.Entity.PPM.ExamSpeciality speciality = new BusinessLogicLayer.Entity.PPM.ExamSpeciality(item.ExamSpecialityID);
                        speciality.ExamTypeID   = item.ExamTypeID;
                        speciality.Name         = item.Name;
                        speciality.IsActive     = item.IsActive;
                        speciality.ModifiedDate = DateTime.Now;
                        speciality.Save();
                    }
                    else
                    {
                        ViewData["EditError"] = Resources.MainResource.ExamSpecialityExists;
                    }
                }
                catch (Exception e)
                {
                    ViewData["EditError"] = e.Message;
                }
            }
            else
            {
                ViewData["EditError"] = Resources.MainResource.PleaseCorrectErrors;
            }
            var model = new BusinessLogicLayer.Components.PPM.ExamSpecialityLogic().GetAll();

            return(PartialView("_GridViewPartial", model));
        }
Ejemplo n.º 2
0
        private bool ExamSpecialityExists(string name, int ExamTypeID, int id)
        {
            var currentUser = new BusinessLogicLayer.Entity.PPM.ExamSpeciality(id);
            var checkUser   = new BusinessLogicLayer.Components.PPM.ExamSpecialityLogic().GetByNameandType(name, ExamTypeID);

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

            return(false);
        }
Ejemplo n.º 3
0
        public ActionResult GridViewPartialDelete(System.Int32 ExamSpecialityID)
        {
            if (ExamSpecialityID >= 0)
            {
                try
                {
                    BusinessLogicLayer.Components.PPM.ExamSpecialityLogic logic = new BusinessLogicLayer.Components.PPM.ExamSpecialityLogic();
                    if (!logic.HasDependencies(ExamSpecialityID))
                    {
                        BusinessLogicLayer.Entity.PPM.ExamSpeciality type = new BusinessLogicLayer.Entity.PPM.ExamSpeciality(ExamSpecialityID);
                        type.Delete();
                    }
                }
                catch (Exception e)
                {
                    ViewData["EditError"] = e.Message;
                }
            }
            var model = new BusinessLogicLayer.Components.PPM.ExamSpecialityLogic().GetAll();

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