Ejemplo n.º 1
0
        public SampleStorageResponses GetStorage(SampleStorageCondition WhereStorage)
        {
            SampleStorageResponses Sample = new SampleStorageResponses();

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

                    cmd.Parameters.AddWithValue("@SKU", WhereStorage.SKU);
                    cmd.Parameters[1].SqlDbType = SqlDbType.VarChar;
                    cmd.Parameters[1].Size      = 4000;

                    cmd.Parameters.AddWithValue("@PE", WhereStorage.PE);
                    cmd.Parameters[2].SqlDbType = SqlDbType.VarChar;
                    cmd.Parameters[2].Size      = 100;

                    cmd.Parameters.AddWithValue("@RcvBeginDate", WhereStorage.ReceiveBeginDate);
                    cmd.Parameters[3].SqlDbType = SqlDbType.VarChar;
                    cmd.Parameters[3].Size      = 100;

                    cmd.Parameters.AddWithValue("@RcvEndDate", WhereStorage.ReceiveEndDate);
                    cmd.Parameters[4].SqlDbType = SqlDbType.VarChar;
                    cmd.Parameters[4].Size      = 100;


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

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

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


                    conn.Open();
                    SqlDataAdapter sda = new SqlDataAdapter();
                    sda.SelectCommand = cmd;
                    sda.Fill(ds);
                    Sample.RowCount  = (int)cmd.Parameters[7].Value;
                    Sample.SampleSto = ds.ConvertToEntityCollection <SampleStorageSelect>();
                    conn.Close();
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(Sample);
        }
Ejemplo n.º 2
0
        public SampleStorageResponses GetSampleStorage(SampleStorageCondition request)
        {
            SampleStorageResponses response = new SampleStorageResponses();

            try
            {
                response = new DaoSampleStorage().GetStorage(request);

                //    response = new DaoSampleStorage().GetSampleStock(request);
            }
            catch (Exception ex)
            {
                LogError(ex);
            }
            return(response);
        }