Beispiel #1
0
        public static bool LoadData(DataTable table, string rulename, string paramvalue, string pageinfo, string defwhere, string dsname)
        {
            try
            {
                InParams  inparams  = SDPClient.NewInParams();
                OutParams outparams = SDPClient.NewOutParams();

                inparams.SetRequestBody("ServiceName", "DataServices");
                inparams.SetRequestBody("ServiceItem", "LoadData");
                inparams.SetRequestBody("RuleName", rulename);
                inparams.SetRequestBody("DefWhere", defwhere);
                inparams.SetRequestBody("PageInfo", pageinfo);
                inparams.SetRequestBody("DataSource", dsname);
                inparams.SetRequestParams(paramvalue);

                SDPClient.CallService(inparams, outparams);

                DataTable resultTable = outparams.GetTableParam(rulename).GetDataTableValue();
                if (table.Columns.Count <= 0)
                {
                    DataUtil.InitTableSchemaFromDataRule(table, rulename);
                }

                return(DataUtil.CopyTable(resultTable, table));
            }
            catch (Exception e)
            {
                System.Console.Out.WriteLine("DataServices.LoadData Exception: {0}", e);
                throw e;
            }
        }
Beispiel #2
0
        public static String CallCursorStoreProcExt(DataTable table, String procname, String paramvalue, String dsname)
        {
            try
            {
                InParams  inparams  = SDPClient.NewInParams();
                OutParams outparams = SDPClient.NewOutParams();

                inparams.SetRequestBody("ServiceName", "DataServices");
                inparams.SetRequestBody("ServiceItem", "CallStoreProc");
                inparams.SetRequestBody("StoreProcType", "CursorStoreProcExt");
                inparams.SetRequestBody("StoreProcName", procname);
                inparams.SetRequestBody("DataSource", dsname);
                inparams.SetRequestParams(paramvalue);

                SDPClient.CallService(inparams, outparams);

                DataTable resulttable = outparams.GetTableParamValue(0);
                DataUtil.CopyTable(resulttable, table);

                return(outparams.GetStrParamValue("Result"));
            }
            catch (Exception e)
            {
                System.Console.Out.WriteLine("DataServices.CallCursorStoreProcExt Exception: {0}", e);
                throw e;
            }
        }
Beispiel #3
0
        public static DataRule LoadDataInfo(DataTable table, String rulename, String paramvalue, String pageinfo, String defwhere, String dsname)
        {
            try
            {
                InParams  inparams  = SDPClient.NewInParams();
                OutParams outparams = SDPClient.NewOutParams();

                inparams.SetRequestBody("ServiceName", "DataServices");
                inparams.SetRequestBody("ServiceItem", "LoadDataInfo");
                inparams.SetRequestBody("RuleName", rulename);
                inparams.SetRequestBody("DefWhere", defwhere);
                inparams.SetRequestBody("PageInfo", pageinfo);
                inparams.SetRequestBody("DataSource", dsname);
                inparams.SetRequestParams(paramvalue);

                SDPClient.CallService(inparams, outparams);

                DataRule rule = new DataRule(rulename, outparams);
                SystemContext.RuleManager.AppendDataRule(rule);

                DataTable resulttable = outparams.GetTableParam(rulename).GetDataTableValue();

                DataUtil.InitTableSchemaFromDataRule(table, rule);

                DataUtil.CopyTable(resulttable, table);

                return(rule);
            }
            catch (Exception e)
            {
                System.Console.Out.WriteLine("DataServices.LoadDataInfo Exception: {0}", e);
                throw e;
            }
        }
Beispiel #4
0
        private void button_callService_Click(object sender, EventArgs e)
        {
            InParams  inparams  = SDPClient.NewInParams(comboBox_proCode.Text.Trim());
            OutParams outparams = SDPClient.NewOutParams();

            inparams.SetRequestBody(textBox_reqBody.Text.Trim());
            inparams.SetRequestParams(textBox_reqParams.Text.Trim());

            CallService(inparams, outparams);
        }
Beispiel #5
0
        public static String GetStrValueFromService(String servicename, String serviceitem, String serviceparams)
        {
            try
            {
                InParams  inparams  = SDPClient.NewInParams();
                OutParams outparams = SDPClient.NewOutParams();

                inparams.SetRequestBody("ServiceName", servicename);
                inparams.SetRequestBody("ServiceItem", serviceitem);
                inparams.SetRequestParams(serviceparams);

                SDPClient.RouteService(inparams, outparams);

                return(outparams.GetStrParamValue(0));
            }
            catch (Exception e)
            {
                System.Console.Out.WriteLine("CommonServices.GetStrValueFromService Exception: {0}", e);
                throw e;
            }
        }
Beispiel #6
0
        public static bool OpenSql(DataTable table, String sql, String paramvalue, String pageinfo, String dsname)
        {
            try
            {
                InParams  inparams  = SDPClient.NewInParams();
                OutParams outparams = SDPClient.NewOutParams();

                inparams.SetRequestBody("ServiceName", "DataServices");
                inparams.SetRequestBody("ServiceItem", "OpenSql");
                inparams.SetRequestBody("SQL", sql);
                inparams.SetRequestBody("PageInfo", pageinfo);
                inparams.SetRequestBody("DataSource", dsname);

                if (TableUtil.IsAutoMetaData(table))
                {
                    inparams.SetRequestBody("AutoMetaData", "1");
                }
                else
                {
                    inparams.SetRequestBody("TableName", table.TableName);
                }

                inparams.SetRequestParams(paramvalue);

                SDPClient.CallService(inparams, outparams);

                DataTable resulttable = outparams.GetTableParam(0).GetDataTableValue();
                DataUtil.CopyTable(resulttable, table);

                TableUtil.SetProperty(table, "DataSource", outparams.GetStrParamValue("DataSource"));
                TableUtil.SetProperty(table, "Command", outparams.GetStrParamValue("Command"));

                return(true);
            }
            catch (Exception e)
            {
                System.Console.Out.WriteLine("DataServices.OpenSql Exception: {0}", e);
                throw e;
            }
        }
Beispiel #7
0
        public static void CallService(DataTable table, String servicename, String serviceitem, String paramvalue)
        {
            try
            {
                InParams  inparams  = SDPClient.NewInParams();
                OutParams outparams = SDPClient.NewOutParams();

                inparams.SetRequestBody("ServiceName", servicename);
                inparams.SetRequestBody("ServiceItem", serviceitem);
                inparams.SetRequestParams(paramvalue);

                SDPClient.CallService(inparams, outparams);

                DataTable resulttable = outparams.GetTableParamValue(0);
                DataUtil.CopyTable(resulttable, table);
            }
            catch (Exception e)
            {
                System.Console.Out.WriteLine("DataServices.CallService Exception: {0}", e);
                throw e;
            }
        }
Beispiel #8
0
        public static String CallStoreProc(String procname, String paramvalue, String dsname)
        {
            try
            {
                InParams  inparams  = SDPClient.NewInParams();
                OutParams outparams = SDPClient.NewOutParams();

                inparams.SetRequestBody("ServiceName", "DataServices");
                inparams.SetRequestBody("ServiceItem", "CallStoreProc");
                inparams.SetRequestBody("StoreProcType", "StoreProc");
                inparams.SetRequestBody("StoreProcName", procname);
                inparams.SetRequestBody("DataSource", dsname);
                inparams.SetRequestParams(paramvalue);

                SDPClient.CallService(inparams, outparams);

                return(outparams.GetStrParam("Result").GetStrValue());
            }
            catch (Exception e)
            {
                System.Console.Out.WriteLine("DataServices.CallStoreProc Exception: {0}", e);
                throw e;
            }
        }