public static bool UpdateInsuranceRegions(int insurancePartnerId, string regionIds) { dbScopeManager.Execute(conn => DalCarInsuranceConfig.DeleteRegionByInsurancePartnerId(conn, insurancePartnerId)); string[] regionIdList = regionIds.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); foreach (var regionId in regionIdList) { var region = GetRegionInfo(int.Parse(regionId)); region.InsurancePartnerId = insurancePartnerId; dbScopeManager.Execute(conn => DalCarInsuranceConfig.CreateRegion(conn, region)); } return(true); }
public static bool DeleteInsurance(int insurancePartnerId) { var success = false; try { dbScopeManager.CreateTransaction(conn => { DalCarInsuranceConfig.DeleteInsurance(conn, insurancePartnerId); DalCarInsuranceConfig.DeleteRegionByInsurancePartnerId(conn, insurancePartnerId); }); success = true; } catch (Exception ex) { Logger.Error(ex.Message, ex); } return(success); }