예제 #1
0
        public static List <StoreCustom> GetStoreCustomListByFilter(string searchValue, int companyId)
        {
            List <StoreCustom> list = new List <StoreCustom>();

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

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

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    StoreCustom storeCustom = new StoreCustom();
                    storeCustom.StoreCustomId     = Convert.ToInt32(dataReader["StoreCustomId"]);
                    storeCustom.CustomDescription = dataReader["CustomDescription"].ToString();
                    storeCustom.CustomStoreId     = Convert.ToInt32(dataReader["CustomStoreId"]);
                    storeCustom.StoreId           = Convert.ToInt32(dataReader["StoreId"]);
                    storeCustom.SPARStoreId       = Convert.ToInt32(dataReader["SPARStoreId"]);
                    storeCustom.Address           = dataReader["Address"].ToString();
                    storeCustom.GPS           = dataReader["GPS"].ToString();
                    storeCustom.ContactNumber = dataReader["ContactNumber"].ToString();
                    storeCustom.GroupStore    = Convert.ToInt32(dataReader["GroupStore"]);
                    storeCustom.CatmanStore   = Convert.ToInt32(dataReader["CatmanStore"]);
                    storeCustom.Attachment    = dataReader["Attachment"].ToString();
                    storeCustom.Comment       = dataReader["Comment"].ToString();
                    list.Add(storeCustom);
                }
            }
            return(list);
        }
예제 #2
0
        public static StoreCustom GetStoreCustomByStoreId(int storeId, int companyId)
        {
            Database  db         = DatabaseFactory.CreateDatabase("Spar-StoreRep");
            string    sqlCommand = "GetStoreCustomByStoreId";
            DbCommand dbCommand  = db.GetStoredProcCommand(sqlCommand);

            db.AddInParameter(dbCommand, "@StoreId", DbType.Int32, storeId);
            db.AddInParameter(dbCommand, "@CompanyId", DbType.Int32, companyId);
            db.AddOutParameter(dbCommand, "@StoreCustomId", DbType.Int32, 4);
            db.AddOutParameter(dbCommand, "@CustomDescription", DbType.String, 50);
            db.AddOutParameter(dbCommand, "@CustomStoreId", DbType.Int32, 4);
            db.AddOutParameter(dbCommand, "@SPARStoreId", DbType.Int32, 4);
            db.AddOutParameter(dbCommand, "@Address", DbType.String, 2000);
            db.AddOutParameter(dbCommand, "@GPS", DbType.String, 200);
            db.AddOutParameter(dbCommand, "@ContactPerson", DbType.String, 200);
            db.AddOutParameter(dbCommand, "@ContactNumber", DbType.String, 50);
            db.AddOutParameter(dbCommand, "@GroupStore", DbType.Int32, 4);
            db.AddOutParameter(dbCommand, "@StoreGroupId", DbType.Int32, 4);
            db.AddOutParameter(dbCommand, "@CatmanStore", DbType.Int32, 4);
            db.AddOutParameter(dbCommand, "@Attachment", DbType.String, 1000);
            db.AddOutParameter(dbCommand, "@Comment", DbType.String, 4000);
            db.AddOutParameter(dbCommand, "@Email", DbType.String, 200);
            db.ExecuteNonQuery(dbCommand);
            StoreCustom storeCustom = new StoreCustom();

            storeCustom.StoreId           = storeId;
            storeCustom.StoreCustomId     = Convert.ToInt32(db.GetParameterValue(dbCommand, "storeCustomId"));
            storeCustom.CustomDescription = db.GetParameterValue(dbCommand, "CustomDescription").ToString();
            storeCustom.CustomStoreId     = Convert.ToInt32(db.GetParameterValue(dbCommand, "CustomStoreId"));
            storeCustom.SPARStoreId       = Convert.ToInt32(db.GetParameterValue(dbCommand, "SPARStoreId"));
            storeCustom.Address           = db.GetParameterValue(dbCommand, "Address").ToString();
            storeCustom.GPS           = db.GetParameterValue(dbCommand, "GPS").ToString();
            storeCustom.ContactPerson = db.GetParameterValue(dbCommand, "ContactPerson").ToString();
            storeCustom.ContactNumber = db.GetParameterValue(dbCommand, "ContactNumber").ToString();
            storeCustom.GroupStore    = Convert.ToInt32(db.GetParameterValue(dbCommand, "GroupStore"));
            storeCustom.StoreGroupId  = Convert.ToInt32(db.GetParameterValue(dbCommand, "StoreGroupId"));
            storeCustom.CatmanStore   = Convert.ToInt32(db.GetParameterValue(dbCommand, "CatmanStore"));
            storeCustom.Attachment    = db.GetParameterValue(dbCommand, "Attachment").ToString();
            storeCustom.Comment       = db.GetParameterValue(dbCommand, "Comment").ToString();
            storeCustom.Email         = db.GetParameterValue(dbCommand, "Email").ToString();
            return(storeCustom);
        }