Esempio n. 1
0
        private async Task Log(System.Web.Routing.RouteData routeData, HttpContextBase httpContext)
        {
            if (httpContext.Request.RequestType == "POST")
            {
                string userIP     = httpContext.Request.UserHostAddress;
                string userName   = httpContext.User.Identity.Name;
                string reqType    = httpContext.Request.RequestType;
                string reqData    = GetRequestData(httpContext);
                string controller = routeData.Values["controller"].ToString();
                string action     = routeData.Values["action"].ToString();

                //SAVE LOG
                try
                {
                    Inaeba_SaptraEntities db = new Inaeba_SaptraEntities();
                    db.mBitacora.Add(new mBitacora()
                    {
                        ExecuteDate = DateTime.Now,
                        Ip          = userIP,
                        Username    = userName,
                        Reqtype     = reqType,
                        Reqdata     = reqData,
                        Controller  = controller,
                        Action      = action
                    });
                    await db.SaveChangesAsync();

                    db.Dispose();
                }
                catch { }
            }
        }
        //[HttpGet]
        //public ActionResult SeleccionarManual()
        //{
        //    var objManual = new catManuales();
        //    ViewBag.Titulo = "Choose an owner´s manual";
        //    return PartialView("_SeleccionarManual", objManual);
        //}


        //[HttpGet]
        //public JsonResult CargaManuales()
        //{
        //    try
        //    {
        //        var lstManuales = new List<catManuales>();

        //        var result = (from man in db.catManuales
        //                      select man).OrderBy(b => b.orden).ToList();

        //        lstManuales = result;
        //        return Json(new { Success = true, data = result }, JsonRequestBehavior.AllowGet);
        //    }
        //    catch (Exception exp)
        //    {
        //        return (Json(new { Success = false, Message = exp.Message }, JsonRequestBehavior.AllowGet));
        //    }
        //}

        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                db.Dispose();
            }
            base.Dispose(disposing);
        }