Exemplo n.º 1
0
    protected void btn_AllApp_Click(object sender, EventArgs e)
    {
        //1 = Dep, 2 = Kilo

        List <CheckBox> allControls = new List <CheckBox>();

        GetControlList <CheckBox>(Page.Controls, allControls);
        foreach (var childControl in allControls)
        {
            CheckBox cbx = ((CheckBox)childControl); //On fait apparaitre visuellement les modifs, c'est obligatoire pour une raison que j'ignore
            cbx.Checked = true;
            char[] idString = cbx.ID.ToArray();
            int    type     = int.Parse(idString[idString.Length - 1].ToString());

            int id = int.Parse(childControl.ID.Split('-')[1]);
            if (type == 1)
            {
                //Dep
                BD_CoEco.ApprouverDepenseByID(id, true);
            }
            else
            {
                BD_CoEco.ApprouverKilometrageById(id, true);
            }
        }
    }