예제 #1
0
        private void btn_guardar_Click(object sender, EventArgs e)
        {
            string  nombre = txt_zona.Text.Trim();
            decimal precio = txt_precio.Value;


            if (nombre == "" || precio <= 0)
            {
                sub_frm.modal_login modal = new sub_frm.modal_login();
                modal.ShowDialog();
            }
            else
            {
                if (id == null)
                {
                    domicilios.Insertar(nombre, (int)precio);
                    int?x = 2;
                    sub_frm.modal_login modal = new sub_frm.modal_login(x);
                    modal.ShowDialog();
                    this.Close();
                }
                else
                {
                    domicilios.Editar((int)id, nombre, (int)precio);
                    int?x = 2;
                    sub_frm.modal_login modal = new sub_frm.modal_login(x);
                    modal.ShowDialog();
                    this.Close();
                }
            }
        }
예제 #2
0
        private void btn_guardar_Click(object sender, EventArgs e)
        {
            string nombre      = txt_nombre.Text.Trim();
            string usuario     = txt_usuario.Text.Trim();
            string pass        = txt_pass.Text.Trim();
            string confir_pass = txt_confir_pass.Text.Trim();
            string rol;

            if (cb_admin.Checked == false && cb_vendedor.Checked == false)
            {
                sub_frm.modal_login modal = new sub_frm.modal_login();
                modal.ShowDialog();
            }
            else
            {
                if (pass != confir_pass)
                {
                    int?x = 3;
                    sub_frm.modal_login modal = new sub_frm.modal_login(x);
                    modal.ShowDialog();
                }
                else
                {
                    if (cb_admin.Checked == true)
                    {
                        rol = "Admin";
                    }
                    else
                    {
                        rol = "Vendedor";
                    }

                    if (nombre == "" || usuario == "" || pass == "" || confir_pass == "")
                    {
                        sub_frm.modal_login modal = new sub_frm.modal_login();
                        modal.ShowDialog();
                    }
                    else
                    {
                        if (id == null)
                        {
                            usuarios.Insertar(nombre, usuario, pass, rol);
                            int?x = 2;
                            sub_frm.modal_login modal = new sub_frm.modal_login(x);
                            modal.ShowDialog();
                            this.Close();
                        }
                        else
                        {
                            usuarios.Editar((int)id, nombre, usuario, pass, rol);
                            int?x = 2;
                            sub_frm.modal_login modal = new sub_frm.modal_login(x);
                            modal.ShowDialog();
                            this.Close();
                        }
                    }
                }
            }
        }
예제 #3
0
        private void btn_guardar_Click(object sender, EventArgs e)
        {
            string nombre = txt_nombre.Text.Trim();
            string nid    = txt_nid.Text.Trim();
            string tlf    = txt_tlf.Text.Trim();
            string direc1 = txt_direc1.Text.Trim();
            string direc2 = txt_direc2.Text.Trim();


            if (nombre == "" || tlf == "" || direc1 == "")
            {
                sub_frm.modal_login modal = new sub_frm.modal_login();
                modal.ShowDialog();
            }
            else
            {
                if (direc2 == "")
                {
                    direc2 = "no posee";
                }
                if (nid == "")
                {
                    nid = "no posee";
                }


                if (id == null)
                {
                    clientes.Insertar(nombre, nid, tlf, direc1, direc2);
                    int?x = 2;
                    sub_frm.modal_login modal = new sub_frm.modal_login(x);
                    modal.ShowDialog();
                    this.Close();
                }
                else
                {
                    clientes.Editar((int)id, nombre, nid, tlf, direc1, direc2);
                    int?x = 2;
                    sub_frm.modal_login modal = new sub_frm.modal_login(x);
                    modal.ShowDialog();
                    this.Close();
                }
            }
        }