Ejemplo n.º 1
0
        public RenderForm(string login)
        {
            //MessageBox.Show("login: "******"RenderForm.Constructor");
            InitializeComponent();

            this.login = login;
            Manager.ExpertManager.Expert exprt = Manager.XMLManager.XMLExpert.SearchById(this.login);

            string str = exprt.getFirstName() + " " + exprt.getLastName();

            this.lbl_Text.Text = "Expert: " + str;
            //Mettre le label au centre
            this.lbl_Text.Location = new Point((958 - 29 - lbl_Text.Width) / 2, lbl_Text.Top);
            Objects = new List <Object3d>();

            tmr_CheckNotification.Enabled = true;

            this.SCREEN_WIDTH  = pic3d.Width;
            this.SCREEN_HEIGHT = pic3d.Height;

            Children = new Stack();
        }
Ejemplo n.º 2
0
        private void btn_Validate_Click(object sender, EventArgs e)
        {
            InitializeLabelColors();
            Actor act = new Actor();

            act.setLogin(txtBx_Login.Text);
            act.setPassword(txtBx_Password.Text);

            bool ret = true;

            if (txtBx_Login.Text == "")
            {
                lbl_Login.ForeColor = emptyFieldColor;
                ret = false;
            }

            if (txtBx_Password.Text == "")
            {
                lbl_Password.ForeColor = emptyFieldColor;
                ret = false;
            }

            if (!ret)
            {
                MessageBox.Show(this, "Veuillez remplir tous les champs", "Message d'erreur", MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
                return;
            }

            ret = true;

            if (!act.HasValidLogin())
            {
                lbl_Login.ForeColor = invalidFieldColor;
                ret = false;
            }

            if (!act.HasValidPassword())
            {
                lbl_Password.ForeColor = invalidFieldColor;
                ret = false;
            }
            if (!ret)
            {
                MessageBox.Show(this, "Le login ou bien le mot de passe est invalide", "Message d'erreur", MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
                return;
            }
            if (CorrectLogin())
            {
                Manager.ExpertManager.Expert expert = new Manager.ExpertManager.Expert();
                expert = expert.getExpert(txtBx_Login.Text);
                Manager.Helper.service = new Service1();

connect:
                try
                {
                    if (!Manager.Helper.service.ConnectExpert(expert.getLogin(), expert.getFirstName(), expert.getLastName(), ""))
                    {
                        MessageBox.Show("Vous n'êtes pas connectés, ressayez!", "frm_Login.btn_Validate");
                        return;
                    }
                }
                catch (WebException)
                {
                    MessageBox.Show("Problème de connection", "frm_Login.btn_Validate");
                    return;
                }
                catch (System.Web.Services.Protocols.SoapException)
                {
                    try
                    {
                        Manager.Helper.service.DisconnectExpert(txtBx_Login.Text);
                        goto connect;
                    }
                    catch (Exception)
                    {
                        MessageBox.Show("Problème de connection, essayer plus tard.", "frm_Login.btn_Validate");
                        return;
                    }
                }
                this.Tag = txtBx_Login.Text;
                //this.ShowInTaskbar = false;
                //this.Hide();
                //(new AdministratorApp()).ShowDialog();
                Close();
            }
            else
            {
                MessageBox.Show(this, "Le login ou bien le mot de passe est erroné", "Message d'erreur", MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
            }
        }