Ejemplo n.º 1
0
        public static List <InsightSupplier> GetInsightSupplierList()
        {
            List <InsightSupplier> list = new List <InsightSupplier>();

            Database  db         = DatabaseFactory.CreateDatabase("SPARInsightManagement");
            string    sqlCommand = "GetInsightSupplierList";
            DbCommand dbCommand  = db.GetStoredProcCommand(sqlCommand);

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    InsightSupplier insightSupplier = new InsightSupplier();
                    insightSupplier.InsightSupplierId     = Convert.ToInt32(dataReader["InsightSupplierId"]);
                    insightSupplier.InsightId             = Convert.ToInt32(dataReader["InsightId"]);
                    insightSupplier.PastelRef             = dataReader["PastelRef"].ToString();
                    insightSupplier.SupplierName          = dataReader["SupplierName"].ToString();
                    insightSupplier.Notes                 = dataReader["Notes"].ToString();
                    insightSupplier.SupplierTypeId        = Convert.ToInt32(dataReader["SupplierTypeId"]);
                    insightSupplier.SecurityId            = Convert.ToInt32(dataReader["SecurityId"]);
                    insightSupplier.CategoryReductionId   = Convert.ToInt32(dataReader["CategoryReductionId"]);
                    insightSupplier.BuildId               = Convert.ToInt32(dataReader["BuildId"]);
                    insightSupplier.StatusId              = Convert.ToInt32(dataReader["StatusId"]);
                    insightSupplier.SupplierDirectoryPath = dataReader["SupplierDirectoryPath"].ToString();
                    insightSupplier.SupplierFolder        = dataReader["SupplierFolder"].ToString();
                    list.Add(insightSupplier);
                }
            }
            return(list);
        }
Ejemplo n.º 2
0
        public static InsightSupplier GetInsightSupplierDetailByInsightSupplierId(int insightSupplierId)
        {
            Database  db         = DatabaseFactory.CreateDatabase("SPARInsightManagement");
            string    sqlCommand = "GetInsightSupplierDetailByInsightSupplierId";
            DbCommand dbCommand  = db.GetStoredProcCommand(sqlCommand);

            db.AddInParameter(dbCommand, "@InsightSupplierId", DbType.Int32, insightSupplierId);
            db.AddOutParameter(dbCommand, "@ModelTypeId", DbType.Int32, 4);
            db.AddOutParameter(dbCommand, "@InsightId", DbType.Int32, 4);
            db.AddOutParameter(dbCommand, "@PastelRef", DbType.String, 20);
            db.AddOutParameter(dbCommand, "@SupplierNameModel", DbType.String, 50);
            db.AddOutParameter(dbCommand, "@Notes", DbType.String, 2000);
            db.AddOutParameter(dbCommand, "@SupplierTypeId", DbType.Int32, 4);
            db.AddOutParameter(dbCommand, "@SecurityId", DbType.Int32, 4);
            db.AddOutParameter(dbCommand, "@SecurityLevelId", DbType.Int32, 4);
            db.AddOutParameter(dbCommand, "@Months", DbType.Double, 8);
            db.AddOutParameter(dbCommand, "@CategoryReductionId", DbType.Int32, 4);
            db.AddOutParameter(dbCommand, "@BuildId", DbType.Int32, 4);
            db.AddOutParameter(dbCommand, "@StatusId", DbType.Int32, 4);
            db.AddOutParameter(dbCommand, "@CatmanId", DbType.Int32, 4);
            db.AddOutParameter(dbCommand, "@CustomId", DbType.Int32, 4);
            db.AddOutParameter(dbCommand, "@FieldForceId", DbType.Int32, 4);
            db.AddOutParameter(dbCommand, "@DailyId", DbType.Int32, 4);
            db.AddOutParameter(dbCommand, "@WeeklyId", DbType.Int32, 4);
            db.AddOutParameter(dbCommand, "@PromoId", DbType.Int32, 4);
            db.AddOutParameter(dbCommand, "@NumberOfContacts", DbType.Int32, 4);
            db.ExecuteNonQuery(dbCommand);
            InsightSupplier insightSupplier = new InsightSupplier();

            insightSupplier.InsightSupplierId   = insightSupplierId;
            insightSupplier.ModelTypeId         = Convert.ToInt32(db.GetParameterValue(dbCommand, "ModelTypeId"));
            insightSupplier.InsightId           = Convert.ToInt32(db.GetParameterValue(dbCommand, "InsightId"));
            insightSupplier.PastelRef           = db.GetParameterValue(dbCommand, "PastelRef").ToString();
            insightSupplier.SupplierNameModel   = db.GetParameterValue(dbCommand, "SupplierNameModel").ToString();
            insightSupplier.Notes               = db.GetParameterValue(dbCommand, "Notes").ToString();
            insightSupplier.SupplierTypeId      = Convert.ToInt32(db.GetParameterValue(dbCommand, "SupplierTypeId"));
            insightSupplier.SecurityId          = Convert.ToInt32(db.GetParameterValue(dbCommand, "SecurityId"));
            insightSupplier.SecurityLevelId     = Convert.ToInt32(db.GetParameterValue(dbCommand, "SecurityLevelId"));
            insightSupplier.Months              = Convert.ToDouble(db.GetParameterValue(dbCommand, "Months"));
            insightSupplier.CategoryReductionId = Convert.ToInt32(db.GetParameterValue(dbCommand, "CategoryReductionId"));
            insightSupplier.BuildId             = Convert.ToInt32(db.GetParameterValue(dbCommand, "BuildId"));
            insightSupplier.StatusId            = Convert.ToInt32(db.GetParameterValue(dbCommand, "StatusId"));
            insightSupplier.CatmanId            = Convert.ToInt32(db.GetParameterValue(dbCommand, "CatmanId"));
            insightSupplier.CustomId            = Convert.ToInt32(db.GetParameterValue(dbCommand, "CustomId"));
            insightSupplier.FieldForceId        = Convert.ToInt32(db.GetParameterValue(dbCommand, "FieldForceId"));
            insightSupplier.DailyId             = Convert.ToInt32(db.GetParameterValue(dbCommand, "DailyId"));
            insightSupplier.WeeklyId            = Convert.ToInt32(db.GetParameterValue(dbCommand, "WeeklyId"));
            insightSupplier.PromoId             = Convert.ToInt32(db.GetParameterValue(dbCommand, "PromoId"));
            insightSupplier.NumberOfContacts    = Convert.ToInt32(db.GetParameterValue(dbCommand, "NumberOfContacts"));
            return(insightSupplier);
        }
Ejemplo n.º 3
0
        public static List <InsightSupplier> GetInsightSupplierListByFilter(string searchValue)
        {
            List <InsightSupplier> list = new List <InsightSupplier>();

            Database  db         = DatabaseFactory.CreateDatabase("SPARInsightManagement");
            string    sqlCommand = "GetInsightSupplierListByFilter";
            DbCommand dbCommand  = db.GetStoredProcCommand(sqlCommand);

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

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    InsightSupplier insightSupplier = new InsightSupplier();
                    insightSupplier.InsightSupplierId = Convert.ToInt32(dataReader["InsightSupplierId"]);
                    insightSupplier.SupplierName      = dataReader["SupplierName"].ToString();
                    insightSupplier.ModelType         = dataReader["ModelType"].ToString();
                    insightSupplier.Status            = dataReader["Status"].ToString();
                    insightSupplier.NumberOfContacts  = Convert.ToInt32(dataReader["NumberOfContacts"]);
                    //insightSupplier.InsightId = Convert.ToInt32(dataReader["InsightId"]);
                    //insightSupplier.PastelRef = dataReader["PastelRef"].ToString();

                    //insightSupplier.Notes = dataReader["Notes"].ToString();
                    //insightSupplier.SupplierTypeId = Convert.ToInt32(dataReader["SupplierTypeId"]);
                    //insightSupplier.SecurityId = Convert.ToInt32(dataReader["SecurityId"]);
                    //insightSupplier.CategoryReductionId = Convert.ToInt32(dataReader["CategoryReductionId"]);
                    //insightSupplier.BuildId = Convert.ToInt32(dataReader["BuildId"]);
                    //insightSupplier.StatusId = Convert.ToInt32(dataReader["StatusId"]);

                    //insightSupplier.SupplierType = dataReader["SupplierType"].ToString();
                    //insightSupplier.Security = dataReader["Security"].ToString();
                    //insightSupplier.CategoryReduction = dataReader["CategoryReduction"].ToString();
                    //insightSupplier.Build = dataReader["Build"].ToString();

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