Beispiel #1
0
 public bool UpdateLawInfoStatus(long Id, int status, long userId)
 {
     try
     {
         LawInfo model = context.LawInfo.FindById(Id);
         if (model != null)
         {
             model.Status  = status;
             model.Auditor = userId;
             int i = context.SaveChanges();
             if (i > 0)
             {
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
         else
         {
             return(false);
         }
     }
     catch
     {
         return(false);
     }
 }
Beispiel #2
0
 public bool UpdateLawInfo(LawInfo model)
 {
     try
     {
         LawInfo models = context.LawInfo.FindById(model.Id);
         if (models != null)
         {
             models.Title        = model.Title;
             models.LawsInfo     = model.LawsInfo;
             models.Author       = model.Author;
             models.CreateTime   = DateTime.Now;
             models.UserId       = model.UserId;
             models.LanguageType = model.LanguageType;
             int i = context.SaveChanges();
             if (i > 0)
             {
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
         else
         {
             return(false);
         }
     }
     catch
     {
         return(false);
     }
 }
Beispiel #3
0
        public JsonResult UpdateLawInfo(LawInfoModifyQuery json)
        {
            bool    flag  = false;
            LawInfo model = ServiceHelper.Create <ILawInfoService>().GetLawInfo(json.Id);

            if (model != null)
            {
                model.Title        = json.Title;
                model.LawsInfo     = json.LawsInfo;
                model.Author       = json.Author;
                model.UserId       = base.CurrentManager.Id;
                model.LanguageType = json.LanguageType;
                flag = ServiceHelper.Create <ILawInfoService>().UpdateLawInfo(model);
            }
            else
            {
                flag = false;
            }
            if (flag)
            {
                return(Json(new { success = true, parentId = model.Id }));
            }
            else
            {
                return(Json(new { success = false }));
            }
        }
Beispiel #4
0
        public ActionResult Edit(long Id)
        {
            LawInfo model = ServiceHelper.Create <ILawInfoService>().GetLawInfo(Id);
            List <AttachmentInfo> models = ServiceHelper.Create <ILawInfoService>().GetAttachmentInfosById(Id);

            ViewBag.attachmentCount = models.Count;
            ViewBag.LanguageType    = model.LanguageType;
            return(View(model));
        }
Beispiel #5
0
        public ActionResult Detail(long Id)
        {
            LawInfo model = ServiceHelper.Create <ILawInfoService>().GetLawInfo(Id);
            List <AttachmentInfo> models = ServiceHelper.Create <ILawInfoService>().GetAttachmentInfosById(Id);

            ViewBag.parentId        = Id;
            ViewBag.attachmentInfo  = models;
            ViewBag.attachmentCount = models.Count;
            return(View(model));
        }
Beispiel #6
0
        //[HttpPost]
        //public JsonResult ListforIndex(string title, int page, int rows)
        //{
        //    LawInfoQuery models = new LawInfoQuery();
        //    models = new LawInfoQuery()
        //    {
        //        Title = title,
        //        PageNo = page,
        //        PageSize = rows
        //    };
        //    PageModel<LawInfo> opModel = ServiceHelper.Create<ILawInfoService>().GetLawInfosforIndex(models);
        //    var array =
        //        from item in opModel.Models.ToArray()
        //        select new { Id = item.Id, Title = item.Title, CreateTime = item.CreateTime };
        //    return Json(new { rows = array, total = opModel.Total });
        //}
        public ActionResult Details(long Id)
        {
            LawInfo        model  = ServiceHelper.Create <ILawInfoService>().GetLawInfo(Id);
            AttachmentInfo models = ServiceHelper.Create <ILawInfoService>().GetAttachmentInfo(Id);

            ViewBag.parentId     = (models == null ? 0 : models.ParentId);
            ViewBag.attachment   = (models == null ? "0" : models.AttachmentName);
            ViewBag.attachmentId = (models == null ? 0 : models.Id);
            ViewBag.userId       = (models == null ? 0 : models.UserId);
            return(View(model));
        }
Beispiel #7
0
        public LawInfo GetLawInfo(long Id)
        {
            LawInfo model = context.LawInfo.FindById(Id);

            if (model != null)
            {
                ManagerInfo manaInfo = context.ManagerInfo.FirstOrDefault((ManagerInfo m) => m.Id == model.Auditor && m.ShopId == 0);
                model.UserName = (manaInfo == null ? "" : manaInfo.UserName);
                ChemCloud_Dictionaries dicts = context.ChemCloud_Dictionaries.FirstOrDefault((ChemCloud_Dictionaries m) => m.DictionaryTypeId == 10 && m.DValue == model.LanguageType.ToString());
                model.Language = dicts.DKey;
            }
            return(model);
        }
Beispiel #8
0
        public LawInfo AddLawInfo(LawInfo lawInfo)
        {
            LawInfo lawInfos;

            using (TransactionScope transactionScope = new TransactionScope())
            {
                lawInfo.CreateTime = DateTime.Now;
                lawInfos           = lawInfo;
                lawInfos           = context.LawInfo.Add(lawInfos);
                context.SaveChanges();
                transactionScope.Complete();
            }
            return(lawInfos);
        }
Beispiel #9
0
        /// <summary>
        /// 会议中心 详情
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        public Result_LawInfo GetObjectById_Web(int Id)
        {
            LawInfo        model = (from p in context.LawInfo where p.Id == Id select p).FirstOrDefault();
            Result_LawInfo res   = new Result_LawInfo()
            {
                Id         = model.Id,
                Title      = model.Title,
                CreateTime = model.CreateTime,
                Author     = model.Author,
                LawsInfo   = model.LawsInfo,
                UserId     = model.UserId
            };

            return(res);
        }
Beispiel #10
0
        public JsonResult AddLawInfo(LawInfoAddQuery json)
        {
            LawInfo lawInfo = new LawInfo();

            lawInfo.Title        = json.Title;
            lawInfo.LawsInfo     = json.LawsInfo;
            lawInfo.Status       = json.Status;
            lawInfo.Author       = json.Author;
            lawInfo.UserId       = base.CurrentManager.Id;
            lawInfo.LanguageType = json.LanguageType;
            LawInfo models = ServiceHelper.Create <ILawInfoService>().AddLawInfo(lawInfo);

            if (models != null)
            {
                return(Json(new { success = true, parentId = models.Id }));
            }
            else
            {
                return(Json(new { success = false }));
            }
        }
Beispiel #11
0
 public bool DeleteLawInfo(long Id)
 {
     try
     {
         LawInfo models = context.LawInfo.FindById(Id);
         IQueryable <AttachmentInfo> model = context.AttachmentInfo.FindBy((AttachmentInfo m) => m.ParentId == Id && m.Type == 2);
         if (models != null)
         {
             int i = 0;
             using (TransactionScope transactionScope = new TransactionScope())
             {
                 context.LawInfo.Remove(models);
                 if (model != null)
                 {
                     context.AttachmentInfo.RemoveRange(model.ToList());
                 }
                 i = context.SaveChanges();
                 transactionScope.Complete();
             }
             if (i > 0)
             {
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
         else
         {
             return(false);
         }
     }
     catch
     {
         return(false);
     }
 }
Beispiel #12
0
        /// <summary>
        /// 前后两条记录
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public Result_List <Result_Model <LawInfo> > Get_PreNext_ById_Web(long id)
        {
            Result_List <Result_Model <LawInfo> > res = new Result_List <Result_Model <LawInfo> >()
            {
                List = new List <Result_Model <LawInfo> >(),
                Msg  = new Result_Msg()
                {
                    IsSuccess = true
                }
            };

            try
            {
                var linqList = (from listMeet in context.LawInfo select listMeet).OrderBy(p => p.CreateTime).OrderByDescending(p => p.Id).ToList();
                int indexNo  = linqList.IndexOf(linqList.First(x => x.Id == id));

                if (indexNo > 0)
                {
                    LawInfo pre = linqList.Skip(indexNo - 1).Take(1).First();
                    if (pre != null)
                    {
                        res.List.Add(new Result_Model <LawInfo>()
                        {
                            Model = pre,
                            Msg   = new Result_Msg()
                            {
                                IsSuccess = true
                            }
                        });
                    }
                    else
                    {
                        res.List.Add(new Result_Model <LawInfo>()
                        {
                            Msg = new Result_Msg()
                            {
                                IsSuccess = false, Message = "获取上一条信息失败"
                            }
                        });
                    }
                }
                else
                {
                    res.List.Add(new Result_Model <LawInfo>()
                    {
                        Msg = new Result_Msg()
                        {
                            IsSuccess = false, Message = "上一条没有了"
                        }
                    });
                }

                if (indexNo < (linqList.Count - 1))
                {
                    LawInfo next = linqList.Skip(indexNo + 1).Take(1).First();

                    if (next != null)
                    {
                        res.List.Add(new Result_Model <LawInfo>()
                        {
                            Model = next,
                            Msg   = new Result_Msg()
                            {
                                IsSuccess = true
                            }
                        });
                    }
                    else
                    {
                        res.List.Add(new Result_Model <LawInfo>()
                        {
                            Msg = new Result_Msg()
                            {
                                IsSuccess = false, Message = "获取下一条信息失败"
                            }
                        });
                    }
                }
                else
                {
                    res.List.Add(new Result_Model <LawInfo>()
                    {
                        Msg = new Result_Msg()
                        {
                            IsSuccess = false, Message = "下一条没有了"
                        }
                    });
                }
            }
            catch (Exception ex)
            {
                res.Msg.IsSuccess = false;
                res.Msg.Message   = "查询失败,失败原因:" + ex.Message;
            }
            return(res);
        }