public JsonResult DeleteAssessmentGroup(long groupId) { bool isResult = false; int returnResult = 0; try { AssessmentGroup group = new FingerprintsModel.AssessmentGroup(); group.AssessmentGroupId = groupId; group.UserId = new Guid(Session["UserID"].ToString()); group.AgencyId = (Session["AgencyId"] != null) ? new Guid(Session["AgencyId"].ToString()) : (Guid?)null; const string command = "CHECKGROUPREF"; isResult = new MatrixData().CheckAssessmentGroup(group, command); if (isResult) { returnResult = 2; return(Json(returnResult, JsonRequestBehavior.AllowGet)); } isResult = new MatrixData().DeleteAssessmentGroup(group); if (isResult) { returnResult = 1; return(Json(returnResult, JsonRequestBehavior.AllowGet)); } } catch (Exception ex) { clsError.WriteException(ex); } return(Json(returnResult, JsonRequestBehavior.AllowGet)); }
public JsonResult UpdateAssessmentGroup(string groupType, long categoryId, int status, long groupId) { bool isResult = false; int returnResult = 0; try { string queryCommand = "UPDATECHECK"; AssessmentGroup assessmentGroup = new FingerprintsModel.AssessmentGroup(); assessmentGroup.UserId = new Guid(Session["UserID"].ToString()); assessmentGroup.AgencyId = (Session["AgencyId"] != null) ? new Guid(Session["AgencyId"].ToString()) : (Guid?)null; assessmentGroup.AssessmentCategoryId = categoryId; assessmentGroup.IsActive = Convert.ToBoolean(status); assessmentGroup.AssessmentGroupType = groupType; assessmentGroup.AssessmentGroupId = groupId; isResult = new MatrixData().CheckAssessmentGroup(assessmentGroup, queryCommand); if (isResult) { returnResult = 2; return(Json(returnResult, JsonRequestBehavior.AllowGet)); } isResult = new MatrixData().UpdateAssessmentGroup(assessmentGroup); returnResult = 1; return(Json(returnResult, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { clsError.WriteException(ex); return(Json(returnResult, JsonRequestBehavior.AllowGet)); } }