Exemple #1
0
        public void OnResponse(object response, RequestCodes requestCode)
        {
            if (requestCode == RequestCodes.UserSignedUp)
            {
                int result = int.Parse(response.ToString());
                if (result > 0)
                {
                    Program.UserId = int.Parse(response.ToString());
                    GetRoleType(userId: int.Parse(response.ToString()));
                }
                else if (result == (int)SignUpStatus.AlreadyRegistered)
                {
                    MessageBox.Show("شما قبلا ثبت نام کرده اید");
                }
                else if (result == (int)SignUpStatus.Exception)
                {
                    MessageBox.Show("خطایی رخ داده");
                }
            }
            else if (requestCode == RequestCodes.RoleTypeReceived)
            {
                labelWating.Visible = false;

                int result = int.Parse(response.ToString());
                if (result == (int)RoleTypes.CounseltorRole)
                {
                    this.Invoke(new Action(() =>
                    {
                        this.Hide();
                        ConsulatorForm consulatorForm = new ConsulatorForm();
                        consulatorForm.Show();
                    }));
                }
                else if (result == (int)RoleTypes.CounselorRecipentRole || result == (int)RoleTypes.RobotRole)
                {
                    this.Invoke(new Action(() =>
                    {
                        this.Hide();
                        ConsultationRecipientForm recipientForm = new ConsultationRecipientForm();
                        recipientForm.Show();
                    }));
                }
            }
        }
        public void OnResponse(object response, RequestCodes requestCode)
        {
            if (requestCode == RequestCodes.UserSignedIn)
            {
                int result = int.Parse(response.ToString());
                if (result > 0)
                {
                    Program.UserId = int.Parse(response.ToString());
                    GetRoleType(int.Parse(response.ToString()));
                }
                else if (result == (int)LoginStatus.WrongPasswordOrUserName)
                {
                    MessageBox.Show("نام کاربری یا گذرواژه اشتباه است");
                }
            }
            else if (requestCode == RequestCodes.RoleTypeReceived)
            {
                labelWating.Visible = false;

                int result = int.Parse(response.ToString());
                if (result == (int)RoleTypes.CounseltorRole)
                {
                    this.Invoke(new Action(() =>
                    {
                        this.Hide();
                        ConsulatorForm consulatorForm = new ConsulatorForm();
                        consulatorForm.Show();
                    }));
                }
                else if (result == (int)RoleTypes.CounselorRecipentRole || result == (int)RoleTypes.RobotRole)
                {
                    this.Invoke(new Action(() =>
                    {
                        this.Hide();
                        ConsultationRecipientForm recipientForm = new ConsultationRecipientForm();
                        recipientForm.Show();
                    }));
                }
            }
        }