Example #1
0
        private void loginButton_Click(object sender1, EventArgs e)
        {
            string username = username_login.Text.ToString();
            string password = password_login.Text.ToString();

            if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password))
            {
                showErrorMsg("Por favor, introduzca el nombre de usuario y contraseña", "Formulario no válido");
            }
            else
            {
                UserWSClient ws = new UserWSClient();
                try
                {
                    string authToken = ws.login(username, password);
                    if (string.IsNullOrEmpty(authToken))
                    {
                        showErrorMsg("Credenciales de acceso incorrectas", "Login Incorrecto");
                    }
                    else
                    {
                        this.Hide();
                        HomeForm homeForm = new HomeForm(authToken, this);
                        homeForm.Closed += (s, args) => this.Close();
                        homeForm.Show();
                    }
                } catch (Exception ex)
                {
                    showErrorMsg(ex.Message, "Error");
                }
            }
        }
Example #2
0
 public CategoryForm(string authToken, HomeForm parentForm, editCategoryData category = null)
 {
     this.authToken  = authToken;
     this.parentForm = parentForm;
     this.category   = category;
     InitializeComponent();
     if (category != null)
     {
         InitializeEditData();
         saveCategoryBtn.Hide();
     }
     else
     {
         editCategoryBtn.Hide();
     }
 }
Example #3
0
 public CompanyForm(string authToken, HomeForm parentForm, editCompanyData company = null)
 {
     this.authToken  = authToken;
     this.company    = company;
     this.parentForm = parentForm;
     InitializeComponent();
     InitializeDocumentTypeCombo();
     if (company != null)
     {
         InitializeEditData();
         save_company_button.Hide();
     }
     else
     {
         edit_company_button.Hide();
     }
 }
Example #4
0
 public UserForm(bool seller, string authToken, HomeForm form, dynamic user = null)
 {
     this.parentForm = form;
     this.seller     = seller;
     this.authToken  = authToken;
     InitializeComponent();
     InitializeDocumentCombobox(seller);
     InitializeCompanies(seller);
     if (!seller)
     {
         user_company.Hide();
         user_company_label.Hide();
     }
     if (user != null)
     {
         this.user = user;
         InitializeEditUser(seller);
         save_user_button.Hide();
     }
     else
     {
         edit_user_button.Hide();
     }
 }