コード例 #1
0
ファイル: CommentBL.cs プロジェクト: Thirlan/insideword
        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;
        }
コード例 #2
0
ファイル: CommentBL.cs プロジェクト: Thirlan/insideword
 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;
 }
コード例 #3
0
ファイル: AdminController.cs プロジェクト: Thirlan/insideword
        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);
        }
コード例 #4
0
ファイル: CommentBL.cs プロジェクト: Thirlan/insideword
 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;
 }