public MySQLExporter(VGCore core, List <MakerObj> MakerObjObjects, List <ModelObj> modelsObjects,
                             List <ModelTypeObj> modelTypesObjects, List <CarDetailsObj> carDetailsObjects, string server = "megraso.de",
                             string database = "h26346_cardata", bool ssl = true,
                             long port       = 3306, string user = "******", string password = "******")
        {
            this.SqlServer   = server;
            this.SqlDatabase = database;
            this.Sqlssl      = ssl;
            this.SqlPort     = port;
            this.SqlUser     = user;
            this.SqlPassword = password;

            this.MakersObjList     = MakerObjObjects;
            this.modelObjList      = modelsObjects;
            this.modelTypeObjList  = modelTypesObjects;
            this.carDetailsObjList = carDetailsObjects;

            this.Core = core;

            Initialize();
            _sqlCarMaker = new SQLCarMaker(this);

            _sqlCarModel = new SQLCarModel(this);

            _sqlCarModelType = new SQLCarModelType(this);

            _sqlCarDetail = new SQLCarDetails(this);
        }
Exemplo n.º 2
0
 public void Add_CarModels()
 {
     foreach (ModelObj obj in _mySqlExporter.modelObjList)
     {
         try
         {
             if (string.IsNullOrWhiteSpace(obj.MakerName))
             {
                 obj.MakerName = Core.Conf.MakerName;
             }
             long makerId = SQLCarMaker.GetMakerId(obj.MakerName);
             long modelId = GetModelId(obj.ModelName);
             if (modelId == -1)
             {
                 Insert_CarModel(obj, makerId);
             }
             else
             {
                 Update_CarModel(obj, makerId, modelId);
             }
         }
         catch (Exception ex)
         {
             if (Core != null && Core.Log != null)
             {
                 Core.Log.Error(string.Format("SQLCarModel::Add_CarModels : {0}", ex.Message));
             }
             else
             {
                 throw new Exception("SQLCarModel::Add_CarModels", ex);
             }
         }
     }
 }
Exemplo n.º 3
0
        public void Add_CarDetails()
        {
            foreach (CarDetailsObj obj in _mySqlExporter.carDetailsObjList)
            {
                try
                {
                    if (string.IsNullOrWhiteSpace(obj.Maker))
                    {
                        obj.Maker = Core.Conf.MakerName;
                    }
                    long makerId = SQLCarMaker.GetMakerId(obj.Maker);
                    long modelId = SQLCarModel.GetModelId(obj.Series);
                    long typeId  = SQLCarModelType.GetModelTypeId(obj.ModelTypeName);

                    //long id = GetCarDetailsId(makerId, modelId, typeId, obj.ModelTypeName);
                    long id = GetCarDetailsId(obj.HSN, obj.TSN, obj.ModelTypeName);
                    if (id == -1)
                    {
                        Insert_CarDetails(obj, makerId, modelId, typeId);
                    }
                    else
                    {
                        Update_CarDetails(obj, makerId, modelId, typeId, id);
                    }
                }
                catch (Exception ex)
                {
                    if (Core != null && Core.Log != null)
                    {
                        Core.Log.Error(string.Format("SQLCarDetails::Add_CarDetails : {0}", ex.Message));
                    }
                    else
                    {
                        throw new Exception("SQLCarDetails::Add_CarDetails", ex);
                    }
                }
            }
        }
        public long GetMakerID(string name)
        {
            long id = SQLCarMaker.GetMakerId(name);

            return(id);
        }