Пример #1
0
 //文档访问日志,写数据库
 public ActionResult AccessLog(int fileId)
 {
     EmpBasicInfo ebi = Session["ebi"] as EmpBasicInfo;
     ResultMessages rdto=new ResultMessages();
     rdto.Result = true;
     var v = new FileReadLog();
     v.FileId = fileId;
     v.ReaderId = ebi.Id;
     v.ActionId = 0;
     v.ReadDate = DateTime.Now;
     ctx.FileReadLogs.InsertOnSubmit(v);
     ctx.SubmitChanges();
     return Json(rdto);
 }
Пример #2
0
        //获取可编辑文档的写权限
        public ActionResult ObtainWritable(int fileId)
        {
            var rdto = new ResultMessages();
            var v = ctx.Files.Single(r => r.Id == fileId);
            if(v.StatusId==0)//未签出,改签出状态,写访问日志
            {
                EmpBasicInfo ebi = Session["ebi"] as EmpBasicInfo;
                v.LastUpdaterId = ebi.Id;
                v.LastUpdateTime = DateTime.Now;
                v.StatusId = 1;

                var fLog = new FileReadLog();
                fLog.FileId = fileId;
                fLog.ReaderId = ebi.Id;
                fLog.ActionId =1;
                fLog.ReadDate = DateTime.Now;
                ctx.FileReadLogs.InsertOnSubmit(fLog);

                ctx.SubmitChanges();
                rdto.Result = true;
            }
            else//已签出,返回被谁签出
            {
                rdto.Result = false;
                var e = ctx.Employees.Single(r => r.Id == v.LastUpdaterId);
                rdto.Data = e.Id;
                rdto.Message =e.Name;
            }
            return Json(rdto);
        }
Пример #3
0
 partial void DeleteFileReadLog(FileReadLog instance);
Пример #4
0
 partial void UpdateFileReadLog(FileReadLog instance);
Пример #5
0
 partial void InsertFileReadLog(FileReadLog instance);
Пример #6
0
		private void detach_FileReadLogs(FileReadLog entity)
		{
			this.SendPropertyChanging();
			entity.Employee = null;
		}
Пример #7
0
		private void attach_FileReadLogs(FileReadLog entity)
		{
			this.SendPropertyChanging();
			entity.File = this;
		}