Exemplo n.º 1
0
        private void DrawItemListTable(Dictionary <String, String> dssPostPut = null)
        {
            #region prepare data for table
            DataTable dt = new DataTable("ExampleItem", "ExampleList");
            dssPostPut = dssPostPut ?? RequestBus.GetPostPutData(Request: Request);

            string jumpdata = RequestBus.Param("jumpdata");
            List <Dictionary <string, string> > ldss = new List <Dictionary <string, string> >();

            string tableExampleInformationQueryItemListPerPageRowCount = dssPostPut.TryGetValue("ChangeExampleInformationQueryItemListPerPageRowCountTo", out tmpStr) ? tmpStr : "5";
            string tableExampleInformationQueryItemListCurrPageNum     = "1";

            #region set data to the view

            string exampleType = vEL_QExampleType.Text = dssPostPut.TryGetValue("QExampleType", out exampleType) ? exampleType : String.Empty;
            tableExampleInformationQueryItemListPerPageRowCount = vELTableExampleInformationQueryItemList_PerPageRowCount.Text = dssPostPut.TryGetValue("vELTableExampleInformationQueryItemListPerPageRowCount", out tmpStr) ? tmpStr : tableExampleInformationQueryItemListPerPageRowCount;
            tableExampleInformationQueryItemListCurrPageNum     = vELTableExampleInformationQueryItemList_CurrPageNum.Text = dssPostPut.TryGetValue("vELTableExampleInformationQueryItemListCurrPageNum", out tmpStr) ? tmpStr : tableExampleInformationQueryItemListCurrPageNum;
            string tableExampleInformationQueryItemListPageTotalCount = vELTableExampleInformationQueryItemList_PageTotalCount.Text = dssPostPut.TryGetValue("vELTableExampleInformationQueryItemListPerPageRowCount", out tmpStr) ? tmpStr : tableExampleInformationQueryItemListCurrPageNum;
            string tableExampleInformationQueryItemListRowTotalCount  = vELTableExampleInformationQueryItemList_RowTotalCount.Text = dssPostPut.TryGetValue("vELTableExampleInformationQueryItemListRowTotalCount", out tmpStr) ? tmpStr : "X";

            #endregion

            int perPageRowCount = int.TryParse(tableExampleInformationQueryItemListPerPageRowCount, out perPageRowCount) ? perPageRowCount : 5;

            /*
             * Use RFDataTable to deal with the data.
             * */
            RFDataTable rfdteiqil = new RFDataTable("vELTableExampleInformationQueryItemList", request: Request, response: Response);
            rfdteiqil.BeforePageChange += new RFDataTable.BeforePageChangeHandler(rfdteiqil_BeforePageChange);
            rfdteiqil.WhenPageChange   += new RFDataTable.WhenPageChangeHandler(rfdteiqil_WhenPageChange);
            rfdteiqil.AfterPageChange  += new RFDataTable.AfterPageChangeHandler(rfdteiqil_AfterPageChange);
            dataSet.Tables.Add(
                rfdteiqil.ChangePageTo(
                    currPage: tableExampleInformationQueryItemListCurrPageNum,
                    perPageRowCount: perPageRowCount.ToString(),
                    dssPostData: dssPostPut,
                    dataTableName: "TableExampleInformationQueryItemList",
                    dataTableNamespace: "ExampleList",
                    columnKeyIDPair: new Dictionary <string, string> {
                { "RowCount", "id" }
                , { "Code", "code" }
                , { "Name", "name" }
                , { "Status", "status" }
                , { "Description", "description" }
            }
                    , t: vELTableExampleInformationQueryItemList
                    )
                );
            #endregion

            #region draw data table with data
            try
            {
                RF.GlobalClass.WebForm.fillTableAccordingToData(vELTableExampleInformationQueryItemList, dataSet.Tables["TableExampleInformationQueryItemList", "ExampleList"]);
            }
            catch (Exception ex) { }
            #endregion
        }
Exemplo n.º 2
0
            /// <summary>
            /// Get data for table list
            /// </summary>
            /// <param name="tableName"></param>
            /// <param name="tableNameSpace"></param>
            /// <param name="tableCurrPageNum"></param>
            /// <param name="tablePerPageRowCount"></param>
            /// <param name="beforePageChange"></param>
            /// <param name="whenPageChange"></param>
            /// <param name="afterPageChange"></param>
            /// <param name="request"></param>
            /// <param name="response"></param>
            /// <param name="table"></param>
            /// <param name="columnKeyIDPair"></param>
            /// <param name="perPageRowCountControl"></param>
            /// <param name="currPageNumControl"></param>
            /// <param name="pageTatolCountControl"></param>
            /// <param name="rowTotalCountControl"></param>
            /// <param name="perPageRowCountName"></param>
            /// <param name="currPageNumName"></param>
            /// <param name="pageTotalCountName"></param>
            /// <param name="rowTotalCountName"></param>
            /// <param name="jumpingDataName"></param>
            /// <param name="perPageRowCountParamName"></param>
            /// <param name="dataSet"></param>
            /// <example>
            /// <code language="CSharp" description="">
            /// WebAppOffice.GB.WebReference.getDataForListTable(tableName: "", tableNameSpace: "", tableCurrPageNum: "1", tablePerPageRowCount: "10",
            ///     beforePageChange: (new WebAppOffice.RFDataTable.BeforePageChangeHandler(rfdtarql_BeforePageChange)),
            ///     whenPageChange: (new WebAppOffice.RFDataTable.WhenPageChangeHandler(rfdtarql_WhenPageChange)),
            ///     afterPageChange: (new WebAppOffice.RFDataTable.AfterPageChangeHandler(rfdtarql_AfterPageChange)),
            ///     request: Request, response: Response,
            ///     table: v2_TableInformationQueryItemList,
            ///     columnKeyIDPair: new Dictionary<string, string> {
            ///     { "Code", "dptid" }, { "Name", "dptdes" },
            ///     { "Address", "adr1" }, { "PhoneNumber", "tel" },
            ///     {"Section","prtdptid"},{"EffectsRadius","jl"},
            ///     {"MasterName","xm"},{"MasterPhoneNumber","sj"},
            ///     {"SectionDirectorName","prtdz"},{"SectionDirectorPhoneNumber","prtdztel"} },
            ///     perPageRowCountControl: v2_TableInformationQueryItemList_PerPageRowCount,
            ///     currPageNumControl: v2_TableInformationQueryItemList_CurrPageNum,
            ///     pageTatolCountControl: v2_TableInformationQueryItemList_PageTotalCount,
            ///     rowTotalCountControl: v2_TableInformationQueryItemList_RowTotalCount,
            ///     perPageRowCountName: "PerPageRowCount",
            ///     currPageNumName: "CurrPageNum",
            ///     pageTotalCountName: "pageTotalCount",
            ///     rowTotalCountName: "RowTotalCount",
            ///     jumpingDataName: "jumpdata",
            ///     perPageRowCountParamName: "PerPageRowCount", dataSet:dataSet);
            /// </code>
            /// </example>
            public static void getDataForListTable(string tableName, string tableNameSpace, string tableCurrPageNum, string tablePerPageRowCount, RFDataTable.BeforePageChangeHandler beforePageChange, RFDataTable.WhenPageChangeHandler whenPageChange, RFDataTable.AfterPageChangeHandler afterPageChange, HttpRequest request, HttpResponse response, System.Web.UI.WebControls.Table table, Dictionary <string, string> columnKeyIDPair, System.Web.UI.WebControls.DropDownList perPageRowCountControl, System.Web.UI.WebControls.TextBox currPageNumControl, System.Web.UI.WebControls.Label pageTatolCountControl, System.Web.UI.WebControls.Label rowTotalCountControl, string perPageRowCountName, string currPageNumName, string pageTotalCountName, string rowTotalCountName, string jumpingDataName, string perPageRowCountParamName, System.Data.DataSet dataSet, RFDataTable rfDataTable)
            {
                Dictionary <string, string> dssPost = new Dictionary <string, string>();
                Dictionary <string, string> dssPut  = RequestBus.GetPutData(request);
                Dictionary <String, List <Dictionary <string, string> > > dsldssPost = RequestBus.GetPostData <Dictionary <String, List <Dictionary <string, string> > > >(request);
                AjaxResponse ar = new AjaxResponse();

                ar.data = dsldssPost;
                string jumpdata = RequestBus.Param(jumpingDataName);
                List <Dictionary <string, string> > ldss = new List <Dictionary <string, string> >();

                rfDataTable      = rfDataTable ?? new RFDataTable(tableName, request: request, response: response);
                rfDataTable.Name = tableName ?? rfDataTable.Name;
                tableName        = rfDataTable.Name;

                if (null != dsldssPost && ((dsldssPost.TryGetValue(jumpdata, out ldss)) || dsldssPost.ContainsKey(tableName + perPageRowCountParamName)))
                {
                    #region set data to the view
                    // ldss[0].TryGetValue("", out jumpdata);
                    dssPost = (ldss.Count > 0 ? (ldss[0] ?? dssPost) : dssPost);
                    dssPut.ToList().ForEach(x => dssPost[x.Key] = dssPost.ContainsKey(x.Key) ? dssPost[x.Key] : x.Value);
                    //string beginDate = v0_BeginDate.Text = dssPost.TryGetValue("BeginDate", out beginDate) ? beginDate : String.Empty;
                    //string endDate = v0_EndDate.Text = dssPost.TryGetValue("EndDate", out endDate) ? endDate : String.Empty;
                    perPageRowCountControl.Text = tablePerPageRowCount ?? perPageRowCountControl.Text;
                    tablePerPageRowCount        = perPageRowCountControl.Text = dssPost.TryGetValue(tableName + perPageRowCountName, out tablePerPageRowCount) ? tablePerPageRowCount : perPageRowCountControl.Text;
                    tableCurrPageNum            = currPageNumControl.Text = dssPost.TryGetValue(tableName + currPageNumName, out tableCurrPageNum) ? tableCurrPageNum : tableCurrPageNum;
                    string TablePageTotalCount = pageTatolCountControl.Text = dssPost.TryGetValue(tableName + pageTotalCountName, out TablePageTotalCount) ? TablePageTotalCount : tableCurrPageNum;
                    string TableRowTotalCount  = rowTotalCountControl.Text = dssPost.TryGetValue(tableName + rowTotalCountName, out TableRowTotalCount) ? TableRowTotalCount : "X";

                    #endregion
                }
                else
                {
                }

                int perPageRowCount = int.TryParse(tablePerPageRowCount, out perPageRowCount) ? perPageRowCount : 5;

                rfDataTable.BeforePageChange += new RFDataTable.BeforePageChangeHandler(beforePageChange);
                rfDataTable.WhenPageChange   += new RFDataTable.WhenPageChangeHandler(whenPageChange);
                rfDataTable.AfterPageChange  += new RFDataTable.AfterPageChangeHandler(afterPageChange);
                dataSet.Tables.Add(rfDataTable.ChangePageTo(
                                       currPage: tableCurrPageNum,
                                       perPageRowCount: perPageRowCount.ToString(),
                                       dssPostData: dssPost,
                                       dataTableName: tableName,
                                       dataTableNamespace: tableNameSpace,
                                       columnKeyIDPair: columnKeyIDPair,
                                       t: table));
            }
Exemplo n.º 3
0
        protected void MultiViewMenu_Load(object sender, EventArgs e)
        {
            Dictionary <string, string> dss = RequestBus.GetPutData(Request: Request);
            string check     = String.Empty;
            string change    = string.Empty;
            string view      = String.Empty;
            int    viewIndex = 0;

            if (dss.TryGetValue("go", out check))
            {
                switch (check)
                {
                default: break;
                }
            }
            else
            {
            }
            if (dss.TryGetValue("do", out check))
            {
                switch (check)
                {
                //case "addJobTransfer":
                //    addJobTransfer();
                //    break;
                //case "checkJobTransfer":
                //    checkJobTransfer();
                //break;
                default: break;
                }
            }
            //else if (dss.TryGetValue("ChangeExampleInformationQueryItemListPerPageRowCountTo", out change))
            //{
            //        DrawItemListTable();
            //     // reloadMainInformationQueryItemList(change);
            //}
            else if (dss.TryGetValue("ChangeExampleInformationQueryItemListPageTo", out change))
            {
                RFDataTable rfdteiqil = new RFDataTable("vELTableExampleInformationQueryItemList", request: Request, response: Response);
                rfdteiqil.BeforePageChange += new RFDataTable.BeforePageChangeHandler(rfdteiqil_BeforePageChange);
                rfdteiqil.WhenPageChange   += new RFDataTable.WhenPageChangeHandler(rfdteiqil_WhenPageChange);
                rfdteiqil.AfterPageChange  += new RFDataTable.AfterPageChangeHandler(delegate(object o, RFDataTable.EventArgsForAfterPageChange _e)
                {
                    return(!rfdteiqil_AfterPageChange(o, _e));
                });
                rfdteiqil.ChangePageTo(currPage: change
                                       , perPageRowCount: "0"
                                       , dataTableName: "TableExampleInformationQueryItemList"
                                       , dataTableNamespace: "ExampleList"
                                       , columnKeyIDPair: new Dictionary <string, string> {
                    { "RowCount", "id" }
                    , { "Code", "code" }
                    , { "Name", "name" }
                    , { "Status", "status" }
                    , { "Description", "description" }
                });
            }
            else if (dss.TryGetValue("view", out view) && !int.TryParse(view, out viewIndex))
            {
                try
                {
                    MultiViewMenu.SetActiveView(MultiViewMenu.FindControl(view) as View);
                }
                catch (Exception ex)
                {
                    MultiViewMenu.ActiveViewIndex = viewIndex;
                }
            }
            else
            {
                try
                {
                    int.TryParse(view, out viewIndex);
                    MultiViewMenu.ActiveViewIndex = viewIndex;
                }
                catch (Exception ex)
                {
                    MultiViewMenu.ActiveViewIndex = MultiViewMenu.Views.Count - 1;
                    RequestBus.jumpToAuthorization(Response: Response);
                }
            }
        }