public override ICollection <ColumnSchema> GetProcedureColumns(ProcedureSchema procedure)
        {
            CheckConnectionState();
            List <ColumnSchema> columns = new List <ColumnSchema> ();


            IDbCommand command = connectionProvider.CreateCommand(
                "sp_sproc_columns"
                );
            SybaseParameter owner = new SybaseParameter("@procedure_owner", procedure.OwnerName);
            SybaseParameter name  = new SybaseParameter("@procedure_name", procedure.Name);

            command.Parameters.Add(owner);
            command.Parameters.Add(name);

            using (command) {
                using (IDataReader r = command.ExecuteReader()) {
                    while (r.Read())
                    {
                        ColumnSchema column = new ColumnSchema(this);
                        column.Name         = (string)r["COLUMN_NAME"];
                        column.DataTypeName = (string)r["TYPE_NAME"];
                        columns.Add(column);
                    }
                    r.Close();
                }
                connectionProvider.Close(command.Connection);
            }

            return(columns);
        }
 public void Remove(SybaseParameter value)
 {
     //both this and the above code are the same. but need to work with
     // 1.1!
     value.Container = null;
     metaParameters.Remove(value.MetaParameter);
     list.Remove(value);
 }
        public SybaseParameter Add(SybaseParameter value)
        {
            if (value.Container != null)
            {
                throw new ArgumentException("The SybaseParameter specified in the value parameter is already added to this or another SybaseParameterCollection.");
            }

            value.Container = this;
            list.Add(value);
            metaParameters.Add(value.MetaParameter);
            return(value);
        }
 public override void AddRange(Array values)
 {
     if (values == null)
     {
         throw new ArgumentNullException("The argument passed was null");
     }
     foreach (object value in values)
     {
         if (!(value is SybaseParameter))
         {
             throw new InvalidCastException("Element in the array parameter was not an SqlParameter.");
         }
         SybaseParameter param = (SybaseParameter)value;
         if (param.Container != null)
         {
             throw new ArgumentException("An SqlParameter specified in the array is already added to this or another SqlParameterCollection.");
         }
         param.Container = this;
         list.Add(param);
         metaParameters.Add(param.MetaParameter);
     }
 }
 public void Insert(int index, SybaseParameter value)
 {
     list.Insert(index, value);
 }
 public int IndexOf(SybaseParameter value)
 {
     return(list.IndexOf(value));
 }
 public bool Contains(SybaseParameter value)
 {
     return(this.IndexOf(value) != -1);
 }
        private object AddBroker(object param)
        {
            string portiaName = ((Tuple<string, string,string>)param).Item1;
            string dtcName = ((Tuple<string, string, string>)param).Item2;
            string execBrokerId = ((Tuple<string, string, string>)param).Item3;
            if (!string.IsNullOrEmpty(dtcName) && !string.IsNullOrEmpty(portiaName))
            {
                using (SybaseConnection con = new SybaseConnection(model.Constants.SybaseConnection))
                {
                    using (SybaseCommand com = new SybaseCommand(model.Constants.InsertBroker, con) { CommandType = CommandType.Text })
                    {
                        SybaseParameter oParam = new SybaseParameter("@portiaBrokerName", SybaseDbType.VarChar);
                        oParam.Value = portiaName;
                        com.Parameters.Add(oParam);

                        SybaseParameter oParam1 = new SybaseParameter("@dtcBrokerName", SybaseDbType.VarChar);
                        oParam1.Value = dtcName;
                        com.Parameters.Add(oParam1);

                        SybaseParameter oParam2 = new SybaseParameter("@executingBrokerId", SybaseDbType.VarChar);
                        oParam2.Value = execBrokerId;
                        com.Parameters.Add(oParam2);

                        con.Open();
                        try
                        {
                            com.ExecuteNonQuery();
                        }
                        catch (Exception ex)
                        {

                        }
                    }
                }
            }
            //DtcBrokerName = string.Empty;
            //PortiaBrokerName = string.Empty;
            //ExecBrokerId = string.Empty;
            return null;
        }
        private object RemoveAccount(object param)
        {
           DialogResult result = (DialogResult)System.Windows.MessageBox.Show("Are you sure you want to remove this account ?", "Message", MessageBoxButton.YesNoCancel, MessageBoxImage.Question);

            if (result==DialogResult.Yes)
            {
                Account account = FocusedRow as Account;
                string dtcAccount = account.DtcAccountNum;
                string portiaAccount = account.PortiaAccountNum;
                if (!string.IsNullOrEmpty(dtcAccount) && !string.IsNullOrEmpty(portiaAccount))
                {
                    using (SybaseConnection con = new SybaseConnection(model.Constants.SybaseConnection))
                    {
                        using (SybaseCommand com = new SybaseCommand(model.Constants.DeleteAccount, con) { CommandType = CommandType.Text })
                        {
                            SybaseParameter oParam = new SybaseParameter("@dtcAccountNumber", SybaseDbType.VarChar);
                            oParam.Value = dtcAccount;
                            com.Parameters.Add(oParam);

                            SybaseParameter oParam1 = new SybaseParameter("@portiaAccountNumber", SybaseDbType.VarChar);
                            oParam1.Value = portiaAccount;
                            com.Parameters.Add(oParam1);

                            con.Open();
                            try
                            {
                                com.ExecuteNonQuery();
                            }
                            catch (Exception ex)
                            {

                            }
                        }
                    }
                }
                PopulateDtcAccount();
                PopulatePortiaAccount();
                LstAccounts = GetAccountMapping(dtcAccount, portiaAccount);
                NotifyPropertyChanged("LstAccounts");
            }
            
            //DtcAccountNum = string.Empty;
            //PortiaAccountNum = string.Empty;
            return null;
        }
        private object AddAccount(object param)
        {
            string dtcAccount = ((Tuple<string, string>)param).Item1;
            string portiaAccount = ((Tuple<string, string>)param).Item2;
            if (!string.IsNullOrEmpty(dtcAccount) && !string.IsNullOrEmpty(portiaAccount))
            {
                using (SybaseConnection con = new SybaseConnection(model.Constants.SybaseConnection))
                {
                    using (SybaseCommand com = new SybaseCommand(model.Constants.InsertAccount, con) { CommandType = CommandType.Text })
                    {
                        SybaseParameter oParam = new SybaseParameter("@dtcAccountNumber", SybaseDbType.VarChar);
                        oParam.Value = dtcAccount;
                        com.Parameters.Add(oParam);

                        SybaseParameter oParam1 = new SybaseParameter("@portiaAccountNumber", SybaseDbType.VarChar);
                        oParam1.Value = portiaAccount;
                        com.Parameters.Add(oParam1);

                        con.Open();
                        try
                        {
                            com.ExecuteNonQuery();
                        }
                        catch (Exception ex)
                        {

                        }
                    }
                }
            }
            PopulateDtcAccount();
            PopulatePortiaAccount();
            //DtcAccountNum = string.Empty;
            //PortiaAccountNum = string.Empty;
            return null;
        }
        private ObservableCollection<Account> GetAccountMapping(string dtcAccount, string portiaAccount)
        {
            lstAccount = new ObservableCollection<Account>();
            using (SybaseConnection con = new SybaseConnection(model.Constants.SybaseConnection))
            {

                using (SybaseCommand com = new SybaseCommand(model.Constants.SelectAccountMapping, con) { CommandType = CommandType.Text })
                {
                    SybaseParameter oCom = new SybaseParameter("@portiaAccountNumber", SybaseDbType.VarChar);
                    oCom.Value = portiaAccount;
                    com.Parameters.Add(oCom);

                    oCom = new SybaseParameter("@dtcAccountNumber", SybaseDbType.VarChar);
                    oCom.Value = dtcAccount;
                    com.Parameters.Add(oCom);

                    con.Open();
                    try
                    {
                        using (SybaseDataReader reader = com.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                lstAccount.Add(new Account(Convert.ToInt32(reader["id"].ToString()), reader["portiaAccountNumber"].ToString(),
                                    reader["dtcAccountNumber"].ToString(),
                                    Convert.ToDateTime(reader["modifiedDate"].ToString()),
                                    reader["modifiedBy"].ToString()
                                ));
                            }

                        }
                    }
                    catch (Exception ex)
                    {

                    }
                }
            }
            return lstAccount;
        }