Exemplo n.º 1
0
        public List<HtAccount> SearchByTN(string tn, bool active)
        {
            try
            {
                List<HtAccount> accounts = new List<HtAccount>();

                using (OracleConnection con = new OracleConnection(KENANDB))
                {
                    DataSet ds = new DataSet();

                    // Initialize Command and DataAdapter.
                    OracleCommand cmd;
                    OracleDataAdapter da;

                    // Open Connection and call stored procedure.
                    con.Open();
                    cmd = new OracleCommand("ARBOR.HT_ONE_PKG.TN_SEARCH", con);
                    cmd.CommandType = CommandType.StoredProcedure;

                    //Code to call Stored Proc
                    cmd.Parameters.Add("ITELNO", OracleType.VarChar, 256).Value = tn;
                    cmd.Parameters["ITELNO"].Direction = ParameterDirection.Input;
                    cmd.Parameters.Add("ISACTIVE", OracleType.VarChar, 256).Value = (active ? '1' : '0');
                    cmd.Parameters["ISACTIVE"].Direction = ParameterDirection.Input;
                    cmd.Parameters.Add("OSEARCHRESULTS", OracleType.Cursor).Direction = ParameterDirection.Output;

                    da = new OracleDataAdapter(cmd);
                    da.Fill(ds);

                    foreach (DataRow row in ds.Tables[0].Rows)
                    {
                        HtAccount account = new HtAccount();
                        account.AccountName = row["ACCOUNT_NAME"].ToString();
                        account.AccountNo = row["ACCOUNT_NO"].ToString();
                        account.Btn = row["BTN"].ToString();
                        account.BillingAddress = row["BILLING_ADDRESS"].ToString();
                        account.AlternateAddress = row["ALTERNATE_ADDRESS"].ToString();
                        account.Products = row["PRODUCTS"].ToString();
                        account.MarketCode = row["MARKET_CODE"].ToString();
                        account.AccountType = row["ACCOUNT_TYPE"].ToString();
                        account.KenanStatus = row["KENAN_STATUS"].ToString();
                        accounts.Add(account);
                    }

                    // Explicitly close connection
                    con.Close();
                }
                return accounts;
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemplo n.º 2
0
        public List<HtAccount> SearchByOrderID(string orderid, bool active)
        {
            try
            {
                List<HtAccount> accounts = new List<HtAccount>();

                using (OracleConnection con = new OracleConnection(CRMDB))
                {
                    DataSet ds = new DataSet();

                    // Initialize Command and DataAdapter.
                    OracleCommand cmd;
                    OracleDataAdapter da;

                    // Open Connection and call stored procedure.
                    con.Open();
                    cmd = new OracleCommand("SYSADM.SEARCH_BY_ORDER_ID", con);
                    cmd.CommandType = CommandType.StoredProcedure;

                    //Code to call Stored Proc
                    cmd.Parameters.Add("OrderIdIn", OracleType.VarChar, 256).Value = orderid;
                    cmd.Parameters["OrderIdIn"].Direction = ParameterDirection.Input;
                    cmd.Parameters.Add("ActiveOrNotIn", OracleType.VarChar, 256).Value = (active ? '1' : '0');
                    cmd.Parameters["ActiveOrNotIn"].Direction = ParameterDirection.Input;
                    cmd.Parameters.Add("oResults", OracleType.Cursor).Direction = ParameterDirection.Output;

                    da = new OracleDataAdapter(cmd);
                    da.Fill(ds);

                    foreach (DataRow row in ds.Tables[0].Rows)
                    {
                        HtAccount account = new HtAccount();
                        account.AccountName = row["ACCOUNT_NAME"].ToString();
                        account.AccountNo = row["ACCOUNT_NO"].ToString();
                        account.Btn = row["BTN"].ToString();
                        account.BillingAddress = row["BILLING_ADDRES"].ToString();
                        account.AlternateAddress = row["ALTERNATE_ADDRESS"].ToString();
                        account.Products = row["PRODUCTS"].ToString();
                        account.MarketCode = row["MARKET_CODE"].ToString();
                        account.AccountType = row["ACCOUNT_TYPE"].ToString();
                        account.KenanStatus = row["ACCOUNT_STATUS"].ToString();
                        accounts.Add(account);
                    }

                    // Explicitly close connection
                    con.Close();
                }
                return accounts;
            }
            catch (Exception)
            {
                throw;
            }
        }