public void AddnewRecordInVehicleStatus(Int32 iVehicleId, Int32 iShopId, ImportData objImportData) { UserBL objUserBL = null; String strShopId = String.Empty; //Get Vehicle Info object from current vehicle ID VehicleInfoBL objVehicleInfoBL = VehicleInfoBL.getDataId(iVehicleId); if (objVehicleInfoBL != null) { //Create UserBL object from user ID used in Vehicle Info table objUserBL = UserBL.getByActivityId(Convert.ToInt32(objVehicleInfoBL.iUserId)); strShopId = Convert.ToString(iShopId); } if (objUserBL != null && objVehicleInfoBL != null && !String.IsNullOrEmpty(strShopId)) { SaveVehicleStatus(objVehicleInfoBL, objImportData, objUserBL, strShopId); UserVehicleStatusBL objUserVehicleStatusBL = UserVehicleStatusBL.getDataByVehicleId(iVehicleId); if (objUserVehicleStatusBL != null) { MarketingUsers objMarUser = MarketingUsers.getDataByShopUserAndVehicleId(iShopId, Convert.ToInt32(objVehicleInfoBL.iUserId), iVehicleId); objMarUser.bisShowInProcess = true; objMarUser.Save(); } } else { return; } }
/// <summary> /// Update Vehicle Information /// </summary> /// <param name="iVehicleId"></param> /// <param name="objImportData"></param> /// <returns></returns> private Boolean updateVehicleData(Int32 iVehicleId, ImportData objImportData) { try { //Get Vehicle object from database using vehicle_id VehicleInfoBL objVehicleInfo = VehicleInfoBL.getDataId(iVehicleId); if (objVehicleInfo != null) { if (!String.IsNullOrEmpty(objImportData.Style)) { objVehicleInfo.strStyle = objImportData.Style; } if (!String.IsNullOrEmpty(objImportData.Color)) { objVehicleInfo.strColor = objImportData.Color; } if (!String.IsNullOrEmpty(objImportData.Paint_Code)) { objVehicleInfo.strPaintCode = objImportData.Paint_Code; } if (!String.IsNullOrEmpty(objImportData.VIN)) { objVehicleInfo.strVIN = objImportData.VIN; } if (!String.IsNullOrEmpty(objImportData.EstimatorName.Trim())) { objVehicleInfo.strEstimatorName = objImportData.EstimatorName; } if (!String.IsNullOrEmpty(objImportData.License)) { objVehicleInfo.strLicense = objImportData.License; } return(objVehicleInfo.Save()); } } catch (Exception ex) { Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionPolicy.HandleException(ex, SummitShopApp.Utility.Constants.ExceptionPolicy); } return(false); }