Пример #1
0
        public OSRJobResponses GetOSRJob(OSRJobCondition request)
        {
            OSRJobResponses response = new OSRJobResponses();

            try
            {
                response = new DaoOSRStorage().GetOSRJob(request);
            }
            catch (Exception ex)
            {
                LogError(ex);
            }
            return(response);
        }
Пример #2
0
        public OSRJobResponses GetOSRJob(OSRJobCondition WhereJob)
        {
            OSRJobResponses OJ = new OSRJobResponses();

            using (SqlConnection conn = new SqlConnection(connStr))
            {
                try
                {
                    SqlCommand cmd = new SqlCommand("pro_wms_OSRJobSelect", conn);
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@BeginTime", WhereJob.BeginTime);
                    cmd.Parameters[0].SqlDbType = SqlDbType.VarChar;
                    cmd.Parameters[0].Size      = 100;

                    cmd.Parameters.AddWithValue("@EndTime", WhereJob.EndTime);
                    cmd.Parameters[1].SqlDbType = SqlDbType.VarChar;
                    cmd.Parameters[1].Size      = 100;

                    cmd.Parameters.AddWithValue("@PageIndex", WhereJob.PageIndex);
                    cmd.Parameters[2].SqlDbType = SqlDbType.Int;

                    cmd.Parameters.AddWithValue("@PageSize", WhereJob.PageSize);
                    cmd.Parameters[3].SqlDbType = SqlDbType.Int;

                    cmd.Parameters.AddWithValue("@RowCount", 0);
                    cmd.Parameters[4].Direction = ParameterDirection.Output;
                    cmd.Parameters[4].SqlDbType = SqlDbType.Int;

                    conn.Open();
                    SqlDataAdapter sda = new SqlDataAdapter();
                    sda.SelectCommand = cmd;
                    sda.Fill(dt);
                    OJ.RowCount = (int)cmd.Parameters[4].Value;
                    OJ.OSRJob   = dt.ConvertToEntityCollection <OSRJobSelect>();
                    conn.Close();
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(OJ);
        }