예제 #1
0
        public static MerchandisingGroupCustom GetMerchandisingGroupCustomByMerchandisingGroupCustomId(int merchandisingGroupCustomId)
        {
            Database  db         = DatabaseFactory.CreateDatabase("Spar-StoreRep");
            string    sqlCommand = "GetMerchandisingGroupCustomByMerchandisingGroupCustomId";
            DbCommand dbCommand  = db.GetStoredProcCommand(sqlCommand);

            db.AddInParameter(dbCommand, "@MerchandisingGroupCustomId", DbType.Int32, merchandisingGroupCustomId);
            db.AddOutParameter(dbCommand, "@Description", DbType.String, 500);

            db.ExecuteNonQuery(dbCommand);
            MerchandisingGroupCustom merchandisingGroupCustom = new MerchandisingGroupCustom();

            merchandisingGroupCustom.MerchandisingGroupCustomId = merchandisingGroupCustomId;
            merchandisingGroupCustom.Description = db.GetParameterValue(dbCommand, "Description").ToString();

            return(merchandisingGroupCustom);
        }
예제 #2
0
        public static List <MerchandisingGroupCustom> GetMerchandisingGroupCustomList(int companyId)
        {
            List <MerchandisingGroupCustom> list = new List <MerchandisingGroupCustom>();

            Database  db         = DatabaseFactory.CreateDatabase("Spar-StoreRep");
            string    sqlCommand = "GetMerchandisingGroupCustomList";
            DbCommand dbCommand  = db.GetStoredProcCommand(sqlCommand);

            db.AddInParameter(dbCommand, "@CompanyId", DbType.Int32, companyId);

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    MerchandisingGroupCustom merchandisingGroupCustom = new MerchandisingGroupCustom();
                    merchandisingGroupCustom.MerchandisingGroupCustomId = Convert.ToInt32(dataReader["MerchandisingGroupCustomId"]);
                    merchandisingGroupCustom.Description = dataReader["Description"].ToString();

                    list.Add(merchandisingGroupCustom);
                }
            }
            return(list);
        }