public ActionResult Edit(DatosLlamadaEntity objDatosLlamada)
        {
            if (ModelState.IsValid)
            {
                objDatosLlamada.BaseRemoteIp = RemoteIp;
                objDatosLlamada.BaseIdUser   = LoggedUserName;
                int result = proxy.UpdateDatosLlamada(objDatosLlamada);
                if (result == -1)
                {
                    DatosLlamadaEntity objDatosLlamadaOld = proxy.GetDatosLlamada(objDatosLlamada.Id);

                    AssingMessageScript("El DatosLlamada ya existe en el sistema, .", "error", "Error", true);
                    CheckNotify();
                    return(View(objDatosLlamada));
                }
                if (result > 0)
                {
                    AssingMessageScript("El DatosLlamada se modifico en el sistema.", "success", "Éxito", true);
                    CheckNotify();
                    return(RedirectToAction("Index"));
                }
                return(RedirectToAction("Index"));
            }
            return(View(objDatosLlamada));
        }
Beispiel #2
0
        /// <summary>
        /// Converts data from reader to entity
        /// </summary>
        protected virtual DatosLlamadaEntity GetDatosLlamadaFromReader(IDataReader reader)
        {
            DatosLlamadaEntity entity_DatosLlamada = null;

            try
            {
                entity_DatosLlamada = new DatosLlamadaEntity();
                //entity_DatosLlamada.Id = (int?)(GetFromReader(reader, "Id"));
                entity_DatosLlamada.IdLlamada = (int?)(GetFromReader(reader, "IdLlamada"));
                try
                {
                    entity_DatosLlamada.Contrato = (long?)(GetFromReader(reader, "Contrato"));
                }
                catch
                {
                    entity_DatosLlamada.Contrato = 0;
                }

                entity_DatosLlamada.Fecha = (String)(GetFromReader(reader, "Fecha"));
                //entity_DatosLlamada.Nombre = (String)(GetFromReader(reader, "Nombre", IsString: true));
                entity_DatosLlamada.Usuario     = (String)(GetFromReader(reader, "Usuario", IsString: true));
                entity_DatosLlamada.TipoLlamada = (bool)(GetFromReader(reader, "TipoLlamada"));
                entity_DatosLlamada.IdConexion  = (int?)(GetFromReader(reader, "IdConexion"));
                entity_DatosLlamada.Ciudad      = (String)(GetFromReader(reader, "Ciudad", IsString: true));
            }
            catch (Exception ex)
            {
                throw new Exception("Error converting DatosLlamada data to entity", ex);
            }
            return(entity_DatosLlamada);
        }
        public ActionResult QuickIndex(int?page, int?pageSize, int?IdLlamada, int?Contrato, DateTime?Fecha, String Nombre, String Usuario)
        {
            int pageNumber = (page ?? 1);
            int pSize      = pageSize ?? SoftvMVC.Properties.Settings.Default.pagnum;
            SoftvList <DatosLlamadaEntity> listResult         = null;
            List <DatosLlamadaEntity>      listDatosLlamada   = new List <DatosLlamadaEntity>();
            DatosLlamadaEntity             objDatosLlamada    = new DatosLlamadaEntity();
            DatosLlamadaEntity             objGetDatosLlamada = new DatosLlamadaEntity();


            if ((IdLlamada != null))
            {
                objDatosLlamada.IdLlamada = IdLlamada;
            }

            if ((Contrato != null))
            {
                objDatosLlamada.Contrato = Contrato;
            }

            if ((Fecha != null))
            {
                objDatosLlamada.Fecha = Fecha.ToString();
            }

            if ((Nombre != null && Nombre.ToString() != ""))
            {
                objDatosLlamada.Nombre = Nombre;
            }

            if ((Usuario != null && Usuario.ToString() != ""))
            {
                objDatosLlamada.Usuario = Usuario;
            }

            pageNumber = pageNumber == 0 ? 1 : pageNumber;
            listResult = proxy.GetDatosLlamadaPagedListXml(pageNumber, pSize, Globals.SerializeTool.Serialize(objDatosLlamada));
            if (listResult.Count == 0)
            {
                int tempPageNumber = (int)(listResult.totalCount / pSize);
                pageNumber = (int)(listResult.totalCount / pSize) == 0 ? 1 : tempPageNumber;
                listResult = proxy.GetDatosLlamadaPagedListXml(pageNumber, pSize, Globals.SerializeTool.Serialize(objDatosLlamada));
            }
            listResult.ToList().ForEach(x => listDatosLlamada.Add(x));

            var DatosLlamadaAsIPagedList = new StaticPagedList <DatosLlamadaEntity>(listDatosLlamada, pageNumber, pSize, listResult.totalCount);

            if (DatosLlamadaAsIPagedList.Count > 0)
            {
                return(PartialView(DatosLlamadaAsIPagedList));
            }
            else
            {
                var result = new { tipomsj = "warning", titulomsj = "Aviso", Success = "False", Message = "No se encontraron registros con los criterios de búsqueda ingresados." };
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
        }
        public ActionResult Details(int id = 0)
        {
            DatosLlamadaEntity objDatosLlamada = proxy.GetDatosLlamada(id);

            if (objDatosLlamada == null)
            {
                return(HttpNotFound());
            }
            return(PartialView(objDatosLlamada));
        }
        public ActionResult Edit(int id = 0)
        {
            PermisosAccesoDeniedEdit("DatosLlamada");
            ViewBag.CustomScriptsPageValid = BuildScriptPageValid();
            DatosLlamadaEntity objDatosLlamada = proxy.GetDatosLlamada(id);

            if (objDatosLlamada == null)
            {
                return(HttpNotFound());
            }
            return(View(objDatosLlamada));
        }
Beispiel #6
0
        /// <summary>
        /// Edits a DatosLlamada
        ///</summary>
        /// <param name="DatosLlamada"> Objeto DatosLlamada a editar </param>
        public override int EditDatosLlamada(DatosLlamadaEntity entity_DatosLlamada)
        {
            int result = 0;

            using (SqlConnection connection = new SqlConnection(SoftvSettings.Settings.DatosLlamada.ConnectionString))
            {
                SqlCommand comandoSql = CreateCommand("Softv_DatosLlamadaEdit", connection);

                AssingParameter(comandoSql, "@Id", entity_DatosLlamada.Id);

                AssingParameter(comandoSql, "@IdLlamada", entity_DatosLlamada.IdLlamada);

                AssingParameter(comandoSql, "@Contrato", entity_DatosLlamada.Contrato);

                AssingParameter(comandoSql, "@Fecha", entity_DatosLlamada.Fecha);

                AssingParameter(comandoSql, "@Nombre", entity_DatosLlamada.Nombre);

                AssingParameter(comandoSql, "@Usuario", entity_DatosLlamada.Usuario);

                try
                {
                    if (connection.State == ConnectionState.Closed)
                    {
                        connection.Open();
                    }

                    result = int.Parse(ExecuteNonQuery(comandoSql).ToString());
                }
                catch (Exception ex)
                {
                    throw new Exception("Error updating DatosLlamada " + ex.Message, ex);
                }
                finally
                {
                    if (connection != null)
                    {
                        connection.Close();
                    }
                }
            }
            return(result);
        }
Beispiel #7
0
        /// <summary>
        /// Gets DatosLlamada by
        ///</summary>
        public override DatosLlamadaEntity GetDatosLlamadaById(int?Id)
        {
            using (SqlConnection connection = new SqlConnection(SoftvSettings.Settings.DatosLlamada.ConnectionString))
            {
                SqlCommand         comandoSql          = CreateCommand("Softv_DatosLlamadaGetById", connection);
                DatosLlamadaEntity entity_DatosLlamada = null;


                AssingParameter(comandoSql, "@Id", Id);

                IDataReader rd = null;
                try
                {
                    if (connection.State == ConnectionState.Closed)
                    {
                        connection.Open();
                    }
                    rd = ExecuteReader(comandoSql, CommandBehavior.SingleRow);
                    if (rd.Read())
                    {
                        entity_DatosLlamada = GetDatosLlamadaFromReader(rd);
                    }
                }
                catch (Exception ex)
                {
                    throw new Exception("Error getting data DatosLlamada " + ex.Message, ex);
                }
                finally
                {
                    if (connection != null)
                    {
                        connection.Close();
                    }
                    if (rd != null)
                    {
                        rd.Close();
                    }
                }
                return(entity_DatosLlamada);
            }
        }
 public ActionResult Create(DatosLlamadaEntity objDatosLlamada)
 {
     if (ModelState.IsValid)
     {
         objDatosLlamada.BaseRemoteIp = RemoteIp;
         objDatosLlamada.BaseIdUser   = LoggedUserName;
         int result = proxy.AddDatosLlamada(objDatosLlamada);
         if (result == -1)
         {
             AssingMessageScript("El DatosLlamada ya existe en el sistema.", "error", "Error", true);
             CheckNotify();
             return(View(objDatosLlamada));
         }
         if (result > 0)
         {
             AssingMessageScript("Se dio de alta el DatosLlamada en el sistema.", "success", "Éxito", true);
             return(RedirectToAction("Index"));
         }
     }
     return(View(objDatosLlamada));
 }
Beispiel #9
0
        /// <summary>
        ///</summary>
        /// <param name="DatosLlamada"> Object DatosLlamada added to List</param>
        public override int AddDatosLlamada(DatosLlamadaEntity entity_DatosLlamada)
        {
            int result = 0;

            using (SqlConnection connection = new SqlConnection(SoftvSettings.Settings.DatosLlamada.ConnectionString))
            {
                SqlCommand comandoSql = CreateCommand("Softv_DatosLlamadaAdd", connection);

                AssingParameter(comandoSql, "@Id", null, pd: ParameterDirection.Output, IsKey: true);

                AssingParameter(comandoSql, "@IdLlamada", entity_DatosLlamada.IdLlamada);

                AssingParameter(comandoSql, "@Contrato", entity_DatosLlamada.Contrato);

                AssingParameter(comandoSql, "@Fecha", entity_DatosLlamada.Fecha);

                AssingParameter(comandoSql, "@Nombre", entity_DatosLlamada.Nombre);

                AssingParameter(comandoSql, "@Usuario", entity_DatosLlamada.Usuario);

                try
                {
                    if (connection.State == ConnectionState.Closed)
                    {
                        connection.Open();
                    }
                    result = ExecuteNonQuery(comandoSql);
                }
                catch (Exception ex)
                {
                    throw new Exception("Error adding DatosLlamada " + ex.Message, ex);
                }
                finally
                {
                    connection.Close();
                }
                result = (int)comandoSql.Parameters["@IdDatosLlamada"].Value;
            }
            return(result);
        }
        public ActionResult GetList(int idplaza, int?contrato, string cadena, int?id_llamada, bool?tipo_llamada, int draw, int start, int length, string ciudad)
        {
            DataTableData dataTableData = new DataTableData();

            dataTableData.draw         = draw;
            dataTableData.recordsTotal = 0;
            int recordFiltered = 0;

            List <conexionPlazaCliente> llamadaCliente = new List <conexionPlazaCliente>();
            List <DatosLlamadaEntity>   llamada        = proxy.GetDatosLlamadaList().Where(o => o.Ciudad == ciudad).ToList();
            List <DatosLlamadaEntity>   lista          = new List <DatosLlamadaEntity>();

            ConexionController c = new ConexionController();
            SqlCommand         comandoSql;
            SqlConnection      conexionSQL = new SqlConnection(c.DameConexion(idplaza));

            try
            {
                conexionSQL.Open();
            }
            catch
            { }
            try
            {
                foreach (var item in llamada)
                {
                    DatosLlamadaEntity llamadas = new DatosLlamadaEntity();
                    if (item.Contrato > 0)
                    {
                        if (item.IdConexion == idplaza)
                        {
                            comandoSql            = new SqlCommand("SELECT * FROM CLIENTES WHERE CONTRATO =" + item.Contrato);
                            comandoSql.Connection = conexionSQL;
                            SqlDataReader reader = comandoSql.ExecuteReader();
                            if (reader.HasRows)
                            {
                                while (reader.Read())
                                {
                                    llamadas.IdLlamada   = item.IdLlamada;
                                    llamadas.Nombre      = reader[1].ToString();
                                    llamadas.Contrato    = item.Contrato;
                                    llamadas.IdConexion  = item.IdConexion;
                                    llamadas.Fecha       = item.Fecha;
                                    llamadas.TipoLlamada = item.TipoLlamada;
                                    llamadas.Usuario     = item.Usuario;
                                    lista.Add(llamadas);
                                }
                            }
                            reader.Close();
                        }
                    }
                    else
                    {
                        List <NoClienteEntity> nocliente = proxyNoCliente.GetNoClienteList();
                        if (item.IdConexion == idplaza)
                        {
                            foreach (var item2 in nocliente)
                            {
                                if (item.IdLlamada == item2.IdLlamada)
                                {
                                    llamadas.IdLlamada   = item.IdLlamada;
                                    llamadas.Nombre      = item2.Nombre;
                                    llamadas.Contrato    = item.Contrato;
                                    llamadas.Fecha       = item.Fecha;
                                    llamadas.IdConexion  = item.IdConexion;
                                    llamadas.TipoLlamada = item.TipoLlamada;
                                    llamadas.Usuario     = item.Usuario;
                                    lista.Add(llamadas);
                                }
                            }
                        }
                    }
                }
            }
            catch { }
            recordFiltered = lista.Count;

            int aux      = 0;
            int paginado = 0;

            if (cadena != "")
            {
                dataTableData.data = lista.Where(o => o.Nombre.ToLower().Contains(cadena.ToLower())).OrderByDescending(o => o.IdLlamada).ToList();
                paginado           = dataTableData.data.Count;
                dataTableData.data = lista.Where(o => o.Nombre.ToLower().Contains(cadena.ToLower())).OrderByDescending(o => o.IdLlamada).Skip(start).Take(length).ToList();
            }
            else if (contrato > 0)
            {
                dataTableData.data = lista.Where(o => o.Contrato == contrato).ToList();
                paginado           = dataTableData.data.Count;
                dataTableData.data = lista.Where(o => o.Contrato == contrato).Skip(start).Take(length).ToList();
            }
            else if (tipo_llamada == true)
            {
                dataTableData.data = lista.Where(o => o.Contrato != null).OrderByDescending(o => o.IdLlamada).ToList();
                paginado           = dataTableData.data.Count;
                dataTableData.data = lista.Where(o => o.Contrato != null).OrderByDescending(o => o.IdLlamada).Skip(start).Take(length).ToList();
            }
            else if (tipo_llamada == false)
            {
                dataTableData.data = lista.Where(o => o.Contrato == null && o.IdConexion == idplaza).OrderByDescending(o => o.IdLlamada).ToList();
                paginado           = dataTableData.data.Count;
                dataTableData.data = lista.Where(o => o.Contrato == null && o.IdConexion == idplaza).OrderByDescending(o => o.IdLlamada).Skip(start).Take(length).ToList();
            }
            else if (id_llamada > 0)
            {
                dataTableData.data = lista.Where(o => o.IdLlamada == id_llamada).ToList();
                paginado           = dataTableData.data.Count;
                dataTableData.data = lista.Where(o => o.IdLlamada == id_llamada).Skip(start).Take(length).ToList();
            }
            else if (tipo_llamada.ToString() == "")
            {
                dataTableData.data = lista.OrderByDescending(o => o.IdLlamada).Skip(start).Take(length).ToList();
                aux = 1;
            }
            if (aux == 1)
            {
                recordFiltered = lista.Count;
            }
            else
            {
                recordFiltered = paginado;
            }

            dataTableData.recordsFiltered = recordFiltered;

            return(Json(dataTableData, JsonRequestBehavior.AllowGet));
        }
Beispiel #11
0
        public static DatosLlamadaEntity GetOne(int? Id)
        {
            DatosLlamadaEntity result = ProviderSoftv.DatosLlamada.GetDatosLlamadaById(Id);

            return(result);
        }
Beispiel #12
0
        public static int Edit(DatosLlamadaEntity objDatosLlamada)
        {
            int result = ProviderSoftv.DatosLlamada.EditDatosLlamada(objDatosLlamada);

            return(result);
        }
Beispiel #13
0
 /// <summary>
 /// Abstract method to update DatosLlamada
 /// </summary>
 public abstract int EditDatosLlamada(DatosLlamadaEntity entity_DatosLlamada);
Beispiel #14
0
 /// <summary>
 /// Abstract method to add DatosLlamada
 ///  /summary>
 /// <param name="DatosLlamada"></param>
 /// <returns></returns>
 public abstract int AddDatosLlamada(DatosLlamadaEntity entity_DatosLlamada);