protected void cmdDelete_Click(object sender, EventArgs e)
        {
            try
            {
                //handle the delete event
                string assurName = lbAssur.SelectedItem.Text.ToString();

                Session["SelectedAssureurIndex"] = lbAssur.SelectedIndex;

                if (!string.IsNullOrWhiteSpace(assurName))
                {
                    GroupGarantySante.DeleteGroupsWithSpecificAssureurName(assurName);
                }
                else
                {
                    throw new Exception("Please select the name of the 'Assureur' for which you want to delete groups and guarantees!");
                }

                //refresh the tree
                lbAssur.DataBind();

                if (ItemExists(assurName))
                {
                    SelectItem(assurName);
                    UpdateTreeView(assurName);
                }
                else
                {
                    if (lbAssur.Items.Count > 0)
                    {
                        SelectItem(lbAssur.Items[0].Text);
                        UpdateTreeView(lbAssur.Items[0].Text);
                    }
                    else
                    {
                        tvGaranties.Nodes.Clear();
                    }
                }
            }
            catch (Exception ex)
            {
                log.Error(ex.Message);

                var myCustomValidator = new CustomValidator();
                myCustomValidator.IsValid      = false;
                myCustomValidator.ErrorMessage = ex.Message;
                Page.Validators.Add(myCustomValidator);
            }
        }
        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;
            }
        }