Ejemplo n.º 1
0
        /// <summary>
        /// 쿼리문과 변수를 받아 데이터 셋을 리턴합니다.
        /// </summary>
        /// <param name="Query">쿼리</param>
        /// <param name="dtParameter">변수정보.</param>
        /// <returns>결과 데이터 텟</returns>
        /// <example>
        /// <code>
        /// DataTable dt = DataLayer.GetDataTableParameter(DataLayer.DatatableStyle.Parameter);
        ///
        ///     dt.Rows.Add(new object[] { ":P1", "2" });
        ///     dt.Rows.Add(new object[] { ":P2", "B" });
        ///
        ///     DataSet ds = DataLayer.ExecuteDataset("SELECT * FROM TEST WHERE C1 = :P1 AND C2 = :P2", dt, DataLayer.MessageEncoding.Default);
        /// </code>
        /// </example>
        public static DataSet ExecuteDataset(string Query, DataTable dtParameter, MessageEncoding Binding)
        {
            DataSet dsParm = new DataSet();

            try
            {
                DataSet ds = new DataSet();
                dsParm.Tables.Add(dtParameter);
                using (Data.SCOSClient Data = new Data.SCOSClient(GetMesageEncoding(Binding), GetEndpointAddress(Binding)))
                {
                    Data.ClientCredentials.Windows.ClientCredential.UserName = mService.AuthId;
                    Data.ClientCredentials.Windows.ClientCredential.Password = mService.AuthPwd;
                    string str = Data.ExecuteDataset2(Query, dsParm);
                    ds = Decompress.DecompressDataSet(str);
                }
                return(ds);
            }
            catch (TimeoutException ex)
            {
                throw new Exception("서버연결시간이 초과 되었습니다." + System.Environment.NewLine + ex.Message);
            }
            catch (FaultException <Data.DataServiceMyException> greetingFault)
            {
                throw new Exception(greetingFault.Detail.Message);
            }
            catch (FaultException ex)
            {
                throw new Exception("알 수 없는 에레 입니다." + System.Environment.NewLine + ex.Message);
            }
            catch (CommunicationException ex)
            {
                throw new Exception("서버와의 통신상태를 확인하세요" + System.Environment.NewLine + ex.Message);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                dsParm.Dispose();
                dsParm = null;
            }
        }
Ejemplo n.º 2
0
        public static DataSet SmartUpdateDirInfo(string Authid, string Authpwd, string SvrUri)
        {
            try
            {
                DataSet ds  = new DataSet();
                string  str = "";



                using (Data.SCOSClient Data = new Data.SCOSClient("SvcEndPoint_DataService", SvrUri + "/DATA"))
                {
                    Data.ClientCredentials.Windows.ClientCredential.UserName = Authid;
                    Data.ClientCredentials.Windows.ClientCredential.Password = Authpwd;
                    str = Data.SmartUpdateDirInfo();
                }
                ds = Decompress.DecompressDataSet(str);
                return(ds);
            }
            catch (TimeoutException ex)
            {
                throw new Exception("서버연결시간이 초과 되었습니다." + System.Environment.NewLine + ex.Message);
            }
            catch (FaultException <Data.DataServiceMyException> greetingFault)
            {
                throw new Exception(greetingFault.Detail.Message);
            }
            catch (FaultException ex)
            {
                throw new Exception("알 수 없는 에레 입니다." + System.Environment.NewLine + ex.Message);
            }
            catch (CommunicationException ex)
            {
                throw new Exception("서버와의 통신상태를 확인하세요" + System.Environment.NewLine + ex.Message);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 쿼리문과 변수테이블을 담겨있는 구조체배열을 받아 데이터 셋을 리턴합니다.
        /// </summary>
        /// <param name="st">Select 정보를 담고 있는 구조체.</param>
        /// <returns>결과 데이터셋</returns>
        /// <example>
        /// <code>
        ///  _StCallingSQLinfo[] st = new  _StCallingSQLinfo[3];
        ///
        ///     st[0].SQL = "SELECT * FROM TEST";
        ///     st[0].ParameterDataTable = null;
        ///
        ///     st[1].SQL = "SELECT * FROM TEST WHERE C1 = :P1";
        ///     st[1].ParameterDataTable = DataLayer.GetDataTableParameter(DataLayer.DatatableStyle.Parameter);
        ///     st[1].ParameterDataTable.Rows.Add(new object[] { ":P1", "2" });
        ///
        ///     st[2].SQL = "SELECT * FROM TEST WHERE C1 = :P1";
        ///     st[2].ParameterDataTable = DataLayer.GetDataTableParameter(DataLayer.DatatableStyle.Parameter);
        ///     st[2].ParameterDataTable.Rows.Add(new object[] { ":P1", "1" });
        ///
        ///     DataSet ds = DataLayer.ExecuteDataset(st, DataLayer.MessageEncoding.Default);
        /// </code>
        /// </example>
        public static DataSet ExecuteDataset(_StCallingSQLinfo[] st, MessageEncoding Binding)
        {
            DataSet dsParm = new DataSet();

            try
            {
                DataSet ds = new DataSet();

                dsParm.Tables.AddRange(new DataTable[] { GetDataTableParameter(DatatableStyle.Header),
                                                         GetDataTableParameter(DatatableStyle.Body) });

                using (Data.SCOSClient Data = new Data.SCOSClient(GetMesageEncoding(Binding), GetEndpointAddress(Binding)))
                {
                    Data.ClientCredentials.Windows.ClientCredential.UserName = mService.AuthId;
                    Data.ClientCredentials.Windows.ClientCredential.Password = mService.AuthPwd;



                    for (int i = 0; i < st.Length; i++)
                    {
                        dsParm.Tables[0].Rows.Add(new object[] { i.ToString(),
                                                                 st[i].SQL });
                        if (st[i].ParameterDataTable != null)
                        {
                            if (st[i].ParameterDataTable.Rows.Count <= 0)
                            {
                                continue;
                            }

                            for (int j = 0; j < st[i].ParameterDataTable.Rows.Count; j++)
                            {
                                dsParm.Tables[1].Rows.Add(new object[] { i.ToString(),
                                                                         st[i].ParameterDataTable.Rows[j][0].ToString().Trim(),
                                                                         st[i].ParameterDataTable.Rows[j][1].ToString().Trim() });
                            }
                        }
                    }
                    string str = Data.ExecuteDataset3(dsParm);
                    ds = Decompress.DecompressDataSet(str);
                }
                return(ds);
            }
            catch (TimeoutException ex)
            {
                throw new Exception("서버연결시간이 초과 되었습니다." + System.Environment.NewLine + ex.Message);
            }
            catch (FaultException <Data.DataServiceMyException> greetingFault)
            {
                throw new Exception(greetingFault.Detail.Message);
            }
            catch (FaultException ex)
            {
                throw new Exception("알 수 없는 에레 입니다." + System.Environment.NewLine + ex.Message);
            }
            catch (CommunicationException ex)
            {
                throw new Exception("서버와의 통신상태를 확인하세요" + System.Environment.NewLine + ex.Message);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                dsParm.Dispose();
                dsParm = null;
            }
        }