Esempio n. 1
0
        protected virtual void DataPortal_Fetch(IdCriteria criteria)
        {
            using (IDataConnection connection = SimpleQuery.ConfigurationManagerConnection(""))
            {
                if (connection.State == ConnectionState.Closed)
                {
                    connection.Open();
                }

                using (IDataCommand command = new DataCommand((connection.CreateCommand())))
                {
                    command.CommandType = CommandType.StoredProcedure;
                    command.CommandText = "Pricing.Owner#FetchByDealerId";
                    command.AddParameterWithValue("DealerId", DbType.Int32, false, criteria.Id);

                    using (IDataReader reader = command.ExecuteReader())
                    {
                        if (reader.Read())
                        {
                            Fetch(reader);
                        }
                        else
                        {
                            throw new Exception("No such Owner!");
                        }
                    }
                }
            }
        }
        public int[] /*Juror*/ GetSummonsRecipientLogin(string socialLastFour, int juryId)
        {
            DataCommand command = new DataCommand("EXEC spGetSummonsRecipientLogin '" + socialLastFour + "', " + juryId);

            SqlDataReader dataReader = command.ExecuteReader();

            //Juror juror = dataReader.Read() ? Juror.GetJuror(dataReader.GetInt32(0)) : null;

            //command.Close();

            return(new int[] { 0, 1, 2, 3, 4 } /*juror*/);
        }
        public Juror GetSummonsRecipientLogin(string socialLastFour, int juryId)
        {
            DataCommand command = new DataCommand("EXEC spGetSummonsRecipientLogin '" + socialLastFour + "', " + juryId);

            SqlDataReader dataReader = command.ExecuteReader();

            Juror juror = dataReader.Read() ? Juror.GetJuror(dataReader.GetInt32(0)) : null;

            command.Close();

            return(juror);
        }
        public object GetSummonsRecipientLogin(string socialLastFour, int jurorId)
        {
            try {
                DataCommand command = new DataCommand("spGetSummonsRecipientLogin");
                command.AddParameter("@socialLastFour", socialLastFour);
                command.AddParameter("@jurorId", jurorId);

                DataReader dataReader = command.ExecuteReader();

                object juror = dataReader.Read() ? (object)Juror.GetJuror((int)dataReader.GetInteger("JurorID")) : (object)Json.Nothing;

                command.Close();

                return(juror);
            } catch (Exception e) {
                return(Error.LogError(_logger, e));
            }
        }