Exemplo n.º 1
0
 public AccountEditArticleVM()
 {
     _jqGridEdit = new JqGridEditArticleVM();
 }
Exemplo n.º 2
0
        public virtual JsonResult _EditJqGridArticle(JqGridEditArticleVM model)
        {
            JqGridResponse aResponse;
            if ( ModelState.IsValid )
            {
                try
                {
                    aResponse = ArticleBL.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);
        }
Exemplo n.º 3
0
 public static JqGridResponse Process(JqGridEditArticleVM 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;
 }
Exemplo n.º 4
0
 public static JqGridResponse Delete(JqGridEditArticleVM model, ProviderCurrentMember currrentMember)
 {
     JqGridResponse aResponse = new JqGridResponse();
     ProviderArticle anArticle = new ProviderArticle(model.Id);
     if (currrentMember.CanEdit(anArticle))
     {
         if (anArticle.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;
 }
Exemplo n.º 5
0
        public static JqGridResponse Edit(JqGridEditArticleVM model, ProviderCurrentMember currentMember)
        {
            JqGridResponse aResponse = new JqGridResponse();
            ProviderArticle anArticle = new ProviderArticle(model.Id);
            if (currentMember.CanEdit(anArticle))
            {
                anArticle.IgnoreFlags = model.IgnoreFlags;
                anArticle.IsHidden = model.IsHidden;
                anArticle.IsPublished = model.IsPublished;
                try
                {
                    anArticle.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;
        }