Beispiel #1
0
        protected void bt_GrabaCreditos_Click(object sender, EventArgs e)
        {
            try
            {
                if (grdCreditos.Rows.Count > 0)
                {
                    foreach (GridViewRow row in grdCreditos.Rows)
                    {
                        string idref;
                        string idinterno;
                        idref     = row.Cells[0].Text;
                        idinterno = row.Cells[1].Text;
                        CheckBox chkF = (CheckBox)row.Cells[2].FindControl("chkfirma");

                        if (chkF.Checked)
                        {
                            Int32  opr    = new OperacionBC().add_operacion(0, 1, "CBCA", (string)(Session["usrname"]), 0, "", 0, 0);
                            string add_or = new EstadooperacionBC().add_estado_orden(Convert.ToInt32(opr), 1, "CBCA", "", (string)(Session["usrname"]));
                            string add    = new MasterBCABC().add_MasterBCA(Convert.ToInt32(idref), idinterno, opr);
                        }
                    }
                    cargagrillacredito();
                    grdCreditos.Visible      = false;
                    grdnewcredit.Visible     = true;
                    bt_GrabaCreditos.Enabled = false;
                    btn_Enviar.Visible       = true;
                }
            }
            catch (Exception ex)
            {
                lblError.Text = ex.Message;
            }
        }
Beispiel #2
0
        private void cargagrillacredito()
        {
            lblid.Text = cbo_nsol.SelectedValue;

            List <MasterBCA> msc = new MasterBCABC().getMAsterBCA(Convert.ToInt32(lblid.Text));

            DataTable dtcra = new DataTable();

            dtcra.Columns.Add("idSolicitud", typeof(string));
            dtcra.Columns.Add("ninterno", typeof(string));
            dtcra.Columns.Add("id_Ope", typeof(string));

            foreach (MasterBCA item in msc)
            {
                if (item.Id_credito != 0)
                {
                    DataRow rowcr;
                    rowcr = dtcra.Rows.Add();
                    rowcr["idSolicitud"] = item.Id_solicitud;
                    rowcr["ninterno"]    = item.Id_interno;
                    rowcr["id_Ope"]      = item.Id_credito;
                }
            }
            this.grdnewcredit.DataSource = dtcra;
            this.grdnewcredit.DataBind();
        }
Beispiel #3
0
        protected void btn_Crt_Firm_Click(object sender, EventArgs e)
        {
            try
            {
                List <MasterBCA> msc = new MasterBCABC().getMAsterBCA(Convert.ToInt32(lblid.Text));

                foreach (MasterBCA itemBCA in msc)
                {
                    auxcredito = auxcredito + itemBCA.Id_credito;
                }

                if (auxcredito == 0)
                {
                    TBL_ING_CREDITO.Visible = true;
                    TBL_AGENDA.Visible      = false;
                    lblid.Text = cbo_nsol.SelectedValue;

                    DataTable dtcr = new DataTable();
                    dtcr.Columns.Add("idSolicitud", typeof(string));
                    dtcr.Columns.Add("idInterno", typeof(string));

                    List <MasterBCA> LstBCA = new MasterBCABC().getMAsterBCA(Convert.ToInt32(cbo_nsol.SelectedValue));

                    DataRow drNewRow;
                    foreach (MasterBCA item in LstBCA)
                    {
                        drNewRow = dtcr.NewRow();
                        drNewRow["idSolicitud"] = item.Id_solicitud;
                        drNewRow["idInterno"]   = item.Id_interno;
                        dtcr.Rows.Add(drNewRow);
                    }

                    this.grdCreditos.DataSource = dtcr;
                    this.grdCreditos.DataBind();
                }
                else
                {
                    TBL_ING_CREDITO.Visible = true;
                    TBL_AGENDA.Visible      = false;
                    lblid.Text = cbo_nsol.SelectedValue;

                    cargagrillacredito();
                    grdCreditos.Visible      = false;
                    grdnewcredit.Visible     = true;
                    bt_GrabaCreditos.Enabled = false;
                    btn_Enviar.Visible       = true;
                }
            }
            catch (Exception ex)
            {
                lblError.Text = ex.Message;
            }
        }
Beispiel #4
0
        private void CagraGrilla()
        {
            List <Operacion> lstcreditos = new OperacionBC().getCreditosBCA();

            DataTable dt = new DataTable();

            dt.Columns.Add("id_solicitud", typeof(string));
            dt.Columns.Add("N_interno", typeof(string));
            dt.Columns.Add("Cliente", typeof(string));
            dt.Columns.Add("Estado", typeof(string));
            dt.Columns.Add("Fecha", typeof(string));
            dt.Columns.Add("OBS", typeof(string));

            DataRow row;

            foreach (Operacion item in lstcreditos)
            {
                if (item.Estado == "CREDITO OTORGADO NO PAGADO")
                {
                    MasterBCA       mst   = new MasterBCABC().getMAsterBCAbyid(Convert.ToInt32(item.Id_solicitud));
                    Agenda          agd   = new AgendaBC().getAgenda(mst.Id_solicitud);
                    Persona         pers  = new PersonaBC().getpersonabyrut(agd.Rut_persona);
                    EstadoOperacion estop = new EstadooperacionBC().getUltimoEstadoByIdoperacion(Convert.ToInt32(item.Id_solicitud));
                    row = dt.Rows.Add();
                    row["id_solicitud"] = item.Id_solicitud;
                    row["N_interno"]    = mst.Id_interno;
                    row["Cliente"]      = pers.Nombre + " " + pers.Apellido_paterno + " " + pers.Apellido_materno;
                    row["Estado"]       = item.Estado;
                    row["Fecha"]        = item.Fecha_solicitud;
                    row["OBS"]          = estop.Observacion;
                }
            }

            if (dt.Columns.Count > 0)
            {
                this.btn_Aceptar.Enabled = true;
            }
            this.grdResultado.DataSource = dt;
            this.grdResultado.DataBind();
        }
Beispiel #5
0
        private void cargagrillacredito()
        {
            List <MasterBCA> msc = new MasterBCABC().getListMasterBCAall();

            DataTable dtcra = new DataTable();

            dtcra.Columns.Add("idSolicitud", typeof(string));
            dtcra.Columns.Add("ninterno", typeof(string));
            dtcra.Columns.Add("id_Ope", typeof(string));

            foreach (MasterBCA item in msc)
            {
                if (item.Id_credito != 0)
                {
                    DataRow rowcr;
                    rowcr = dtcra.Rows.Add();
                    rowcr["idSolicitud"] = item.Id_solicitud;
                    rowcr["ninterno"]    = item.Id_interno;
                    rowcr["id_Ope"]      = item.Id_credito;
                }
            }
            this.grdnewcredit.DataSource = dtcra;
            this.grdnewcredit.DataBind();
        }
Beispiel #6
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 #7
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();
        }