Exemplo n.º 1
0
        private void BuscarAgenda(string _fecha)
        {
            try
            {
                List <Agenda> lagenda = new AgendaBC().getAgendas((string)(Session["usrname"]), _fecha);

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

                DataTable dt = new DataTable();
                dt.Columns.Add("Hora_firma", typeof(string));
                dt.Columns.Add("id_solicitud", typeof(string));
                dt.Columns.Add("Cliente", typeof(string));
                dt.Columns.Add("Direccion", typeof(string));
                dt.Columns.Add("comuna", typeof(string));
                dt.Columns.Add("Telefono", typeof(string));
                dt.Columns.Add("Celular", typeof(string));
                dt.Columns.Add("N_intentos", typeof(string));

                DataRow row;
                DataRow rowCbo;
                rowCbo = dtcbo.Rows.Add();
                rowCbo["idSolicitud"] = "Selecionar";
                foreach (Agenda item in lagenda)
                {
                    estadoagenda        = item.Estado;
                    row                 = dt.Rows.Add();
                    row["Hora_firma"]   = item.Hora_firma;
                    row["id_solicitud"] = item.Id_solicitud;
                    row["Cliente"]      = item.Cliente;
                    row["Direccion"]    = item.Direccion;
                    row["comuna"]       = item.comuna;
                    row["Telefono"]     = item.Telefono;
                    row["Celular"]      = item.Celular;
                    row["N_intentos"]   = item.N_intentos;

                    if (item.Id_solicitud.ToString() != "0" && item.Estado.Trim() != "FIRMADA")
                    {
                        rowCbo = dtcbo.Rows.Add();
                        rowCbo["idSolicitud"] = item.Id_solicitud;
                    }
                }

                this.grdResultado.DataSource = dt;
                this.grdResultado.DataBind();

                this.cbo_nsol.DataSource = dtcbo;
                cbo_nsol.DataTextField   = "idSolicitud";
                cbo_nsol.DataValueField  = "idSolicitud";
                this.cbo_nsol.DataBind();
                cbo_nsol.SelectedValue = "Selecionar";
            }
            catch (Exception ex)
            {
                lblError.Text = ex.Message;
            }
        }
Exemplo n.º 2
0
        protected void mensajeOper(int codigo, string id_solicitud)
        {
            MailBCA   mBCA   = new MailBCABC().getMailbycodigo(codigo);
            Operacion op     = new OperacionBC().getoperacion(Convert.ToInt32(id_solicitud));
            string    ccopia = mBCA.Ccopy;

            Agenda agn = new AgendaBC().getAgenda(Convert.ToInt32(id_solicitud));

            //Usuario eject = new UsuarioBC().GetUsuario(agn.Ejecutivo);

            Persona pers = new PersonaBC().getpersonabyrut(agn.Rut_persona);

            string[]      body    = mBCA.Body.Split('.');
            Mail.Mail     mail    = new Mail.Mail();
            StringBuilder strBody = new StringBuilder();

            strBody.Append("<html><head><title>Correo Automatico</title><body>");
            strBody.Append("<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">");
            strBody.Append("<tr><td>");
            foreach (string item in body)
            {
                strBody.AppendLine("<br/>");
                strBody.AppendLine(item);
            }
            strBody.AppendLine("<br/>");
            strBody.AppendLine("Se Frimaron los siguientes Creditos");
            strBody.AppendLine("<br/>");
            strBody.AppendLine("<table whidth=\"70px\">");
            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)
                {
                    strBody.Append("<tr><td aling=\"Center\">");
                    strBody.AppendLine(idinterno);
                    strBody.Append("</td></tr>");
                }
            }
            strBody.AppendLine("</table>");
            strBody.Append("</td></tr>");
            strBody.Append("<tr><td>");
            strBody.AppendLine("<br/>");
            strBody.AppendLine("Atte.,");
            strBody.AppendLine("<br/>");
            strBody.AppendLine(mBCA.Firma);
            strBody.Append("</td></tr><tr><td>");
            strBody.Append("<IMG SRC=" + "http://190.196.121.53/imagenes/firmaCA.jpg" + ">");
            strBody.Append("</td></tr></table>");
            strBody.Append("</body></html>");
            //op.Usuario.Correo
            mail.SendMail(op.Usuario.Correo, mBCA.Ccopy, mBCA.Subject.Replace("NOperacion", id_solicitud), strBody.ToString().Replace("NOperacion", id_solicitud).Replace("NombreCliente", pers.Nombre + " " + pers.Apellido_paterno + " " + pers.Apellido_materno));
        }
Exemplo n.º 3
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();
        }
Exemplo n.º 4
0
        protected void GET_AGENDA()
        {
            Agenda magenda = new AgendaBC().getAgenda(Convert.ToInt32(lbl_Oper_ID.Text));

            //this.Datosvendedor.Mostrar_Form(magenda.Rut_persona);
            this.lbl_intentos.Visible = true;
            this.lbl_intentos.Text    = magenda.N_intentos.ToString();
            //this.bt_guardar.Enabled = true;

            EstadoOperacion mestado = new EstadooperacionBC().getUltimoEstadoByIdoperacion(Convert.ToInt32(lbl_Oper_ID.Text));

            if (mestado.Estado_operacion != null)
            {
                if (mestado.Estado_operacion.Orden == 99)
                {
                    this.label_fin.Visible    = true;
                    this.bt_finalizar.Visible = false;
                    this.bt_guardar.Visible   = false;
                    this.bt_Volver.Visible    = true;
                    this.btnRechCred.Visible  = false;
                }
            }
        }
Exemplo n.º 5
0
 private void BuscarAgenda()
 {
     try
     {
         if (dl_Usuarios.SelectedValue != "0")
         {
             List <Agenda> lagenda = new AgendaBC().getAgendas((string)(Session["usrname"]).ToString().Trim(), cld_FechaFirma.SelectedDate.ToString("yyyyMMdd"));
             this.grdResultado.DataSource = lagenda;
             this.grdResultado.DataBind();
             lblError.Text         = "";
             dl_Usuarios.BackColor = System.Drawing.Color.White;
         }
         else
         {
             lblError.Text         = "Seleccione Usuario para agendar";
             dl_Usuarios.BackColor = System.Drawing.Color.Yellow;
             dl_Usuarios.Focus();
         }
     }
     catch (Exception ex)
     {
         lblError.Text = ex.Message;
     }
 }
Exemplo n.º 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;
            }
        }
Exemplo n.º 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();
        }
Exemplo n.º 8
0
        protected void grdResultado_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int         index = Convert.ToInt32(e.CommandArgument);
            GridViewRow row   = grdResultado.Rows[index];

            string hora         = (string)row.Cells[0].Text;
            string id_solicitud = (string)row.Cells[2].Text;
            string estadoAgenda = (string)row.Cells[3].Text;

            lbl_hora.Text = hora;
            if (e.CommandName == "Reasignar")
            {
                this.lblnroOpe.Visible = true;
                this.lblnroOpe.Text    = (string)row.Cells[2].Text;
            }
            if (e.CommandName == "Tomada")
            {
                CrearOperacion(id_solicitud.Trim(), hora.Trim(), "C", cld_FechaFirma.SelectedDate.ToString("yyyy/MM/dd"));
            }
            if (e.CommandName == "Disponible")
            {
                UpdatePanel up = (UpdatePanel)this.Master.FindControl("UpdatePanel1");

                if (this.lblnroOpe.Visible == true)
                {
                    Agenda          getagenda = new AgendaBC().getAgenda(Convert.ToInt32(lblnroOpe.Text));
                    EstadoOperacion mestado   = new EstadooperacionBC().getUltimoEstadoByIdoperacion(Convert.ToInt32(lblnroOpe.Text));
                    if (getagenda.N_intentos < 3 && mestado.Estado_operacion.Orden < 99)
                    {
                        string add_estado    = new EstadooperacionBC().add_estado_orden(Convert.ToInt32(this.lblnroOpe.Text), 80, "AGND", "", (string)(Session["usrname"]));
                        string add_operacion = new AgendaBC().add_agenda(Convert.ToInt32(lblnroOpe.Text), Convert.ToDateTime(cld_FechaFirma.SelectedDate.ToString("yyyy/MM/dd")), hora, Convert.ToInt32(getagenda.Rut_persona), (string)(Session["usrname"]), getagenda.Ejecutivo, cbo_tipoagenda.SelectedValue, dl_Usuarios.SelectedValue.Trim());
                        mensaje(3, lblnroOpe.Text);
                    }
                    else
                    {
                        if (mestado.Estado_operacion.Orden == 99)
                        {
                            FuncionGlobal.alerta_updatepanel("esta operacion esta finalizada", Page, up);
                        }
                        else
                        {
                            string add_estado    = new EstadooperacionBC().add_estado_orden(Convert.ToInt32(lblnroOpe.Text), 99, "AGND", "", (string)(Session["usrname"]));
                            Int32  opr           = new OperacionBC().add_operacion(0, Convert.ToInt16(id_cliente), "AGND", (string)(Session["usrname"]), Convert.ToInt32(lblnroOpe.Text), "", 0, 0);
                            string add_operacion = new AgendaBC().add_agenda(Convert.ToInt32(opr), Convert.ToDateTime(cld_FechaFirma.SelectedDate.ToString("yyyy/MM/dd")), hora, Convert.ToInt32(getagenda.Rut_persona), (string)(Session["usrname"]), getagenda.Ejecutivo, cbo_tipoagenda.SelectedValue, dl_Usuarios.SelectedValue.Trim());
                            string add_or        = new EstadooperacionBC().add_estado_orden(Convert.ToInt32(opr), 10, "AGND", "", (string)(Session["usrname"]));
                            FuncionGlobal.alerta_updatepanel("A alcanzado el limite de cambios de Fecha y Hora su nueva Operacion es la " + opr, Page, up);

                            string magenda = new AgendaBC().del_agenda(Convert.ToInt32(lblnroOpe.Text));
                        }
                    }
                    this.lblnroOpe.Text    = "";
                    this.lblnroOpe.Visible = false;
                }
                else
                {
                    CrearOperacion(id_solicitud.Trim(), hora.Trim(), "T", cld_FechaFirma.SelectedDate.ToString("yyyy/MM/dd"));
                }
            }
            if (e.CommandName == "Rechazo")
            {
                Int32 idSol;
                if (estadoAgenda.Trim() != "FIRMADA")
                {
                    idSol = Convert.ToInt32(id_solicitud);
                    if (idSol > 0)
                    {
                        string add_estado = new EstadooperacionBC().add_estado_orden(Convert.ToInt16(id_solicitud), 60, "AGND", "", (string)(Session["usrname"]));
                        string magenda    = new AgendaBC().del_agenda(idSol);
                    }
                }
                else
                {
                    lblError.Text = "No Puede Rechazar, si la Operacion esta Finalizada.";
                }
            }


            BuscarAgenda();
        }