예제 #1
0
        public static List <ProductCat> ListLocationCode(string ShiptoCode, string UserName, string SelltoCustomerNo)
        {
            string            strSQL = string.Empty;
            List <ProductCat> list   = new List <ProductCat>();
            SqlDataReader     reader;

            strSQL = "SP_WA_LocationList";
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetStoredProcCommand(strSQL);

            try
            {
                db.AddInParameter(dbCommand, "@ShipToCode", DbType.String, ShiptoCode);
                db.AddInParameter(dbCommand, "@UserName", DbType.String, UserName);
                db.AddInParameter(dbCommand, "@Customer", DbType.String, SelltoCustomerNo);

                reader = (SqlDataReader)db.ExecuteReader(dbCommand);
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        ProductCat obj = new ProductCat();
                        obj.Code = Convert.ToString(reader.GetValue(reader.GetOrdinal("Code")));
                        obj.Name = Convert.ToString(reader.GetValue(reader.GetOrdinal("Name")));
                        list.Add(obj);
                    }
                }
                if (!reader.IsClosed)
                {
                    reader.Close();
                }
            }
            catch (SqlException e)
            { throw e; }
            catch (Exception e)
            { throw e; }
            finally
            {
                dbCommand.Dispose();
                dbCommand = null;
                db        = null;
            }
            return(list);
        }
예제 #2
0
        public static List <ProductCat> ListProductCode()
        {
            string            strSQL = string.Empty;
            List <ProductCat> list   = new List <ProductCat>();
            SqlDataReader     reader;

            strSQL = "SP_WA_InternalProductCode";
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetStoredProcCommand(strSQL);

            try
            {
                reader = (SqlDataReader)db.ExecuteReader(dbCommand);
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        ProductCat obj = new ProductCat();
                        obj.Code = Convert.ToString(reader.GetValue(reader.GetOrdinal("Code")));
                        obj.Name = Convert.ToString(reader.GetValue(reader.GetOrdinal("Name")));
                        list.Add(obj);
                    }
                }
                if (!reader.IsClosed)
                {
                    reader.Close();
                }
            }
            catch (SqlException e)
            { throw e; }
            catch (Exception e)
            { throw e; }
            finally
            {
                dbCommand.Dispose();
                dbCommand = null;
                db        = null;
            }
            return(list);
        }
예제 #3
0
        public static List <ProductCat> SelectDefaultStructure(string LocationCode)
        {
            string            strSQL = string.Empty;
            List <ProductCat> list   = new List <ProductCat>();
            SqlDataReader     reader;

            strSQL = "SP_WA_DefaultStructure";
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetStoredProcCommand(strSQL);

            try
            {
                db.AddInParameter(dbCommand, "@LocationCode", DbType.String, LocationCode);
                reader = (SqlDataReader)db.ExecuteReader(dbCommand);
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        ProductCat obj = new ProductCat();
                        obj.Structure = Convert.ToString(reader.GetValue(reader.GetOrdinal("Structure")));
                        list.Add(obj);
                    }
                }
                if (!reader.IsClosed)
                {
                    reader.Close();
                }
            }
            catch (SqlException e)
            { throw e; }
            catch (Exception e)
            { throw e; }
            finally
            {
                dbCommand.Dispose();
                dbCommand = null;
                db        = null;
            }
            return(list);
        }