public HttpResponseMessage Post(Asuntos_Asistencia_Telefonica varAsuntos_Asistencia_Telefonica)
        {
            if (ModelState.IsValid)
            {
                var data = "-1";
                try
                {
                    data = Convert.ToString(this.service.Insert(varAsuntos_Asistencia_Telefonica));
                    var bitacora = BitacoraHelper.GetBitacora(Request, object_id, Convert.ToInt32(data), BitacoraHelper.TypeSql.INSERT, "sp_InsAsuntos_Asistencia_Telefonica", new JavaScriptSerializer().Serialize(varAsuntos_Asistencia_Telefonica), true);
                    serviceBitacora.Insert(bitacora);
                }
                catch (ServiceException ex)
                {
                    var bitacora = BitacoraHelper.GetBitacora(Request, object_id, 0, BitacoraHelper.TypeSql.INSERT, "sp_InsAsuntos_Asistencia_Telefonica", new JavaScriptSerializer().Serialize(varAsuntos_Asistencia_Telefonica), true);
                    serviceBitacora.Insert(bitacora);
                    return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message));
                }

                return(Request.CreateResponse(HttpStatusCode.OK, data, Configuration.Formatters.JsonFormatter));
            }
            else
            {
                var errors   = ModelState.SelectMany(m => m.Value.Errors.Select(err => err.ErrorMessage != string.Empty ? err.ErrorMessage : err.Exception.Message).ToList()).ToList();
                var bitacora = BitacoraHelper.GetBitacora(Request, object_id, 0, BitacoraHelper.TypeSql.INSERT, "sp_InsAsuntos_Asistencia_Telefonica", new JavaScriptSerializer().Serialize(varAsuntos_Asistencia_Telefonica), false, errors.ToString());
                serviceBitacora.Insert(bitacora);
                return(Request.CreateResponse(HttpStatusCode.BadRequest, errors));
            }
        }
        public HttpResponseMessage Delete(int id)
        {
            Asuntos_Asistencia_Telefonica varAsuntos_Asistencia_Telefonica = this.service.GetByKey(id, false);
            bool result = false;

            if (varAsuntos_Asistencia_Telefonica == null)
            {
                return(Request.CreateResponse(HttpStatusCode.NotFound));
            }

            try
            {
                result = this.service.Delete(id);//, globalData, dataReference);
                var bitacora = BitacoraHelper.GetBitacora(Request, object_id, id, BitacoraHelper.TypeSql.DELETE, "sp_DelAsuntos_Asistencia_Telefonica", new JavaScriptSerializer().Serialize(varAsuntos_Asistencia_Telefonica), result);
                serviceBitacora.Insert(bitacora);
            }
            catch (ServiceException ex)
            {
                var bitacora = BitacoraHelper.GetBitacora(Request, object_id, id, BitacoraHelper.TypeSql.DELETE, "sp_DelAsuntos_Asistencia_Telefonica", new JavaScriptSerializer().Serialize(varAsuntos_Asistencia_Telefonica), result, ex.Message);
                serviceBitacora.Insert(bitacora);
                return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message));
            }

            return(Request.CreateResponse(HttpStatusCode.OK, result));
        }
        public HttpResponseMessage Get_Datos_Generales(int id)
        {
            Asuntos_Asistencia_Telefonica entity = this.service.ListaSelAll(1, 1, "Asuntos_Asistencia_Telefonica.Clave='" + id.ToString() + "'", "").Asuntos_Asistencia_Telefonicas.First();
            Asuntos_Asistencia_Telefonica result = new Asuntos_Asistencia_Telefonica();

            result.Clave       = entity.Clave;
            result.Descripcion = entity.Descripcion;

            return(Request.CreateResponse(HttpStatusCode.OK, result, Configuration.Formatters.JsonFormatter));
        }
        public HttpResponseMessage PutTunnel(Asuntos_Asistencia_Telefonica emp, string user, string password)
        {
            var client = new System.Net.WebClient();

            client.Headers = TokenManager.GetAuthenticationHeader(user, password);
            client.Headers["Content-Type"] = "application/json";
            var dataString = new JavaScriptSerializer().Serialize(emp);

            var result = client.UploadString(new Uri(baseApi + ApiControllerUrl + "/Put?Id=" + emp.Clave), "PUT"
                                             , dataString);

            return(Request.CreateResponse(HttpStatusCode.OK, result, Configuration.Formatters.JsonFormatter));
        }
        public HttpResponseMessage Put_Datos_Generales(Asuntos_Asistencia_Telefonica varAsuntos_Asistencia_Telefonica_Datos_Generales)
        {
            var data = "-1";

            try
            {
                data = Convert.ToString(this.service.Update_Datos_Generales(varAsuntos_Asistencia_Telefonica_Datos_Generales));
                var bitacora = BitacoraHelper.GetBitacora(Request, object_id, varAsuntos_Asistencia_Telefonica_Datos_Generales.Clave, BitacoraHelper.TypeSql.UPDATE, "sp_UpdAsuntos_Asistencia_Telefonica", new JavaScriptSerializer().Serialize(varAsuntos_Asistencia_Telefonica_Datos_Generales), true);
                serviceBitacora.Insert(bitacora);
            }
            catch (ServiceException ex)
            {
                var bitacora = BitacoraHelper.GetBitacora(Request, object_id, varAsuntos_Asistencia_Telefonica_Datos_Generales.Clave, BitacoraHelper.TypeSql.UPDATE, "sp_UpdAsuntos_Asistencia_Telefonica", new JavaScriptSerializer().Serialize(varAsuntos_Asistencia_Telefonica_Datos_Generales), false, ex.Message);
                serviceBitacora.Insert(bitacora);
                return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message));
            }

            return(Request.CreateResponse(HttpStatusCode.OK, data, Configuration.Formatters.JsonFormatter));
        }
        public HttpResponseMessage Asuntos_Asistencia_TelefonicaGenerateID()
        {
            Asuntos_Asistencia_Telefonica varAsuntos_Asistencia_Telefonica = new Asuntos_Asistencia_Telefonica();
            var data = "-1";

            try
            {
                data = Convert.ToString(this.service.Insert(varAsuntos_Asistencia_Telefonica));
                var bitacora = BitacoraHelper.GetBitacora(Request, object_id, Convert.ToInt32(data), BitacoraHelper.TypeSql.INSERT, "sp_Asuntos_Asistencia_TelefonicaGenerateID", new JavaScriptSerializer().Serialize(varAsuntos_Asistencia_Telefonica), true);
                serviceBitacora.Insert(bitacora);
            }
            catch (ServiceException ex)
            {
                var bitacora = BitacoraHelper.GetBitacora(Request, object_id, 0, BitacoraHelper.TypeSql.INSERT, "sp_Asuntos_Asistencia_TelefonicaGenerateID", new JavaScriptSerializer().Serialize(varAsuntos_Asistencia_Telefonica), true);
                serviceBitacora.Insert(bitacora);
                return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message));
            }

            return(Request.CreateResponse(HttpStatusCode.OK, data, Configuration.Formatters.JsonFormatter));
        }