public List <entAsigncionLlamadas> ListaClientesAsignadosXUsuario(Int32 UsuarioId)
        {
            SqlCommand    cmd = null;
            SqlDataReader dr  = null;
            List <entAsigncionLlamadas> Lista = null;

            try
            {
                SqlConnection cn = Conexion.Instancia.Conectar();
                cmd = new SqlCommand("spListaClientesAsignadosXUsuario", cn);
                cmd.Parameters.AddWithValue("@prmtIntIdUsu", UsuarioId);
                cmd.CommandType = CommandType.StoredProcedure;
                cn.Open();
                dr    = cmd.ExecuteReader();
                Lista = new List <entAsigncionLlamadas>();

                while (dr.Read())
                {
                    entSegmento s = new entSegmento();
                    s.Seg_Id = Convert.ToInt32(dr["Cli_Seg_Id"]);

                    entCliente c = new entCliente();
                    c.Cli_Id            = Convert.ToInt32(dr["Cli_Id"]);
                    c.Cli_Nombre        = dr["Cli_Nombre"].ToString();
                    c.Cli_RazonSocial   = dr["Cli_RazonSocial"].ToString();
                    c.Cli_Estado        = dr["Cli_Estado"].ToString();
                    c.Cli_FechaRegistro = Convert.ToDateTime(dr["Cli_FechaRegistro"]);
                    c.Segmento          = s;

                    entTelefono t = new entTelefono();
                    t.Tel_Id        = Convert.ToInt32(dr["Tel_Id"]);
                    t.Tel_Numero    = dr["Tel_Numero"].ToString();
                    t.Tel_Producto  = dr["Tel_Producto"].ToString();
                    t.Tel_FechaAlta = Convert.ToDateTime(dr["Tel_FechaAlta"]);

                    entCliente_Telefono ct = new entCliente_Telefono();
                    ct.CliTel_Id = Convert.ToInt32(dr["CliTel_Id"]);
                    ct.Cliente   = c;
                    ct.Telefono  = t;

                    entAsigncionLlamadas al = new entAsigncionLlamadas();
                    al.Asi_Id          = Convert.ToInt32(dr["Asi_Id"]);
                    al.ClienteTelefono = ct;

                    Lista.Add(al);
                }
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                cmd.Connection.Close();
            }
            return(Lista);
        }
Esempio n. 2
0
        public List <entRegLamadas> ListLlamAgen(int idusuario)
        {
            SqlCommand           cmd   = null;
            SqlDataReader        dr    = null;
            List <entRegLamadas> Lista = null;

            try
            {
                SqlConnection cn = Conexion.Instancia.Conectar();
                cmd = new SqlCommand("spListaCliAgend", cn);
                cmd.Parameters.AddWithValue("@IS_USUARIO", idusuario);
                cmd.CommandType = CommandType.StoredProcedure;
                cn.Open();
                dr    = cmd.ExecuteReader();
                Lista = new List <entRegLamadas>();
                while (dr.Read())
                {
                    entRegLamadas r = new entRegLamadas();
                    r.rll_id            = Convert.ToInt32(dr["rll_id"]);
                    r.rll_resultado     = dr["rll_resultado"].ToString();
                    r.rll_fechahor_reg  = Convert.ToDateTime(dr["rll_fechahor_reg"].ToString());
                    r.rll_estado        = dr["rll_estado"].ToString();
                    r.rll_observaciones = dr["rll_observaciones"].ToString();
                    entCliente_Telefono ct = new entCliente_Telefono();
                    ct.CliTel_Id = Convert.ToInt32(dr["CliTel_Id"]);
                    entCliente c = new entCliente();
                    c.Cli_Id     = Convert.ToInt32(dr["Cli_Id"]);
                    c.Cli_Nombre = dr["Cli_Nombre"].ToString();
                    ct.Cliente   = c;
                    entTelefono t = new entTelefono();
                    t.Tel_Id        = Convert.ToInt32(dr["Tel_Id"]);
                    t.Tel_Numero    = dr["Tel_Numero"].ToString();
                    ct.Telefono     = t;
                    r.cliente_telef = ct;
                    entAsigncionLlamadas al = new entAsigncionLlamadas();
                    al.Asi_Id     = Convert.ToInt32(dr["Asi_Id"]);
                    r.assllamadas = al;
                    entAccionComercial ac = new entAccionComercial();
                    ac.Acc_Nombre = dr["Acc_Nombre"].ToString();
                    entProducto p = new entProducto();
                    p.Pro_Nombre      = dr["Pro_Nombre"].ToString();
                    r.accioncomercial = ac;
                    r.producto        = p;
                    Lista.Add(r);
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally { cmd.Connection.Close(); }
            return(Lista);
        }
Esempio n. 3
0
        public ActionResult RegistroLlamada(Int32 AsiLlaId, String mensaje, Int16?identificador, Int32?rllid)
        {
            try
            {
                ViewBag.mensaje       = mensaje;
                ViewBag.identificador = identificador;
                if (rllid == null)
                {
                    ViewBag.CliTelef = 0;
                }
                else
                {
                    ViewBag.CliTelef = rllid;
                }
                entUsuario u = (entUsuario)Session["usuario"];
                if (u != null)
                {
                    //para capturar el usuario en sesion////////////
                    entUsuario user   = (entUsuario)Session["usuario"];
                    Int32      idUser = user.Usu_Id;
                    ////////////////////////////////////////////////////////
                    entAsigncionLlamadas asilla = negAsigncionLlamadas.Instancia.BuscaAsiLla(idUser, AsiLlaId);
                    ViewBag.AsiLla = asilla;

                    List <entTipDoc> lsTd = negTipDoc.Instancia.ListaTipDoc();
                    //var lsTipDoc = new SelectList(lsTd, "td_id", "td_nombre");
                    ViewBag.ListaTipDoc = lsTd;

                    List <entSegmento> lsSeg = negSegmento.Instancia.ListaSegmento();
                    //var lsTipDoc = new SelectList(lsTd, "td_id", "td_nombre");
                    ViewBag.ListaSegmento = lsSeg;

                    return(View());
                }
                else
                {
                    return(RedirectToAction("Index", "Inicio"));
                }
            }
            catch (ApplicationException x)
            {
                ViewBag.mensaje = x.Message;
                return(RedirectToAction("ListaClientesAsignados", "AsesorVentasCall", new { mensaje = x.Message, identificador = 1 }));
            }
            catch (Exception e)
            {
                return(RedirectToAction("ListaClientesAsignados", "AsesorVentasCall", new { mensaje = e.Message, identificador = 2 }));
            }
        }
Esempio n. 4
0
 public entAsigncionLlamadas BuscaAsiLla(Int32 UsuarioId, Int32 AsiLlaId)
 {
     try
     {
         entAsigncionLlamadas al = datAsigncionLlamadas.Instancia.BuscaAsiLla(UsuarioId, AsiLlaId);
         if (al == null)
         {
             throw new ApplicationException("Problemas");
         }
         return(al);
     }
     catch (ApplicationException ae)
     {
         throw ae;
     }
     catch (Exception e)
     {
         throw e;
     }
 }
        public entAsigncionLlamadas BuscaAsiLla(Int32 UsuarioId, Int32 AsiLlaId)
        {
            SqlCommand           cmd = null;
            SqlDataReader        dr  = null;
            entAsigncionLlamadas al  = null;

            try
            {
                SqlConnection cn = Conexion.Instancia.Conectar();
                cmd = new SqlCommand("spBuscaAsiLla", cn);
                cmd.Parameters.AddWithValue("@prmtIntIdAsiUsu", UsuarioId);
                cmd.Parameters.AddWithValue("@prmtIntIdAsiLla", AsiLlaId);
                cmd.CommandType = CommandType.StoredProcedure;
                cn.Open();
                dr = cmd.ExecuteReader();

                if (dr.Read())
                {
                    entSegmento s = new entSegmento();
                    s.Seg_Nombre = dr["Seg_Nombre"].ToString();

                    entTipDoc td = new entTipDoc();
                    td.td_nombre = dr["td_nombre"].ToString();

                    entCliente c = new entCliente();
                    c.Cli_Id               = Convert.ToInt32(dr["Cli_Id"]);
                    c.Cli_Nombre           = dr["Cli_Nombre"].ToString();
                    c.Cli_Numero_Documento = dr["Cli_Numero_Documento"].ToString();
                    c.Cli_RazonSocial      = dr["Cli_RazonSocial"].ToString();
                    c.TipDoc               = td;
                    c.Segmento             = s;

                    entTelefono t = new entTelefono();
                    t.Tel_Id        = Convert.ToInt32(dr["Tel_Id"]);
                    t.Tel_Numero    = dr["Tel_Numero"].ToString();
                    t.Tel_Producto  = dr["Tel_Producto"].ToString();
                    t.Tel_Direccion = dr["Tel_Direccion"].ToString();
                    t.Tel_FechaAlta = Convert.ToDateTime(dr["Tel_FechaAlta"]);
                    t.Tel_F1        = Convert.ToDouble(dr["Tel_F1"]);
                    t.Tel_F2        = Convert.ToDouble(dr["Tel_F2"]);
                    t.Tel_F3        = Convert.ToDouble(dr["Tel_F3"]);

                    entUsuario u = new entUsuario();
                    u.Usu_Id = Convert.ToInt32(dr["Asi_Usu_Id"]);

                    entCliente_Telefono ct = new entCliente_Telefono();
                    ct.CliTel_Id = Convert.ToInt32(dr["CliTel_Id"]);
                    ct.Cliente   = c;
                    ct.Telefono  = t;

                    al                 = new entAsigncionLlamadas();
                    al.Asi_Id          = Convert.ToInt32(dr["Asi_Id"]);
                    al.Usuario         = u;
                    al.ClienteTelefono = ct;
                }
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                cmd.Connection.Close();
            }
            return(al);
        }
Esempio n. 6
0
        public ActionResult AsignaClienteUsuario(entCliente_TelefonoView model, FormCollection form)
        {
            try
            {
                entUsuario us = (entUsuario)Session["usuario"];
                if (us != null)
                {
                    List <entCliente_Telefono> Lista = model.Cliente_Telefono;
                    Int32 cantselect = 0;
                    foreach (entCliente_Telefono item in Lista)
                    {
                        if (item.IsSelected == true)
                        {
                            cantselect++;
                        }
                    }
                    if (cantselect != 0)
                    {
                        //para capturar el usuario en sesion////////////
                        entUsuario user         = (entUsuario)Session["usuario"];
                        String     userRegistro = user.Persona.NombreCompleto;
                        ///////////////////////////////////////////
                        Int32      idAsesor = Convert.ToInt32(form["txt_aseven"]);
                        entUsuario cu       = new entUsuario();
                        cu.Usu_Id = idAsesor;
                        List <entAsigncionLlamadas> lsAsiLlaCli = new List <entAsigncionLlamadas>();
                        foreach (entCliente_Telefono item in Lista)
                        {
                            if (item.IsSelected == true)
                            {
                                entAsigncionLlamadas asi = new entAsigncionLlamadas();
                                entCliente_Telefono  ct  = new entCliente_Telefono();
                                ct.CliTel_Id        = item.CliTel_Id;
                                asi.ClienteTelefono = ct;
                                entUsuario u = new entUsuario();
                                u.Usu_Id                = idAsesor;
                                asi.Usuario             = u;
                                asi.Asi_UsuarioRegistro = userRegistro;
                                lsAsiLlaCli.Add(asi);
                            }
                        }
                        cu.lsAsiLla = lsAsiLlaCli;

                        int i = negUsuario.Instancia.InsUpdDelBloActAsignacionUsuario(cu, 1);
                        if (i > 0)
                        {
                            return(RedirectToAction("InsertarDataCliente", "AdministradorData", new { mensaje = "Se Asigno Data Satisfactoriamente", identificador = 3 }));
                        }
                        else
                        {
                            return(RedirectToAction("InsertarDataCliente", "AdministradorData", new { mensaje = "Problemas al Insertar", identificador = 2 }));
                        }
                    }
                    else
                    {
                        return(RedirectToAction("InsertarDataCliente", "AdministradorData", new { mensaje = "Debe Seleccionar por lo menos un Cliente", identificador = 2 }));
                    }
                }
                else
                {
                    return(RedirectToAction("InsertarDataCliente", "AdministradorData", new { mensaje = "Problemas al Insertar", identificador = 2 }));
                }
            }
            catch (ApplicationException x)
            {
                ViewBag.mensaje = x.Message;
                return(RedirectToAction("InsertarDataCliente", "AdministradorData", new { mensaje = x.Message, identificador = 1 }));
            }
            catch (Exception e)
            {
                return(RedirectToAction("InsertarDataCliente", "AdministradorData", new { mensaje = e.Message, identificador = 2 }));
            }


            //return View(model);
        }
Esempio n. 7
0
        public ActionResult RegistroLlamada(FormCollection form)
        {
            Int32 AsiUsu = Convert.ToInt32(form["txtAsiU"]);

            try
            {
                // registrando agendamiento o rechazo
                int accion      = Convert.ToInt32(form["resultado"]);
                int tipoedicion = 0;
                if (accion != 1)
                {
                    String acc = "";
                    if (accion == 2)
                    {
                        acc = "Rechazo";
                    }
                    else
                    {
                        acc = "Pendiente";
                    }
                    entRegLamadas rll = new entRegLamadas();
                    rll.rll_id            = Convert.ToInt32(form["txtIdRegLlam"]);
                    rll.rll_resultado     = acc;
                    rll.rll_observaciones = form["Desc"];
                    entAsigncionLlamadas all = new entAsigncionLlamadas();
                    all.Asi_Id      = AsiUsu;
                    rll.assllamadas = all;
                    entCliente_Telefono ct = new entCliente_Telefono();
                    ct.CliTel_Id      = Convert.ToInt32(form["txtCli_telf_id"]);
                    rll.cliente_telef = ct;
                    entUsuario u = new entUsuario();
                    if (Session["usuario"] != null)
                    {
                        u = (entUsuario)Session["usuario"];
                    }
                    rll.usuario = u;
                    entAccionComercial ac = new entAccionComercial();
                    ac.Acc_Id           = Convert.ToInt32(form["idAccCom"]);
                    rll.accioncomercial = ac;
                    entProducto p = new entProducto();
                    p.Pro_ID     = Convert.ToInt32(form["Prod"]);
                    rll.producto = p;
                    if (rll.rll_id == 0)
                    {
                        tipoedicion = 1;
                    }
                    else
                    {
                        tipoedicion = 2;
                    }
                    int i = negPedido.Instancia.RegUpdaLlamadas(rll, tipoedicion);
                    return(RedirectToAction("RegistroLlamada", "AsesorVentasCall", new { mensaje = "Se Inserto Satisfactoriamente", identificador = 3, AsiLlaId = AsiUsu }));
                }
                else
                {
                    // borra registro de llamada agendada de bd y pasa a ser un pedido
                    if (form["txtIdRegLlam"].ToString() != "0")
                    {
                        entRegLamadas rll = new entRegLamadas();
                        rll.rll_id = Convert.ToInt32(form["txtIdRegLlam"]);
                        int i = negPedido.Instancia.EliminaRegLlamAgend(rll.rll_id);
                    }

                    entUsuario us = (entUsuario)Session["usuario"];
                    if (us != null)
                    {
                        entSegmento s = new entSegmento();
                        s.Seg_Id = Convert.ToInt32(form["txt_Seg"]);

                        entTipDoc td = new entTipDoc();
                        td.td_id = Convert.ToInt32(form["txt_TipDoc"]);

                        //para capturar el usuario en sesion////////////
                        entUsuario user         = (entUsuario)Session["usuario"];
                        String     userRegistro = user.Persona.NombreCompleto;
                        ///////////////////////////////////////////

                        entCliente c = new entCliente();
                        c.Cli_Id   = Convert.ToInt32(form["txtIdC"]);
                        c.Segmento = s;
                        c.TipDoc   = td;
                        if (s.Seg_Id == 1)
                        {
                            c.Cli_Nombre      = form["txt_NomCli"].ToString();
                            c.Cli_RazonSocial = "";
                        }
                        else
                        {
                            c.Cli_Nombre      = "";
                            c.Cli_RazonSocial = form["txt_NomCli"].ToString();
                        }
                        c.Cli_FechaNacimiento     = Convert.ToDateTime(form["txtFecNac"]);
                        c.Cli_LugarNacimiento     = form["txt_LugNac"].ToString();
                        c.Cli_Numero_Documento    = form["txt_NumDocumento"].ToString();
                        c.Cli_Telefono_Referencia = form["txt_TelRef"].ToString();
                        c.Cli_Correo          = form["txt_Cor"].ToString();
                        c.Cli_UsuarioRegistro = userRegistro;


                        entTelefono t = new entTelefono();
                        t.Tel_Numero    = form["txt_Telefono"].ToString();
                        t.Tel_Direccion = form["txt_Direccion"].ToString();


                        entCliente_Telefono ct = new entCliente_Telefono();
                        ct.Cliente  = c;
                        ct.Telefono = t;
                        ct.AsiUsu   = AsiUsu;
                        ct.CliTel_UsuarioRegistro = userRegistro;

                        entPedido p = new entPedido();
                        p.Ped_Cod_Experto     = form["txt_CodExperto"].ToString();
                        p.Ped_Dir_Inst        = form["txt_Direccion"].ToString();
                        p.Ped_Observaciones   = form["txtobserva"].ToString();
                        p.Ped_UsuarioRegistro = userRegistro;

                        entUsuario ur = new entUsuario();
                        ur.Usu_Id = user.Usu_Id;

                        entAccionComercial ac = new entAccionComercial();
                        ac.Acc_Id = Convert.ToInt32(form["idAccCom"]);

                        entProducto pro = new entProducto();
                        pro.Pro_ID = Convert.ToInt32(form["Prod"]);

                        entDepartamento d = new entDepartamento();
                        d.idDepa = Convert.ToInt32(form["depto"]);

                        entProvincia prov = new entProvincia();
                        prov.idProv = Convert.ToInt32(form["provin"]);

                        entDistrito dis = new entDistrito();
                        dis.idDist = Convert.ToInt32(form["distrit"]);

                        p.Distrito        = dis;
                        p.Provincia       = prov;
                        p.Departamento    = d;
                        p.Producto        = pro;
                        p.AccionComercial = ac;
                        p.Usuario         = ur;
                        p.ClienteTelefono = ct;



                        int i = negPedido.Instancia.InsUpdPedido(p, 1);
                        if (i > 0)
                        {
                            return(RedirectToAction("RegistroLlamada", "AsesorVentasCall", new { mensaje = "Se Inserto Satisfactoriamente", identificador = 3, AsiLlaId = AsiUsu }));
                        }
                        else
                        {
                            return(RedirectToAction("RegistroLlamada", "AsesorVentasCall", new { mensaje = "Problemas al Insertar", identificador = 2, AsiLlaId = AsiUsu }));
                        }
                    }
                    else
                    {
                        return(RedirectToAction("Index", "Inicio"));
                    }
                }
            }
            catch (ApplicationException x)
            {
                ViewBag.mensaje = x.Message;
                return(RedirectToAction("RegistroLlamada", "AsesorVentasCall", new { mensaje = x.Message, identificador = 1, AsiLlaId = AsiUsu }));
            }
            catch (Exception e)
            {
                return(RedirectToAction("RegistroLlamada", "AsesorVentasCall", new { mensaje = e.Message, identificador = 2, AsiLlaId = AsiUsu }));
            }
        }