Пример #1
0
        public static DataRule LoadDataInfo(DataTable table, string rulename, string paramvalue, string pageinfo)
        {
            try
            {
                InParams  inparams  = SDPClient.NewInParams();
                OutParams outparams = SDPClient.NewOutParams();

                inparams.SetRequestBody("ServiceName", "DataServices");
                inparams.SetRequestBody("ServiceItem", "LoadDataInfo");
                inparams.SetRequestBody("RuleName", rulename);
                inparams.SetRequestBody("PageInfo", pageinfo);
                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;
            }
        }
Пример #2
0
        public static bool LoadData(DataTable table, string rulename, string paramvalue, string pageinfo)
        {
            try
            {
                InParams  inparams  = SDPClient.NewInParams();
                OutParams outparams = SDPClient.NewOutParams();

                inparams.SetRequestBody("ServiceName", "DataServices");
                inparams.SetRequestBody("ServiceItem", "LoadData");
                inparams.SetRequestBody("RuleName", rulename);
                inparams.SetRequestBody("PageInfo", pageinfo);
                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;
            }
        }
Пример #3
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;
            }
        }
Пример #4
0
        private void button_datarule_Click(object sender, EventArgs e)
        {
            InParams  inparams  = SDPClient.NewInParams(comboBox_proCode.Text.Trim());
            OutParams outparams = SDPClient.NewOutParams();

            string proCode = comboBox_proCode.Text.Trim();

            inparams.SetServiceName("DataRuleServices");
            inparams.SetServiceItem("SaveDataRuleToFile");
            inparams.SetRequestBody("TargetProCode", proCode);
            inparams.SetRequestBody("RuleName", "");
            inparams.SetRequestBody("Level", "");

            CallService(inparams, outparams);
        }
Пример #5
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);
        }
Пример #6
0
        public static string GetServerDateTime()
        {
            try
            {
                InParams  inparams  = SDPClient.NewInParams();
                OutParams outparams = SDPClient.NewOutParams();

                inparams.SetRequestBody("ServiceName", "DataExServices");
                inparams.SetRequestBody("ServiceItem", "GetServerDateTime");

                SDPClient.CallService(inparams, outparams);

                return(outparams.GetStrParamValue(0));
            }
            catch (Exception e)
            {
                System.Console.Out.WriteLine("DataExServices.GetCommonCodeTable Exception: {0}", e);
                throw e;
            }
        }
Пример #7
0
        public static DataTable GetEquipmentInfo()
        {
            try
            {
                InParams  inparams  = SDPClient.NewInParams();
                OutParams outparams = SDPClient.NewOutParams();

                inparams.SetRequestBody("ServiceName", "com.sdp.monitor.services.MonitorServices");
                inparams.SetRequestBody("ServiceItem", "GetEquipmentInfo");

                SDPClient.CallService(inparams, outparams);

                return(outparams.GetTableParamValue("EquipmentInfo"));
            }
            catch (Exception e)
            {
                System.Console.Out.WriteLine("MonitorServices.GetEquipmentInfo Exception: {0}", e);
                throw e;
            }
        }
Пример #8
0
        public static DataTable GetProjectInfo()
        {
            try
            {
                InParams  inparams  = SDPClient.NewInParams(null);
                OutParams outparams = SDPClient.NewOutParams();

                inparams.SetRequestBody("ServiceName", "EnterServices");
                inparams.SetRequestBody("ServiceItem", "GetProjectNames");

                SDPClient.RouteService(inparams, outparams);

                return(outparams.GetTableParamValue(0));
            }
            catch (Exception e)
            {
                System.Console.Out.WriteLine("CommonServices.GetProCodeTable Exception: {0}", e);
                throw e;
            }
        }
Пример #9
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;
            }
        }
Пример #10
0
        public static DataTable GetCommonCodeTable()
        {
            try
            {
                InParams  inparams  = SDPClient.NewInParams();
                OutParams outparams = SDPClient.NewOutParams();

                inparams.SetRequestBody("ServiceName", "DataServices");
                inparams.SetRequestBody("ServiceItem", "LoadData");
                inparams.SetRequestBody("RuleName", "drGetCommonCode");

                SDPClient.RouteService(inparams, outparams);

                return(outparams.GetTableParamValue(0));
            }
            catch (Exception e)
            {
                System.Console.Out.WriteLine("CommonServices.GetCommonCodeTable Exception: {0}", e);
                throw e;
            }
        }
Пример #11
0
        public static bool Logout(string loginId)
        {
            try
            {
                InParams  inparams  = SDPClient.NewInParams();
                OutParams outparams = SDPClient.NewOutParams();

                inparams.SetRequestBody("ServiceName", "LoginServices");
                inparams.SetRequestBody("ServiceItem", "Logout");
                inparams.SetRequestBody("CurLoginID", loginId);

                SDPClient.CallService(inparams, outparams);

                return(outparams.GetStrParamValue("Result").Equals("0"));
            }
            catch (Exception e)
            {
                System.Console.Out.WriteLine("LoginServices.Logout Exception: {0}", e);
                throw e;
            }
        }
Пример #12
0
        public static long GetSEQNextVal(String seqname)
        {
            try
            {
                InParams  inparams  = SDPClient.NewInParams();
                OutParams outparams = SDPClient.NewOutParams();

                inparams.SetRequestBody("ServiceName", "DataExServices");
                inparams.SetRequestBody("ServiceItem", "GetSEQNextVal");
                inparams.SetRequestBody("SEQName", seqname);

                SDPClient.CallService(inparams, outparams);

                return(Convert.ToInt32(outparams.GetStrParam(0).GetStrValue()));
            }
            catch (Exception e)
            {
                System.Console.Out.WriteLine("DataExServices.GetSEQNextVal Exception: {0}", e);
                throw e;
            }
        }
Пример #13
0
        public static DataRule LoadInfo(string rulename)
        {
            try
            {
                InParams  inparams  = SDPClient.NewInParams();
                OutParams outparams = SDPClient.NewOutParams();

                inparams.SetRequestBody("ServiceName", "DataServices");
                inparams.SetRequestBody("ServiceItem", "LoadInfo");
                inparams.SetRequestBody("RuleName", rulename);

                SDPClient.CallService(inparams, outparams);

                return(new DataRule(rulename, outparams));
            }
            catch (Exception e)
            {
                System.Console.Out.WriteLine("DataServices.LoadInfo Exception: {0}", e);
                throw e;
            }
        }
Пример #14
0
        public static int ExecTransaction(ITransactior tran)
        {
            try
            {
                string tranData = tran.GetTranData();
                System.Console.Out.WriteLine("DataServices.ExecTransaction Xml=" + tranData);
                if (tranData != null && !tranData.Equals(""))
                {
                    InParams  inparams  = SDPClient.NewInParams();
                    OutParams outparams = SDPClient.NewOutParams();

                    inparams.SetRequestBody("ServiceName", "DataServices");
                    inparams.SetRequestBody("ServiceItem", "ExecTransaction");
                    inparams.SetRequestBody("TranType", tran.TranType);
                    inparams.SetRequestBody("TranData", tranData);
                    inparams.SetRequestBody("UpdateCheckType", (int)tran.UpdateCheckType);
                    inparams.SetRequestBody("AutoUpdateLob", "1");

                    SDPClient.CallService(inparams, outparams);

                    return(outparams.GetIntParamValue("UpdateRows"));
                }
                else
                {
                    return(0);
                }
            }
            catch (Exception e)
            {
                System.Console.Out.WriteLine("DataServices.ExecTransaction Exception: {0}", e);
                throw new TransactionException("保存数据失败!", e);
            }
        }
Пример #15
0
        public static ILoginInfo Login(string userCode, string password)
        {
            try
            {
                InParams  inparams  = SDPClient.NewInParams();
                OutParams outparams = SDPClient.NewOutParams();

                inparams.SetRequestBody("ServiceName", "LoginServices");
                inparams.SetRequestBody("ServiceItem", "Login");
                inparams.SetRequestBody("UserCode", userCode);
                inparams.SetRequestBody("Password", password);

                SDPClient.CallService(inparams, outparams);

                return(new CLoginInfo(outparams));
            }
            catch (Exception e)
            {
                System.Console.Out.WriteLine("LoginServices.Login Exception: {0}", e);
                throw e;
            }
        }
Пример #16
0
        public static DataTable GetTableNames(string proCode, string dsName)
        {
            try
            {
                InParams  inparams  = SDPClient.NewInParams();
                OutParams outparams = SDPClient.NewOutParams();

                inparams.SetRequestBody("ServiceName", "com.gmcc.sysservices.DataRuleServices");
                inparams.SetRequestBody("ServiceItem", "GetTableNames");
                inparams.SetRequestBody("ProCode", proCode);
                inparams.SetRequestBody("DSName", dsName);

                SDPClient.RouteService(inparams, outparams);

                return(outparams.GetTableParamValue(0));
            }
            catch (Exception e)
            {
                System.Console.Out.WriteLine("DataRuleServices.GetTableNames Exception: {0}", e);
                throw e;
            }
        }
Пример #17
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;
            }
        }
Пример #18
0
        public static int ExecSql(String sql, UpdateCheckTypes checkType)
        {
            try
            {
                InParams  inparams  = SDPClient.NewInParams();
                OutParams outparams = SDPClient.NewOutParams();

                inparams.SetRequestBody("ServiceName", "DataServices");
                inparams.SetRequestBody("ServiceItem", "ExecSql");
                inparams.SetRequestBody("SQL", sql);
                inparams.SetRequestBody("UpdateCheckType", (int)checkType);

                SDPClient.CallService(inparams, outparams);

                return(outparams.GetIntParamValue("UpdateRows"));
            }
            catch (Exception e)
            {
                System.Console.Out.WriteLine("DataServices.ExecSql Exception: {0}", e);
                throw e;
            }
        }
Пример #19
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;
            }
        }
Пример #20
0
        public static string RefreshProject(string procode)
        {
            try
            {
                InParams  inparams  = SDPClient.NewInParams(procode);
                OutParams outparams = SDPClient.NewOutParams();

                inparams.SetRequestBody("ServiceName", "RefreshServices");

                SDPClient.RouteService(inparams, outparams);

                return(outparams.GetStrParamValue(0));
            }
            catch (Exception e)
            {
                System.Console.Out.WriteLine("CommonServices.RefreshProject Exception: {0}", e);
                throw e;
            }
        }
Пример #21
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;
            }
        }