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); } } } }
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); }