Beispiel #1
0
        private void gettelefonos()
        {
            DataTable dt = new DataTable();

            dt.Columns.Add(new DataColumn("id_telefono"));
            dt.Columns.Add(new DataColumn("tipo_telefono"));
            dt.Columns.Add(new DataColumn("numero"));
            DataColumn col = new DataColumn("check");

            col.DataType = System.Type.GetType("System.Boolean");
            dt.Columns.Add(col);

            List <Telefonos> ltelefonos = new TelefonoBC().gettelefonos(Convert.ToInt32(rut));

            foreach (Telefonos mtelefonos in ltelefonos)
            {
                DataRow dr = dt.NewRow();

                dr["id_telefono"]   = mtelefonos.Id_telefono;
                dr["tipo_telefono"] = mtelefonos.Tipo_telefono;
                dr["numero"]        = mtelefonos.Numero;
                dr["check"]         = mtelefonos.Check;

                dt.Rows.Add(dr);
            }

            this.gr_dato.DataSource = dt;
            this.gr_dato.DataBind();
        }
Beispiel #2
0
        protected void GuardarForm()
        {
            string output = new TelefonoBC().add_telefonos(this.Rut, this.dl_tipo_telefono.SelectedValue.Trim(), Convert.ToInt32(this.txt_numero.Text), Convert.ToInt32(this.hdn_id_telefono.Value));

            if (output != "")
            {
                ScriptManager.RegisterStartupScript(this.up_control, this.up_control.GetType(), "ErrorPersona", "alert('Ha ocurrido un error al guardar los datos del teléfono:\\n\\n" + output + "');", true);
                return;
            }
            this.Guardar_Telefono(new EventArgs());
        }
Beispiel #3
0
        protected void chk_prioridad_CheckedChanged(object sender, EventArgs e)
        {
            int index = ((GridViewRow)((CheckBox)sender).Parent.Parent).RowIndex;

            for (int i = 0; i < this.gr_datos.Rows.Count; i++)
            {
                int      id_telefono = Convert.ToInt32(this.gr_datos.DataKeys[i].Values[0]);
                CheckBox chk         = (CheckBox)this.gr_datos.Rows[i].FindControl("chk_prioridad");
                chk.Checked = (index == i) ? true : false;
                chk.Enabled = (index == i) ? false : true;
                string output = new TelefonoBC().act_checkTelefonos(id_telefono, chk.Checked.ToString());
            }
            this.Cambiar_Telefono(new EventArgs());
        }
Beispiel #4
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            if (this.txt_numero.Text == "" | this.dl_tipo_telefono.SelectedValue == "0")
            {
                FuncionGlobal.alerta("INGRESE LOS DATOS CORRESPONDIENTES", Page);
                return;
            }

            string add = new TelefonoBC().add_telefonos(rut, this.dl_tipo_telefono.SelectedValue.ToString(), Convert.ToInt32(this.txt_numero.Text), 0);

            FuncionGlobal.alerta("TELEFONO INGRESADA CON EXITO", Page);
            this.txt_numero.Text = "";

            gettelefonos();
        }
Beispiel #5
0
        protected void txt_rut_TextChanged(object sender, EventArgs e)
        {
            if (txt_rut.Text != "")
            {
                txt_dv.Text = digitoVerificador(txt_rut.Text);
            }
            Persona person = new PersonaBC().getpersonabyrut(Convert.ToInt32(txt_rut.Text.Trim()));

            if (person != null)
            {
                txtNombre.Text    = person.Nombre;
                txtApellidoP.Text = person.Apellido_paterno;
                txtApellidoM.Text = person.Apellido_materno;

                txt_celular.Text = person.Celular;

                List <Telefonos> telper = new TelefonoBC().gettelefonos(Convert.ToInt32(person.Rut));

                foreach (Telefonos item in telper)
                {
                    if (item.Tipo_telefono == "TCEL")
                    {
                        txt_celular.Text = item.Numero.ToString();
                    }
                    if (item.Tipo_telefono == "TOFI")
                    {
                        txt_telefono.Text = item.Numero.ToString();
                    }
                }

                Direcciones dirper = new DireccionesBC().getDireccionPorDefecto(Convert.ToInt32(person.Rut));



                if (dirper != null)
                {
                    txt_numeriDir.Text = dirper.Numero;
                    txtdireccion.Text  = dirper.Direccion;

                    Comuna compers = new ComunaBC().getComuna(Convert.ToInt16(dirper.Comuna.Id_Comuna));
                    cboComuna.SelectedValue = compers.Id_Comuna.ToString();
                }
            }
            else
            {
                txtNombre.Focus();
            }
        }
Beispiel #6
0
        public void actualizar()
        {
            GridViewRow row;

            for (int i = 0; i < gr_dato.Rows.Count; i++)
            {
                row = gr_dato.Rows[i];
                CheckBox chk = (CheckBox)gr_dato.Rows[i].FindControl("chk");

                string id_telefono = this.gr_dato.Rows[i].Cells[0].Text;


                string add = new TelefonoBC().act_checkTelefonos(Convert.ToInt32(id_telefono), chk.Checked.ToString());

                FuncionGlobal.alerta("PRIORIDAD ACTUALIZADA CON EXITO", Page);
            }
            gettelefonos();
        }
Beispiel #7
0
        protected void bt_guardar_Click(object sender, EventArgs e)
        {
            lblerror2.Text = "";
            if (rdbtipodir.SelectedIndex == -1)
            {
                lblerror2.Visible = true;
                lblerror2.Text    = "Debe seleccionar un tipo de direccion";
            }
            else
            {
                UpdatePanel up = (UpdatePanel)this.Master.FindControl("UpdatePanel1");


                if (txt_celular.Text != "")
                {
                    string celupers = new TelefonoBC().add_telefonos(Convert.ToInt32(txt_rut.Text), "TCEL", Convert.ToInt32(this.txt_celular.Text), 0);
                }


                if (txt_telefono.Text != "")
                {
                    string telefonopers = new TelefonoBC().add_telefonos(Convert.ToInt32(txt_rut.Text), "TOFI", Convert.ToInt32(this.txt_telefono.Text), 0);
                }

                string pers    = new PersonaBC().add_persona(Convert.ToInt32(txt_rut.Text), txt_dv.Text.Trim(), 2, "", txtNombre.Text, txtApellidoP.Text, txtApellidoM.Text, "0", "0", "", "", "", txt_telefono.Text, "", "", txtdireccion.Text, "0", rdbtipodir.SelectedValue, "", giro);
                string dirpers = new DireccionesBC().add_direcciones(Convert.ToInt32(txt_rut.Text), this.txtdireccion.Text, rdbtipodir.SelectedValue, this.txt_numeriDir.Text, Convert.ToInt32(cboComuna.SelectedValue), "", 0);

                switch (lbl_Oper_Tipo.Text)
                {
                //case "C":
                //    string magenda = new AgendaBC().del_agenda(Convert.ToInt32(lbl_Oper_ID.Text));
                //    string add_esta = new EstadooperacionBC().add_estado_orden(Convert.ToInt16(lbl_Oper_ID.Text), 60, "AGND", txt_obs.Text, (string)(Session["usrname"]));
                //    FuncionGlobal.alerta_updatepanel("Operacion " + lbl_Oper_ID.Text + " guardada correctamente", Page, up);

                //    mensajeOper(7, lbl_Oper_ID.Text);

                //    break;
                case "R":
                    if (cbo_EjeCom.SelectedValue != "0")
                    {
                        lblerror2.Text       = "";
                        cbo_EjeCom.BackColor = System.Drawing.Color.White;
                        Int32  rut     = Convert.ToInt32(txt_rut.Text);
                        string add     = new AgendaBC().add_agenda(Convert.ToInt32(lbl_Oper_ID.Text), Convert.ToDateTime(lbl_Oper_Fecha.Text), lbl_Oper_Hora.Text, rut, (string)(Session["usrname"]), cbo_EjeCom.SelectedValue, cbo_tipoagenda.SelectedValue, dl_Usuarios.SelectedValue.Trim());
                        string add_est = new EstadooperacionBC().add_estado_orden(Convert.ToInt32(lbl_Oper_ID.Text), 80, "AGND", txt_obs.Text, (string)(Session["usrname"]));
                    }
                    else
                    {
                        lblerror2.Text       = "debe Seleccionar un Ejecutivo Comercial";
                        cbo_EjeCom.BackColor = System.Drawing.Color.Yellow;
                        cbo_EjeCom.Focus();
                        return;
                    }
                    break;

                case "T":
                    if (cbo_EjeCom.SelectedValue != "0")
                    {
                        lblerror2.Text       = "";
                        cbo_EjeCom.BackColor = System.Drawing.Color.White;
                        Int32  opr           = new OperacionBC().add_operacion(0, Convert.ToInt16(lbl_Oper_IDCli.Text), "AGND", (string)(Session["usrname"]), 0, "", 0, 0);
                        string add_operacion = new AgendaBC().add_agenda(Convert.ToInt32(opr), Convert.ToDateTime(lbl_Oper_Fecha.Text), lbl_Oper_Hora.Text, Convert.ToInt32(txt_rut.Text), (string)(Session["usrname"]), cbo_EjeCom.SelectedValue, cbo_tipoagenda.SelectedValue, dl_Usuarios.SelectedValue.Trim());
                        string add_or        = new EstadooperacionBC().add_estado_orden(Convert.ToInt32(opr), 10, "AGND", txt_obs.Text, (string)(Session["usrname"]));

                        foreach (GridViewRow row in grdAddCreditos.Rows)
                        {
                            string idref  = row.Cells[0].Text;
                            string addBCA = new MasterBCABC().add_MasterBCA(opr, idref, 0);
                        }
                        mensajeOper(1, opr.ToString());
                        FuncionGlobal.alerta_updatepanel("Operacion " + opr + " guardada correctamente", Page, up);
                    }
                    else
                    {
                        lblerror2.Text       = "debe Seleccionar un Ejecutivo Comercial";
                        cbo_EjeCom.BackColor = System.Drawing.Color.Yellow;
                        cbo_EjeCom.Focus();
                        return;
                    }
                    break;
                }

                bt_guardar.Enabled = false;
                bt_Volver.Visible  = true;
            }
        }
Beispiel #8
0
        private void CrearOperacion(string _id_oper, string _hora, string _tipo, string _fecha)
        {
            txt_obs.Text          = "";
            TBL_Agenda.Visible    = false;
            TBL_Operacion.Visible = true;
            lblerror2.Text        = "";
            id_solicitud          = _id_oper;
            fecha = _fecha;
            hora  = _hora;
            tipo  = _tipo;
            bt_guardar.Enabled  = false;
            lbl_Oper_Fecha.Text = fecha;
            lbl_Oper_Hora.Text  = hora;
            lbl_Oper_ID.Text    = _id_oper;
            lbl_Oper_Tipo.Text  = _tipo;

            if (tipo == "C")
            {
                Agenda agaux = new AgendaBC().getAgenda(Convert.ToInt32(id_solicitud));

                Persona          pers   = new PersonaBC().getpersonabyrut(agaux.Rut_persona);
                Direcciones      dirper = new DireccionesBC().getDireccionPorDefecto(Convert.ToInt32(pers.Rut));
                List <Telefonos> telper = new TelefonoBC().gettelefonos(Convert.ToInt32(pers.Rut));
                txt_rut.Text             = pers.Rut.ToString();
                txt_dv.Text              = pers.Dv;
                txtNombre.Text           = pers.Nombre;
                txtApellidoP.Text        = pers.Apellido_paterno;
                txtApellidoM.Text        = pers.Apellido_materno;
                cbo_EjeCom.SelectedValue = agaux.Ejecutivo;
                txtdireccion.Text        = dirper.Direccion;
                txt_numeriDir.Text       = dirper.Numero;
                this.giro = pers.Giro;
                foreach (Telefonos item in telper)
                {
                    if (item.Tipo_telefono == "TCEL")
                    {
                        txt_celular.Text = item.Numero.ToString();
                    }
                    if (item.Tipo_telefono == "TOFI")
                    {
                        txt_telefono.Text = item.Numero.ToString();
                    }
                }

                if (dirper.Tipo_direccion != null && dirper.Tipo_direccion != "")
                {
                    rdbtipodir.SelectedValue = dirper.Tipo_direccion.Trim();
                }
                //this.bt_finalizar.Visible = true;
                //this.bt_guardar.Text = "Eliminar";

                txt_cantidadCredito.Visible = false;
                btnAgregarcredito.Visible   = false;
                Label18.Visible             = false;

                btnRechCred.Visible = false;
                List <MasterBCA> lbca = new MasterBCABC().getMAsterBCA(Convert.ToInt32(id_solicitud));
                CreditosBice(lbca);
            }

            this.lbl_fecha.Text     = fecha;// +" " + hora;
            this.lbl_operacion.Text = id_solicitud;
            GET_AGENDA();
        }