Пример #1
0
        public JsonResult UpdateTechInfo(TechnicalInfoModifyQuery json)
        {
            bool          flag  = false;
            TechnicalInfo model = ServiceHelper.Create <ITechnicalInfoService>().GetTechInfo(json.Id);

            if (model != null)
            {
                model.Title        = json.Title;
                model.TechContent  = json.TechContent;
                model.Author       = json.Author;
                model.Tel          = json.Tel;
                model.Email        = json.Email;
                model.PublisherId  = base.CurrentUser.Id;
                model.LanguageType = json.LanguageType;
                flag = ServiceHelper.Create <ITechnicalInfoService>().UpdateTechInfo(model);
            }
            else
            {
                flag = false;
            }
            if (flag)
            {
                return(Json(new { success = true, parentId = model.Id }));
            }
            else
            {
                return(Json(new { success = false }));
            }
        }
Пример #2
0
 public bool UpdateTechinfoStatus(long Id, int status, long userId)
 {
     try
     {
         TechnicalInfo model = context.TechnicalInfo.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);
     }
 }
Пример #3
0
 public bool UpdateTechInfo(TechnicalInfo model)
 {
     try
     {
         TechnicalInfo models = context.TechnicalInfo.FindById(model.Id);
         if (models != null)
         {
             models.Title        = model.Title;
             models.TechContent  = model.TechContent;
             models.Tel          = model.Tel;
             models.Email        = model.Email;
             models.Author       = model.Author;
             models.PublishTime  = DateTime.Now;
             models.PublisherId  = model.PublisherId;
             models.LanguageType = model.LanguageType;
             int i = context.SaveChanges();
             if (i > 0)
             {
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
         else
         {
             return(false);
         }
     }
     catch
     {
         return(false);
     }
 }
Пример #4
0
        public ActionResult Edit(long Id)
        {
            TechnicalInfo         model  = ServiceHelper.Create <ITechnicalInfoService>().GetTechInfo(Id);
            List <AttachmentInfo> models = ServiceHelper.Create <ITechnicalInfoService>().GetAttachmentInfosById(Id);

            ViewBag.attachmentCount = models.Count;
            ViewBag.LanguageType    = model.LanguageType;
            return(View(model));
        }
Пример #5
0
        public ActionResult Detail(long Id)
        {
            TechnicalInfo         model  = ServiceHelper.Create <ITechnicalInfoService>().GetTechInfo(Id);
            List <AttachmentInfo> models = ServiceHelper.Create <ITechnicalInfoService>().GetAttachmentInfosById(Id);

            ViewBag.parentId        = Id;
            ViewBag.attachmentInfo  = models;
            ViewBag.attachmentCount = models.Count;
            return(View(model));
        }
Пример #6
0
        public TechnicalInfo AddTechnicalInfo(TechnicalInfo techInfo)
        {
            TechnicalInfo techInfos;

            using (TransactionScope transactionScope = new TransactionScope())
            {
                techInfo.PublishTime = DateTime.Now;
                techInfos            = techInfo;
                techInfos            = context.TechnicalInfo.Add(techInfos);
                context.SaveChanges();
                transactionScope.Complete();
            }
            return(techInfos);
        }
Пример #7
0
        public TechnicalInfo GetTechInfo(long Id)
        {
            TechnicalInfo model = context.TechnicalInfo.FindById(Id);

            if (model != null)
            {
                UserMemberInfo userInfo = context.UserMemberInfo.FindById(model.PublisherId);
                model.PublisherName = (userInfo == null ? "" : userInfo.UserName);
                ManagerInfo manaInfo = context.ManagerInfo.FirstOrDefault((ManagerInfo m) => m.Id == model.Auditor && m.ShopId == 0);
                model.AuditorName = (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);
        }
Пример #8
0
        /// <summary>
        /// 会议中心 详情
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        public Result_TechnicalInfo GetObjectById_Web(int Id)
        {
            TechnicalInfo        model = (from p in context.TechnicalInfo where p.Id == Id select p).FirstOrDefault();
            string               name  = (from a in context.SiteSettingsInfo where a.Key == "techName" select a).FirstOrDefault().Value;
            string               tel   = (from a in context.SiteSettingsInfo where a.Key == "techTel" select a).FirstOrDefault().Value;
            string               Email = (from a in context.SiteSettingsInfo where a.Key == "techEmail" select a).FirstOrDefault().Value;
            Result_TechnicalInfo res   = new Result_TechnicalInfo()
            {
                Id          = model.Id,
                Title       = model.Title,
                PublishTime = model.PublishTime,
                Author      = model.Author,
                TechContent = model.TechContent,
                Tel         = model.Tel,
                Email       = model.Email,
                techName    = name,
                techTel     = tel,
                techEmail   = Email
            };

            return(res);
        }
Пример #9
0
 public bool DeleteTechInfo(long Id)
 {
     try
     {
         TechnicalInfo models = context.TechnicalInfo.FindById(Id);
         IQueryable <AttachmentInfo> model = context.AttachmentInfo.FindBy((AttachmentInfo m) => m.ParentId == Id && m.Type == 3);
         if (models != null)
         {
             int i = 0;
             using (TransactionScope transactionScope = new TransactionScope())
             {
                 context.TechnicalInfo.Remove(models);
                 if (model != null)
                 {
                     context.AttachmentInfo.RemoveRange(model);
                 }
                 i = context.SaveChanges();
                 transactionScope.Complete();
             }
             if (i > 0)
             {
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
         else
         {
             return(false);
         }
     }
     catch
     {
         return(false);
     }
 }
Пример #10
0
        public JsonResult AddTechnicalInfo(TechnicalInfoAddQuery json)
        {
            TechnicalInfo techInfo = new TechnicalInfo();

            techInfo.Title        = json.Title;
            techInfo.TechContent  = json.TechContent;
            techInfo.Status       = json.Status;
            techInfo.Author       = json.Author;
            techInfo.Tel          = json.Tel;
            techInfo.Email        = json.Email;
            techInfo.PublisherId  = base.CurrentUser.Id;
            techInfo.LanguageType = json.LanguageType;
            TechnicalInfo models = ServiceHelper.Create <ITechnicalInfoService>().AddTechnicalInfo(techInfo);

            if (models != null)
            {
                return(Json(new { success = true, parentId = models.Id }));
            }
            else
            {
                return(Json(new { success = false }));
            }
        }
Пример #11
0
        /// <summary>
        /// 前后两条记录
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public Result_List <Result_Model <TechnicalInfo> > Get_PreNext_ById_Web(long id)
        {
            Result_List <Result_Model <TechnicalInfo> > res = new Result_List <Result_Model <TechnicalInfo> >()
            {
                List = new List <Result_Model <TechnicalInfo> >(),
                Msg  = new Result_Msg()
                {
                    IsSuccess = true
                }
            };

            try
            {
                var linqList = (from listMeet in context.TechnicalInfo where listMeet.Status == 2 select listMeet).OrderBy(p => p.PublishTime).OrderByDescending(p => p.Id).ToList();
                int indexNo  = linqList.IndexOf(linqList.First(x => x.Id == id));

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

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

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