public EventArgsForAfterPageDataRequest(ServiceResultMsg srm, Dictionary <string, string> dss, string currPageNum, string perPageRowCount)
 {
     serviceResultMsg = srm;
     postData         = dss;
     CurrPageNum      = currPageNum;
     PerPageRowCount  = perPageRowCount;
 }
        public ServiceResultMsg RequestPageData(Dictionary <string, string> dss, string currPageNum, string perPageRowCount)
        {
            ServiceResultMsg srm = new ServiceResultMsg();

            srm.RetCode = "00";
            srm.Obj     =
                new Dictionary <string, object> {
                { "Obj", new List <Dictionary <string, string> > {
                      new Dictionary <string, string> {
                          { ServiceResultMsg.RecordCountName, "0" },
                          { ServiceResultMsg.PageCountName, "0" },
                          { ServiceResultMsg.CurrentPageName, currPageNum }
                      }
                  } },
                { "Objj", new List <Dictionary <string, string> > {
                      new Dictionary <string, string> {
                          { "A", "here is A1" + currPageNum },
                          { "B", "here is B1" + currPageNum }
                      }, new Dictionary <string, string> {
                          { "A", "here is A2" + currPageNum },
                          { "B", "here is B2" + currPageNum }
                      }, new Dictionary <string, string> {
                          { "A", "here is A3" + currPageNum },
                          { "B", "here is B3" + currPageNum }
                      }, new Dictionary <string, string> {
                          { "A", "here is A4" + currPageNum },
                          { "B", "here is B4" + currPageNum }
                      }, new Dictionary <string, string> {
                          { "A", "here is A5" + currPageNum },
                          { "B", "here is B5" + currPageNum }
                      }
                  } }
            };
            #region trigger After PageDataRequest event
            EventArgsForAfterPageDataRequest eventArgsForAfterPageDataRequest = new EventArgsForAfterPageDataRequest(srm: srm, dss: dss, currPageNum: currPageNum, perPageRowCount: perPageRowCount);
            if (false == OnAfterPageDataRequest(eventArgsForAfterPageDataRequest))
            {
                return(srm);
            }
            else
            {
            }
            #endregion
            return(srm);
        }
        /// <summary>
        /// Fill the Result Data to dsldssData
        /// </summary>
        /// <param name="resultMsg"></param>
        /// <param name="currPage"></param>
        /// <param name="perPageRowCount"></param>
        /// <returns></returns>
        public Dictionary <string, List <Dictionary <string, string> > > fillResultDataToResultDict(ServiceResultMsg resultMsg, String currPage = "1", String perPageRowCount = "5")
        {
            Dictionary <string, List <Dictionary <string, string> > > resultData = new Dictionary <string, List <Dictionary <string, string> > >();

            try
            {
                Dictionary <String, List <Dictionary <String, String> > > dldss = RequestBus.ConvertResultMsgProperty <Dictionary <String, List <Dictionary <String, String> > > >(resultMsg.Obj);
                List <Dictionary <String, String> > ldss = dldss.TryGetValue(ServiceResultMsg.DataRecordsName, out ldss) ? ldss : ldss;
                resultData[Name] = ldss;
                ldss             = dldss.TryGetValue(ServiceResultMsg.DataInfoName, out ldss) ? ldss : ldss;
                string recordCount = "", pageCount = "", currentPage = "";
                ldss.ForEach(delegate(Dictionary <string, string> _dss)
                {
                    _dss.TryGetValue(ServiceResultMsg.RecordCountName, out recordCount);
                    _dss.TryGetValue(ServiceResultMsg.PageCountName, out pageCount);
                    _dss.TryGetValue(ServiceResultMsg.CurrentPageName, out currentPage);
                });
                currentPage = currentPage ?? currPage;
                int currentPageIndex = 0;
                int.TryParse(currentPage.Trim(), out currentPageIndex);
                currentPageIndex = --currentPageIndex;
                int rowTotalCount  = 0;
                int pageTotalCount = 0;
                int.TryParse(recordCount.Trim(), out rowTotalCount);
                pageCount = pageCount == "0" ? "1" : pageCount;
                int.TryParse(pageCount.Trim(), out pageTotalCount);
                resultData[InfoName] = (new List <Dictionary <string, string> > {
                    new Dictionary <string, string> {
                        { RowTotalCountKey, recordCount },
                        { PerPageRowCountKey, Math.Max(int.Parse(perPageRowCount), (0 == pageTotalCount? 0: ((rowTotalCount) / (pageTotalCount) + (0 == (rowTotalCount) % (pageTotalCount)?0:1)))).ToString() },
                        { PageTotalCountKey, pageCount },
                        { CurrPageIndexKey, currentPageIndex.ToString() },
                        { CurrPageNumKey, currentPage },
                        { RowCheckedStatusKey, "false" }
                    }
                });
            }
            catch (Exception ex)
            {
            }
            return(resultData);
        }