Пример #1
0
 public MultiFuncComparer(SortFieldInfo <T, TKey1> sortFieldInfo1, SortFieldInfo <T, TKey2> sortFieldInfo2) :
     base(new FuncComparer <T, TKey1>(sortFieldInfo1.KeySelector, sortFieldInfo1.SortOrder),
          new FuncComparer <T, TKey2>(sortFieldInfo2.KeySelector, sortFieldInfo2.SortOrder))
 {
 }
Пример #2
0
        public override ClientResult ProcessRequest()
        {
            ClientResult cr = null;

            string mdfAccount = c.GetEmpAccount();

            if (string.IsNullOrEmpty(mdfAccount))
            {
                cr = new ClientResult()
                {
                    b   = false,
                    err = "invalid login status"
                };

                return(cr);
            }

            string token = GetParamValue("token");
            ArticleAjaxAuthData authData = null;

            if (!HandleAuthToken(token, c.GetEmpAccount(), out authData))
            {
                cr = new ClientResult()
                {
                    b   = false,
                    err = "invalid token"
                };

                return(cr);
            }

            string artId = GetParamValue("artId");
            Guid   articleId;

            if (!Guid.TryParse(artId, out articleId))
            {
                cr = new ClientResult()
                {
                    b   = false,
                    err = "invalid artId"
                };

                return(cr);
            }

            string sortField     = GetParamValue("sortField");
            string strIsSortDesc = GetParamValue("isSortDesc");
            bool   isSortDesc    = false;

            if (strIsSortDesc == "")
            {
                strIsSortDesc = isSortDesc.ToString();
            }
            else
            {
                isSortDesc = Convert.ToBoolean(strIsSortDesc);
            }

            if (sortField == "")
            {
                strIsSortDesc = "";
            }

            ArticlePublisherLogic artPub = new ArticlePublisherLogic();

            ArticleUpdateSortFieldOfFrontStageParams param = new ArticleUpdateSortFieldOfFrontStageParams()
            {
                ArticleId              = articleId,
                SortFieldOfFrontStage  = sortField,
                IsSortDescOfFrontStage = isSortDesc,
                MdfAccount             = mdfAccount,
                AuthUpdateParams       = new AuthenticationUpdateParams()
                {
                    CanEditSubItemOfOthers = authData.CanEditSubItemOfOthers,
                    CanEditSubItemOfCrew   = authData.CanEditSubItemOfCrew,
                    CanEditSubItemOfSelf   = authData.CanEditSubItemOfSelf,
                    MyAccount = c.GetEmpAccount(),
                    MyDeptId  = c.GetDeptId()
                }
            };

            bool result = artPub.UpdateArticleSortFieldOfFrontStage(param);

            if (result)
            {
                SortFieldInfo sortFieldInfo = new SortFieldInfo()
                {
                    sortField  = sortField,
                    isSortDesc = strIsSortDesc
                };

                cr = new ClientResult()
                {
                    b = true,
                    o = sortFieldInfo
                };
            }
            else
            {
                cr = new ClientResult()
                {
                    b = false, err = "update failed"
                };
            }

            return(cr);
        }