public static void RecreateGroupsGarantiesSanteFromPresta() { try { //truncate table GroupGarantySante GroupGarantySante.TruncateTable(); //get data from PrestSante List <GroupesGarantiesSante> GroupGarantyList = PrestSante.GetGroupGarantyList(); //add data to GroupGarantySante // ### Paramètres par défaut foreach (GroupesGarantiesSante item in GroupGarantyList) { int id = GroupGarantySante.InsertGroupGaranty(new GroupGarantySante { AssureurName = item.AssureurName, GroupName = item.GroupName, GarantyName = item.GarantyName, CodeActe = item.CodeActe, OrderNumber = 1 }); } } catch (Exception ex) { log.Error(ex.Message); throw ex; } }
public static void ImportGroupsGarantiesSanteForAssureur(string assureurName, string excelFilePath, bool firstRowAsColumnNames) { try { string groupName; string garantyName; string codeActe; int orderNumber; //read Excel file into datatable DataTable dt = G.ExcelToDataTable(excelFilePath, firstRowAsColumnNames); // delete all rows in DB Tables with the specified assurName GroupGarantySante.DeleteGroupsWithSpecificAssureurName(assureurName); foreach (DataRow row in dt.Rows) { //### validate => all fields must be specified groupName = row[C.eExcelGroupsGaranties.GroupName.ToString()].ToString(); garantyName = row[C.eExcelGroupsGaranties.GarantyName.ToString()].ToString(); codeActe = row[C.eExcelGroupsGaranties.CodeActe.ToString()].ToString(); if (!Int32.TryParse(row[C.eExcelGroupsGaranties.OrderNumber.ToString()].ToString(), out orderNumber)) { orderNumber = 9999; } int id = GroupGarantySante.InsertGroupGaranty(new GroupGarantySante { AssureurName = assureurName, GroupName = groupName, GarantyName = garantyName, CodeActe = codeActe, OrderNumber = orderNumber }); } } catch (Exception ex) { log.Error(ex.Message); throw ex; } }