Esempio n. 1
0
        public static JqGridResponse Edit(EditCommentManagementVM model, ProviderCurrentMember currentMember)
        {
            JqGridResponse aResponse = new JqGridResponse();
            ProviderComment aComment = new ProviderComment(model.Id);
            if (currentMember.CanEdit(aComment))
            {
                aComment.IgnoreFlags = model.IgnoreFlags;
                aComment.IsHidden = model.IsHidden;
                try
                {
                    aComment.Save();
                    aResponse.Success = true;
                }
                catch(Exception caughtException)
                {
                    aResponse.Success = false;
                    aResponse.Message = ErrorStrings.OPERATION_FAILED;
                }
            }
            else
            {
                aResponse.Success = false;
                aResponse.Message = ErrorStrings.OPERATION_NO_RIGHTS;
            }

            return aResponse;
        }
Esempio n. 2
0
 public static JqGridResponse Delete(EditCommentManagementVM model, ProviderCurrentMember currentMember)
 {
     JqGridResponse aResponse = new JqGridResponse();
     ProviderComment aComment = new ProviderComment(model.Id);
     if (currentMember.CanEdit(aComment))
     {
         if(aComment.Delete())
         {
             aResponse.Success = true;
         }
         else
         {
             aResponse.Success = false;
             aResponse.Message = ErrorStrings.OPERATION_FAILED;
         }
     }
     else
     {
         aResponse.Success = false;
         aResponse.Message = ErrorStrings.OPERATION_NO_RIGHTS;
     }
     return aResponse;
 }
Esempio n. 3
0
        public virtual ActionResult _EditJqGridComment(EditCommentManagementVM model)
        {
            JqGridResponse aResponse;
            if (ModelState.IsValid)
            {
                try
                {
                    aResponse = CommentBL.Process(model, ProviderCurrentMember.Instance);
                }
                catch (Exception caughtException)
                {
                    // DO NOT LOG THIS
                    aResponse = new JqGridResponse();
                    aResponse.Success = false;
                    aResponse.Message = caughtException.ToString();
                }
            }
            else
            {
                aResponse = new JqGridResponse();
                aResponse.Success = false;
                aResponse.Message = ErrorStrings.INVALID_INPUT;
            }

            return Json(aResponse);
        }
Esempio n. 4
0
 public static JqGridResponse Process(EditCommentManagementVM model, ProviderCurrentMember currentMember)
 {
     JqGridResponse aResponse;
     if (model.Oper.CompareTo("edit") == 0)
     {
         aResponse = Edit(model, currentMember);
     }
     else if (model.Oper.CompareTo("del") == 0)
     {
         aResponse = Delete(model, currentMember);
     }
     else
     {
         aResponse = new JqGridResponse();
         aResponse.Success = false;
         aResponse.Message = ErrorStrings.OPERATION_UNKNOWN(model.Oper);
     }
     return aResponse;
 }