Example #1
0
 public void MakeLogEntry(int type_id, object old_value, object new_value, string action)
 {
     try
     {
         Models.Log _log = new Models.Log();
         _log.UserId     = CurrentUser.Id;
         _log.LogTypeId  = type_id;
         _log.AddingDate = (Int32)(DateTime.Now.Subtract(new DateTime(1970, 1, 1))).TotalSeconds;
         if (old_value != null)
         {
             _log.OldValue = Newtonsoft.Json.JsonConvert.SerializeObject(old_value);
         }
         if (new_value != null)
         {
             _log.NewValue = Newtonsoft.Json.JsonConvert.SerializeObject(new_value);
         }
         if (!String.IsNullOrEmpty(action))
         {
             _log.Action = action;
         }
         AddEntry <Models.Log>(_log);
     }
     catch (Exception e)
     {
         MessageBox.Show(e.Message);
     }
 }
Example #2
0
        public async Task <bool> IsAllowed(Models.User user, Models.Log log)
        {
            if (user == null)
            {
                return(false);
            }
            if (log == null)
            {
                return(false);
            }
            int Month = (log.Start.Year * 12) + log.Start.Month;

            try
            {
                Models.WorkMonth workMonth = await TimeSheetContext.WorkMonth.Where(x => x.Month == Month && x.UserId == user.Id).SingleOrDefaultAsync();

                if (workMonth == null)
                {
                    return(false);
                }
                return(workMonth.Accepted);
            }
            catch (Exception e)
            {
                return(false);
            }
        }
Example #3
0
        private IList <Models.Log> GenerateLogs(string logsCdn)
        {
            IList <Models.Log> logs = new List <Models.Log>();

            string[] logsCdnArray = logsCdn.Split(Environment.NewLine);
            for (int i = 0; i < logsCdnArray.Length - 1; i++)
            {
                string   logCdn    = logsCdnArray[i];
                string[] logFields = logCdn.Split("|");

                string provider     = "MINHA CDN";
                int    status       = int.Parse(logFields[1]);
                int    timeTaken    = (int)Math.Round(double.Parse(logFields[4], CultureInfo.InvariantCulture));
                int    responseSize = int.Parse(logFields[0]);
                string cacheStatus  = logFields[2];

                string[] logHttpFields = logFields[3].Split(" ");
                string   httpMethod    = logHttpFields[0].Replace("\"", "");
                string   uriPath       = logHttpFields[1];

                Models.Log log = new Models.Log(provider, httpMethod, status, uriPath, timeTaken, responseSize, cacheStatus);
                logs.Add(log);
            }

            return(logs);
        }
        public string CheckBack()
        {
            try
            {
                var infoList =
                    JsonConvert.DeserializeObject <Dictionary <String, Object> >(HttpUtility.UrlDecode(Request.Form.ToString()));

                int.TryParse(infoList["feedBackID"].ToString(), out var feedBackID);
                var backReason = infoList["backReason"].ToString();

                var person = App_Code.Commen.GetUserFromSession();
                var info   = db.MaterialQualityFeedback.Find(feedBackID);
                info.FeedBackState = "审核回退";
                //info.CheckDateTime = DateTime.Now;
                //info.CheckPersonID = person.UserID;
                //info.CheckPersonName = person.UserName;

                var log = new Models.Log();
                log.InputDateTime   = DateTime.Now;
                log.InputPersonID   = person.UserID;
                log.InputPersonName = person.UserName;
                log.LogType         = "物资质量反馈";
                log.LogContent      = "领导审核回退";
                log.LogReason       = backReason;
                log.LogDataID       = info.ID;
                db.Log.Add(log);

                db.SaveChanges();
                return("ok");
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
        }
Example #5
0
 public async Task <ActionResult <Dto.Log> > Get([FromQuery] string Id)
 {
     Models.Log log = null;
     if (User.FindFirst(ClaimTypes.Role).Value == Config.GetSection("Role:Consultant:Name").Value)
     {
         log = new Models.Log {
             Id = Id, UserId = User.FindFirst(ClaimTypes.NameIdentifier).Value
         };
         if (log == null)
         {
             return(BadRequest());
         }
         log = await Repo.Get(log);
     }
     else
     {
         log = new Models.Log {
             Id = Id
         };
         if (log == null)
         {
             return(BadRequest());
         }
         log = await Repo.GetForHr(log);
     }
     if (log == null)
     {
         return(BadRequest());
     }
     return(Ok(new Dto.Log {
         Id = log.Id, Start = log.Start, Stop = log.Stop, Description = log.Description, ActivityId = log.ActivityId, UserId = log.ActivityId, ProjectId = log.ProjectId
     }));
 }
Example #6
0
 private void button2_Click(object sender, EventArgs e)
 {
     Models.Lista_precios listas = new Models.Lista_precios();
     using (listas) {
         listas.Id_cliente  = Convert.ToInt32(txtId_cliente.Text);
         listas.Id_Producto = Id_producto;
         listas.Descuento   = Convert.ToDouble(nmDescuento.Value);
         if (Id_lista == 0)
         {
             Models.Log historial = new Models.Log();
             using (historial)
             {
                 historial.Id_usuario  = Convert.ToInt32(Inicial.id_usario);
                 historial.Descripcion = "se genero un descuento al cliente " + txtCliente.Text + " de " + nmDescuento.Value + "% al producto " + txtDescripcion.Text;
                 historial.createLog();
             }
             listas.create_lista();
         }
         else
         {
             listas.Id = Id_lista;
             listas.update_lista();
             Models.Log historial = new Models.Log();
             using (historial)
             {
                 historial.Id_usuario  = Convert.ToInt32(Inicial.id_usario);
                 historial.Descripcion = "se modifico un descuento al cliente " + txtCliente.Text + " de " + nmDescuento.Value + "% al producto " + txtDescripcion.Text;
                 historial.createLog();
             }
         }
     }
     this.Close();
 }
Example #7
0
        public async Task <bool> Create(Models.Log log)
        {
            if (!IsValidLog(log))
            {
                return(false);
            }
            int currentLogs = (DateTime.Now.Year * 12) + DateTime.Now.Month;

            if ((log.Start.Year * 12) + log.Start.Month != currentLogs || (log.Stop.Year * 12) + log.Stop.Month != currentLogs)
            {
                return(false);
            }
            Models.Project project = await TimeSheetContext.Project.Where(x => x.Id == log.ProjectId).SingleOrDefaultAsync();

            if (project == null)
            {
                return(false);
            }
            if (log.ActivityId != null || log.ActivityId != "")
            {
                Models.Activity activity = await TimeSheetContext.Activity.Where(x => x.Id == log.ActivityId).SingleOrDefaultAsync();

                if (activity != null && activity.ProjectId == log.ProjectId)
                {
                    log.Activity = activity;
                }
            }
            await TimeSheetContext.AddAsync(log);

            await TimeSheetContext.SaveChangesAsync();

            return(true);
        }
Example #8
0
        public static bool LogAction(Models.Log log)
        {
            if (log.Description.Length == 0)
            {
                log.Description = "[NO DESCRIPTION GIVEN]";
            }
            if (log.UserId <= 0)
            {
                log.Description = "[INVALID USER] " + log.Description;
            }
            if (log.ModifiedId <= 0)
            {
                log.Description = "[INVALID MODIFIED ID] " + log.Description;
            }
            if (log.Changes.Length == 0 && (log.Action == Models.Log.ActionType.ModifyInstaller || log.Action == Models.Log.ActionType.ModifyManager ||
                                            log.Action == Models.Log.ActionType.ModifySite || log.Action == Models.Log.ActionType.ModifyUser))
            {
                log.Description = "[NO CHANGES GIVEN] " + log.Description;
                log.Changes     = "[NO CHANGES GIVEN]";
            }

            using (var context = new Data.ApplicationDbContext()) {
                context.Add(log);
                context.SaveChanges();
            }
            return(true);
        }
        public string Del()
        {
            try
            {
                var infoList =
                    JsonConvert.DeserializeObject <Dictionary <String, Object> >(HttpUtility.UrlDecode(Request.Form.ToString()));
                var userID = 0;
                int.TryParse(infoList["userID"].ToString(), out userID);

                var userInfo = db.UserInfo.Find(userID);
                userInfo.UserState = 1;
                db.SaveChanges();

                db.UserRole.RemoveRange(db.UserRole.Where(w => w.UserID == userID));
                db.UserDept.RemoveRange(db.UserDept.Where(w => w.UserID == userID));
                db.SaveChanges();

                var person = App_Code.Commen.GetUserFromSession();
                var log    = new Models.Log();
                log.InputDateTime   = DateTime.Now;
                log.InputPersonID   = person.UserID;
                log.InputPersonName = person.UserName;
                log.LogType         = "用户信息管理";
                log.LogContent      = "删除用户:" + userInfo.UserName + "," + "员工编号:" + userInfo.UserNum;
                log.LogDataID       = userID;
                db.Log.Add(log);
                db.SaveChanges();
                return("ok");
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
        }
Example #10
0
        /// <summary>
        /// 写日志
        /// </summary>
        /// <param name="self">Alan.Log.Core.ILog</param>
        /// <param name="log"></param>
        public static ILog Log(this ILog self, Models.Log log)
        {
            var level = (log.Level.ToString() ?? "").ToLower();

            return(self.Log(id: log.Id, level: level, logger: log.Logger, category: log.Category, message: log.Message,
                            note: log.Note, position: log.Position, request: log.Request, response: log.Response));
        }
        public string ChangeTenderDateBack()
        {
            try
            {
                var infoList =
                    JsonConvert.DeserializeObject <Dictionary <String, Object> >(HttpUtility.UrlDecode(Request.Form.ToString()));
                var id = 0;
                int.TryParse(infoList["id"].ToString(), out id);
                var backReason = infoList["reason"].ToString();

                var info    = db.SampleDelegation.Find(id);
                var logInfo = db.Log.Where(w => w.LogDataID == id && w.LogType == "修改招标开始时间").FirstOrDefault();
                info.ChangeStartTenderDateState = null;//将修改招标开始时间状态变为null

                var log      = new Models.Log();
                var userInfo = App_Code.Commen.GetUserFromSession();
                log.InputPersonID   = userInfo.UserID;
                log.InputPersonName = userInfo.UserName;
                log.InputDateTime   = DateTime.Now;
                log.LogDataID       = id;
                log.Col4            = backReason;
                log.LogContent      = "修改开标始时间审核回退:样品名称【" + info.SampleName + "】";
                log.LogType         = "修改招标开始时间";
                db.Log.Add(log);

                db.SaveChanges();
                return("ok");
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
        }
        public string AuditLeader()
        {
            try
            {
                var infoList =
                    JsonConvert.DeserializeObject <Dictionary <String, Object> >(HttpUtility.UrlDecode(Request.Form.ToString()));
                var id = 0;
                int.TryParse(infoList["id"].ToString(), out id);
                var info = db.SampleDelegation.Find(id);

                info.SampleDelegationState = "检验报告上传";

                var log      = new Models.Log();
                var userInfo = App_Code.Commen.GetUserFromSession();
                log.InputPersonID   = userInfo.UserID;
                log.InputPersonName = userInfo.UserName;
                log.InputDateTime   = DateTime.Now;
                log.LogDataID       = id;
                log.LogContent      = "质检领导确认:样品名称【" + info.SampleName + "】";
                log.LogType         = "送样委托质检审核";
                db.Log.Add(log);

                db.SaveChanges();
                return("ok");
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
        }
Example #13
0
 public async Task <Models.Log> Get(Models.Log log)
 {
     if (log.Id == null)
     {
         return(null);
     }
     if (log.Id == "")
     {
         return(null);
     }
     if (log.UserId == null)
     {
         return(null);
     }
     if (log.UserId == "")
     {
         return(null);
     }
     try
     {
         return(await TimeSheetContext.Log.Where(x => x.Id == log.Id && x.UserId == log.UserId).SingleOrDefaultAsync());
     }
     catch (Exception e)
     {
         return(null);
     }
 }
Example #14
0
        public void AddLog(System.Type type, Models.Log log)
        {
            if (log == null)
            {
                return;
            }

            if (string.IsNullOrWhiteSpace(log.Message))
            {
                return;
            }

            // **************************************************
            System.Diagnostics.StackTrace
                stackTrace = new System.Diagnostics.StackTrace();

            System.Reflection.MethodBase
                methodBase = stackTrace.GetFrame(1).GetMethod();
            // **************************************************

            log.Message =
                $"{ type.Namespace } -> { type.Name } -> { methodBase.Name }: { log.Message.Fix() }";

            Logs.Insert(index: 0, item: log);
        }
Example #15
0
 public void Inserir(Models.Log Log)
 {
     using (MyDatabaseContext ctx = new MyDatabaseContext())
     {
         ctx.Log.Add(Log);
         ctx.SaveChanges();
     }
 }
Example #16
0
 public bool StartStopInSameMonth(Models.Log log)
 {
     if ((log.Start.Year * 12) + log.Start.Month == (log.Stop.Year * 12) + log.Stop.Month)
     {
         return(true);
     }
     return(false);
 }
Example #17
0
 public static void LogActivity(PlaylistContext context, string source, string message, Visitor visitor)
 {
     Models.Log log = new Models.Log();
     log.IdVisitorNavigation = visitor;
     log.Message             = message;
     log.Source = source;
     context.Log.Add(log);
     context.SaveChanges();
 }
        public string EditTenderStartDate(HttpPostedFileBase editTenderDateFile)
        {
            try
            {
                var user = App_Code.Commen.GetUserFromSession();
                var id   = 0;
                int.TryParse(Request.Form["EditTenderDateInfoID"], out id);
                var editTenderStartDate  = Convert.ToDateTime(Request.Form["tbxEditTenderDate"]); //要修改的招标开始时间
                var editTenderDateReason = Request.Form["tbxEditTenderDateReason"];               //修改原因
                var sampleDelegation     = db.SampleDelegation.Find(id);

                if (CheckTenderStartDateTime(sampleDelegation.StartTenderDate) == 0)
                {
                    if (sampleDelegation.ChangeStartTenderDateState == "修改中")
                    {
                        return("error");
                    }

                    //上传修改招标开始时间说明文件
                    var newName = string.Empty;
                    if (editTenderDateFile != null)
                    {
                        var fileExt = Path.GetExtension(editTenderDateFile.FileName).ToLower();
                        newName = "修改招标开始时间说明文件_" + DateTime.Now.ToString("yyMMddhhmmss") + DateTime.Now.Millisecond + fileExt;
                        var filePath = Request.MapPath("~/FileUpload");
                        var fullName = Path.Combine(filePath, newName);
                        editTenderDateFile.SaveAs(fullName);
                    }

                    var log = new Models.Log();
                    log.InputDateTime   = DateTime.Now;
                    log.InputPersonID   = user.UserID;
                    log.InputPersonName = user.UserName;
                    log.LogDataID       = id;
                    log.LogType         = "修改招标开始时间";
                    log.LogContent      = "开标时间由【" + sampleDelegation.StartTenderDate + "】修改为【" + editTenderStartDate + "】";
                    log.LogReason       = editTenderDateReason;
                    log.Col1            = newName;                                     //招标开始时间修改说明文件
                    log.Col2            = sampleDelegation.StartTenderDate.ToString(); //原招标开始时间
                    log.Col3            = editTenderStartDate.ToString();              //要修改的招标开始时间
                    db.Log.Add(log);

                    sampleDelegation.ChangeStartTenderDateState = "修改中";
                    db.SaveChanges();
                    return("ok");
                }
                else
                {
                    //如果超过开标时间,则不能删除检验报告文件
                    return("errorTime");
                }
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
        }
        public string Insert()
        {
            try
            {
                var infoList =
                    JsonConvert.DeserializeObject <Dictionary <String, Object> >(HttpUtility.UrlDecode(Request.Form.ToString()));

                var feedbackTitle   = infoList["feedbackTitle"].ToString();
                var supplierName    = infoList["supplierName"].ToString();
                var materialNum     = infoList["materialNum"].ToString();
                var erpPlanNum      = infoList["erpPlanNum"].ToString();
                var erpOrderNum     = infoList["erpOrderNum"].ToString();
                var feedbackContent = infoList["feedbackContent"].ToString();

                //判断【直接提交】或【第一次保存】,数据库状态为【待审核】、【待接收】
                var clickState = infoList["clickState"].ToString();

                var materialQualityTypeID = 0;
                int.TryParse(infoList["materialQualityTypeID"].ToString(), out materialQualityTypeID);
                var person             = App_Code.Commen.GetUserFromSession();
                var personFatherDeptID = db.DeptInfo.Where(w => w.DeptID == person.UserDeptID).Select(s => s.DeptFatherID).FirstOrDefault();

                var info = new Models.MaterialQualityFeedback();
                info.FeedbackTitle         = feedbackTitle;
                info.SupplierName          = supplierName;
                info.MaterialNum           = materialNum;
                info.ErpPlanNum            = erpPlanNum;
                info.ErpOrderNum           = erpOrderNum;
                info.MaterialQualityTypeID = materialQualityTypeID;
                info.FeedbackContent       = feedbackContent;
                info.FeedBackState         = clickState == "提交" ? "待接收" : "待提交";
                info.InputDateTime         = DateTime.Now;
                info.InputPersonID         = person.UserID;
                info.InputPersonPhone      = person.UserPhone;
                info.InputPersonMobile     = person.UserMobile;
                info.InputDeptID           = personFatherDeptID;
                info.InputPersonName       = person.UserName;
                db.MaterialQualityFeedback.Add(info);
                db.SaveChanges();

                var log = new Models.Log();
                log.InputDateTime   = DateTime.Now;
                log.InputPersonID   = person.UserID;
                log.InputPersonName = person.UserName;
                log.LogType         = "物资质量反馈";
                log.LogContent      = clickState == "提交" ? "提交质量反馈单" : "保存质量反馈单";
                log.LogDataID       = info.ID;
                db.Log.Add(log);
                db.SaveChanges();
                return("ok");
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
        }
Example #20
0
        public bool IsCurrentMonth(Models.Log log)
        {
            int currentMonth = (DateTime.Now.Year * 12) + DateTime.Now.Month;

            if (currentMonth == (log.Start.Year * 12) + log.Start.Month && currentMonth == (log.Stop.Year * 12) + log.Stop.Month)
            {
                return(true);
            }
            return(false);
        }
Example #21
0
        private void devolucion()
        {
            Models.Devolutions devolucion = new Models.Devolutions();
            Models.Log         historial  = new Models.Log();
            using (devolucion)
            {
                devolucion.Fecha    = dtFecha.Text + " 00:00:00";
                devolucion.Autorizo = id_usuario;
                devolucion.Total    = Convert.ToDouble(txtTotal.Text);
                devolucion.create();
                List <Models.Devolutions> devo = devolucion.get_lastdevocion(dtFecha.Text + " 00:00:00", id_usuario, Convert.ToDouble(txtTotal.Text));

                Models.det_devolution detalles = new Models.det_devolution();
                using (detalles)
                {
                    detalles.Id_devolucion = devo[0].Id;
                    Folio_guardado         = devo[0].Id;
                    Models.Product productos = new Models.Product();
                    foreach (DataGridViewRow row in dtProductos.Rows)
                    {
                        detalles.Cantidad    = Convert.ToDouble(row.Cells["cantidad"].Value.ToString());
                        detalles.Id_producto = Convert.ToInt16(row.Cells["id_producto"].Value.ToString());
                        detalles.Pu          = Convert.ToDouble(row.Cells["pu"].Value.ToString());
                        detalles.Almacen     = row.Cells["almacen"].Value.ToString();
                        detalles.create_det();

                        using (historial)
                        {
                            historial.Id_usuario  = Convert.ToInt32(Inicial.id_usario);
                            historial.Descripcion = "el usuairo " + id_usuario + " autorizo la devolucion de " + row.Cells["cantidad"].Value.ToString() + " " + row.Cells["descripcion"].Value.ToString();
                            historial.createLog();
                        }

                        using (productos)
                        {
                            productos.Id = Convert.ToInt16(row.Cells["id_producto"].Value.ToString());
                            List <Models.Product> produ = productos.getProductById(Convert.ToInt16(row.Cells["id_producto"].Value.ToString()));
                            if (row.Cells["almacen"].Value.ToString() == "Devolucion")
                            {
                                productos.Devoluciones = produ[0].Devoluciones + Convert.ToDouble(row.Cells["cantidad"].Value.ToString());
                                productos.update_devoluciones();
                            }
                            else
                            {
                                productos.Existencia = produ[0].Existencia + Convert.ToDouble(row.Cells["cantidad"].Value.ToString());
                                productos.update_inventary();
                            }
                        }
                    }
                }
            }
            imprimir();
            limpiar();
            MessageBox.Show("Se guardo con exito la devolucion");
        }
Example #22
0
 /// <summary>
 /// Map <see cref="Models.Log"/> to <see cref="DataContext.Log"/>
 /// </summary>
 public static DataContext.Log Convert(this Models.Log log)
 {
     return(new DataContext.Log()
     {
         LogId = log.LogId,
         EventId = log.EventId,
         EventDate = log.EventDate,
         Message = log.Message,
         DeviceId = log.DeviceId
     });
 }
Example #23
0
        public IResponse <bool> Update(Models.Log model, params string[] values)
        {
            var response = new IResponse <bool>()
            {
                Status = true
            };
            var entity = Mapper.Map <Entity.Log>(model);

            response.Result = repository.Update(entity, CurrentUserSession.UserId, values);
            return(response);
        }
Example #24
0
 public async Task <ActionResult> Delete([FromBody] Dto.LogForDelete log)
 {
     Models.Log ModelLog = new Models.Log {
         Id = log.Id, UserId = User.FindFirst(ClaimTypes.NameIdentifier).Value
     };
     if (await Repo.Delete(ModelLog))
     {
         return(Ok());
     }
     return(BadRequest());
 }
Example #25
0
 public void LogTrace(string message)
 {
     Models.Log objLog = new Models.Log()
     {
         LogType     = "Trace",
         Message     = message,
         CreatedDate = DateTime.Now
     };
     db.Logs.Add(objLog);
     db.SaveChangesAsync();
 }
Example #26
0
 public bool IsValidLog(Models.Log log)
 {
     if (log == null)
     {
         return(false);
     }
     if (log.ProjectId == null || log.ProjectId == "")
     {
         return(false);
     }
     return(true);
 }
Example #27
0
        public async Task <bool> Delete(Models.Log log)
        {
            log = await Get(log);

            if (log == null)
            {
                return(false);
            }
            TimeSheetContext.Remove(log);
            await TimeSheetContext.SaveChangesAsync();

            return(true);
        }
Example #28
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public IResponse <Models.Log> Create(Models.Log model)
        {
            var entity = repository.Add(Mapper.Map <Entity.Log>(model), CurrentUserSession.UserId);

            if (entity == null)
            {
                return(new IResponse <Models.Log> {
                    Status = false, ErrCode = ErrorMessage.DataNotExist.Code, ErrMsg = ErrorMessage.DataNotExist.Msg
                });
            }
            return(new IResponse <Models.Log> {
                Status = true, Result = Mapper.Map <Models.Log>(entity)
            });
        }
Example #29
0
        public ActionResult Sitemap()
        {
            Models.Log l = new Models.Log()
            {
                access_token = "",
                controller = "robot",
                method = "log",
                parameters = Request.UserAgent + Request.UserHostName + Request.UserHostAddress
            };
            application.Server.DataBase.Security.SaveLog(l);
            Response.StatusCode = 200;
            Response.ContentType = "text/plain";

            return View();
        }
Example #30
0
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            var request = filterContext.HttpContext.Request;

            Log.Models.Log log = new Models.Log()
            {
                UserName  = request.IsAuthenticated ? filterContext.HttpContext.User.Identity.Name : "Guest",
                UserIP    = request.UserHostAddress,
                DateVisit = DateTime.Now,
                Page      = request.Url.AbsoluteUri
            };

            using (Model1 db = new Model1())
            {
                db.Logs.Add(log);
                db.SaveChanges();
            }
        }
Example #31
0
 public async Task <ActionResult> Update([FromBody] Dto.LogForUpdate log)
 {
     Models.Log ModelLog = new Models.Log {
         Id = log.Id, Start = log.Start, Stop = log.Stop, Description = log.Description, UserId = log.UserId, ActivityId = log.ActivityId
     };
     Models.User user = new Models.User {
         Id = User.FindFirst(ClaimTypes.NameIdentifier).Value
     };
     if (await Repo.IsAllowed(user, ModelLog))
     {
         BadRequest();
     }
     if (await Repo.Update(ModelLog))
     {
         return(Ok());
     }
     return(BadRequest());
 }
Example #32
0
 public static bool Save(string msg)
 {
     try
     {
         using (var ctx = new PlayDataContext { ObjectTrackingEnabled = true })
         {
             var log = new Models.Log
             {
                 CreateDate = System.DateTime.Now,
                 LogType = "Error",
                 Message = msg
             };
             ctx.Logs.InsertOnSubmit(log);
             ctx.SubmitChanges();
             return true;
         }
     }
     catch
     {
         return false;
     }
 }