Пример #1
0
        protected void SubmitResponsable_Click(object sender, EventArgs e)
        {
            Button b = (Button)sender;

            using (Helpdesk.Entities.Agences.AgenceEntities dbag = new Entities.Agences.AgenceEntities())
            {
                if (b.Text == "Ajouter")
                {
                    Helpdesk.Entities.Agences.Responsables respo = new Entities.Agences.Responsables()
                    {
                        Email = EmailResponsable.Text, Niveau = 3, Role = 2, Nom = NomResponsable.Text, Prenom = PrenomResponsable.Text, Teléphone = TelephoneResponsable.Text
                    };
                    dbag.AddToResponsables(respo);
                    dbag.SaveChanges();
                }
                if (b.Text == "Modifier")
                {
                    var req = from value in dbag.Responsables where value.ID == Resp select value;
                    var res = req.FirstOrDefault();
                    res.Nom       = NomResponsable.Text;
                    res.Prenom    = PrenomResponsable.Text;
                    res.Email     = EmailResponsable.Text;
                    res.Teléphone = TelephoneResponsable.Text;

                    dbag.SaveChanges();
                }
            }
            if (Request.QueryString["Page"] == "Update")
            {
                System.Web.HttpContext.Current.Response.Write("<script>");
                System.Web.HttpContext.Current.Response.Write("parent.document.getElementById('ButtonEditDone').click();");
                System.Web.HttpContext.Current.Response.Write("<" + "/script>");
            }
            if (Request.QueryString["Page"] == "Affiche")
            {
                System.Web.HttpContext.Current.Response.Write("<script>");
                System.Web.HttpContext.Current.Response.Write("parent.location.reload(true);");
                System.Web.HttpContext.Current.Response.Write("<" + "/script>");
            }
        }
Пример #2
0
 protected void ActionR_Click(object sender, EventArgs e)
 {
     if ((String.IsNullOrEmpty(TextBoxEmailR.Text) || String.IsNullOrWhiteSpace(TextBoxEmailR.Text)) || (String.IsNullOrEmpty(TextBoxNomR.Text) || String.IsNullOrWhiteSpace(TextBoxNomR.Text)) || (String.IsNullOrEmpty(TextBoxPasswordR.Text) || String.IsNullOrWhiteSpace(TextBoxPasswordR.Text)) || (String.IsNullOrEmpty(TextBoxPrenomR.Text) || String.IsNullOrWhiteSpace(TextBoxPrenomR.Text)) || (String.IsNullOrEmpty(TextBoxUsernameR.Text) || String.IsNullOrWhiteSpace(TextBoxUsernameR.Text)))
     {
         Utilitaire.Utilites.MSG(msgboxpanel, "Remplir les champs", "Champs Invalides");
     }
     else
     {
         using (Helpdesk.Entities.Agences.AgenceEntities a = new Entities.Agences.AgenceEntities())
         {
             Helpdesk.Entities.Agences.Responsables u = new Entities.Agences.Responsables()
             {
                 Email = TextBoxEmailR.Text, Niveau = 2, Nom = TextBoxNomR.Text, Password = Utilitaire.Encryption.AESEncryption.Encrypt(TextBoxPasswordR.Text), Prenom = TextBoxPrenomR.Text, Username = TextBoxUsernameR.Text, Role = 1
             };
             a.AddToResponsables(u);
             a.SaveChanges();
             System.Web.HttpContext.Current.Response.Write("<script>");
             System.Web.HttpContext.Current.Response.Write("parent.location.reload(true);");
             System.Web.HttpContext.Current.Response.Write("<" + "/script>");
         }
     }
 }