public ActionResult External(Guid requestID, string responseToken, string aggregationMode) { //var canViewIndividualResults = CanViewIndividualResults(requestID); bool canViewIndividualResults = DataContext.CanViewIndividualResults(Auth.ApiIdentity, Auth.CurrentUserID, requestID); var results = ReturnResponse(requestID, responseToken, canViewIndividualResults, c => c.Detail(requestID, null, aggregationMode), (rc, ctx, resps) => View("~/Views/Response/External.cshtml", new Models.ResponseViewModel { Request = rc.Request, Responses = ctx.DataMartResponses, RequestType = rc.RequestType, ExportFormats = rc.Plugin.GetExportFormats(ctx).EmptyIfNull(), ResponseToken = ctx.Token, AggregationMode = aggregationMode, BodyView = DocService.GetListVisualization( canViewIndividualResults ? ctx.DataMartResponses.SelectMany(d => d.Documents) : null, "Response", rc.Plugin.DisplayResponse(ctx, rc.Plugin.GetAggregationModes(rc).EmptyIfNull().FirstOrDefault(am => am.ID == aggregationMode))), RequestBodyView = DocService.GetListVisualization(rc.Documents, "Request Criteria", rc.Plugin.DisplayRequest(rc)), AllowGroup = resps.Where(r => r.CanGroup).Skip(1).Any(), AllowApprove = resps.Any(r => r.CanApprove), AllowUngroup = resps.Any(r => r.Group != null && r.CanGroup), RequesterCenterName = rc.Request.RequesterCenterID.HasValue && !DataContext.RequesterCenters.Where(rcn => rcn.ID == rc.Request.RequesterCenterID).FirstOrDefault().IsNull() ? DataContext.RequesterCenters.Where(rcn => rcn.ID == rc.Request.RequesterCenterID).FirstOrDefault().Name : "Not Selected", WorkplanTypeName = rc.Request.WorkplanTypeID.HasValue && !DataContext.WorkplanTypes.Where(wt => wt.ID == rc.Request.WorkplanTypeID).FirstOrDefault().IsNull() ? DataContext.WorkplanTypes.Where(wt => wt.ID == rc.Request.WorkplanTypeID).FirstOrDefault().Name : "Not Selected" }), isExternalView: true, logView: false); return(results); }
public ActionResult GetOpdFormById(string opdId, string mode) { var allRecWithOpd = OpdService.GetOpdByIdWithRows(opdId); if (mode == "recreate") { allRecWithOpd.Opd.VisitNo = allRecWithOpd.Records.Count + 1; allRecWithOpd.Opd.DoctorId = "0"; allRecWithOpd.Opd.Discount = 0; allRecWithOpd.Opd.DiscountBy = " "; allRecWithOpd.Opd.DocFee = 0; allRecWithOpd.Opd.DateTime = DateTime.Now.ToLongTimeString(); allRecWithOpd.Opd.Id = 0; } var dataModel = new OpdPageModel { CreatedOpdForm = allRecWithOpd?.Opd, Mode = mode, DoctorList = DocService.GetAllDocsForDd(), Records = allRecWithOpd?.Records }; //recreate return(View("OpdpForms", dataModel)); }
public void DoUploadReplaceDoc(int originalId, HttpPostedFile fileData) { DocService ds = Context.GetService <DocService>(); DDocInfo originalDoc = ds.DDocInfoBll.Get(originalId); if (originalDoc != null) { //上传新文档 string ext = string.Empty; string savePath = Save(fileData, ref ext); DDocInfo newDoc = new DDocInfo() { UserId = ConfigHelper.AdminUserId, DocType = ext.ToLower(), FileId = Guid.NewGuid(), FileName = fileData.FileName.Replace("." + ext, ""), FileLength = fileData.ContentLength, CreateTime = DateTime.Now, PhysicalPath = savePath }; int newDocId = ds.DDocInfoBll.Insert(newDoc); //更新原来的文档 originalDoc.ReplaceDocId = newDocId; ds.DDocInfoBll.Update(originalDoc); } base.SuccessInfo(); RedirectToReferrer(); }
public void UploadSuccessReward(Guid fileId, int reqId) { DocService ds = Context.GetService <DocService>(); U_UserInfo u = base.GetUser(); DDocInfo doc = ds.DDocInfoBll.GetByFileId(fileId); //更新悬赏列表的加入文档数量 TReqDoc trdoc = ds.TReqDocBll.Get(reqId); trdoc.DocCount += 1; ds.TReqDocBll.Update(trdoc); //新增到加入列表 TJoinDoc jd = new TJoinDoc() { DocId = doc.DocId, TId = reqId, Title = doc.Title, UserId = u.UserId, IsWin = false }; ds.TJoinDocBll.Insert(jd); //转至我的投稿页面 AddSuccess("投稿成功"); Redirect("/my/MyContribute.do"); }
/// <summary> /// 删除投稿 /// </summary> /// <param name="joinId"></param> public void DeleteContribute(int joinId) { try { DocService ds = Context.GetService <DocService>(); UserService us = Context.GetService <UserService>(); U_UserInfo u = base.GetUser(); //投稿对象 TJoinDoc tj = ds.TJoinDocBll.Get(joinId); if (tj.UserId != u.UserId) { throw new TmmException("操作失败,您不是该投稿的所有者"); } if (tj.IsWin) { throw new TmmException("操作失败,该投稿已中标"); } //删除文档 ds.DDocInfoBll.Delete(tj.DocId); //删除投稿记录 ds.TJoinDocBll.Delete(joinId); //更新悬赏的投稿数 TReqDoc trDoc = ds.TReqDocBll.Get(tj.TId); trDoc.DocCount -= 1; ds.TReqDocBll.Update(trDoc); } catch (TmmException te) { AddError(te.Message); } RedirectToReferrer(); }
private void RefrashGridcontrol() { this.gridControl1.DataSource = DocService.GetSelectTemplate(this.taskTemplateId); this.gridControl1.Refresh(); //this.gridControl1.DataSource = DBUtil.ExecuteDataTable("select task_template_id,task_template_name,task_template_file_name from task_template"); //this.gridControl1.Refresh(); }
public void MyDefault() { if (!base.IsLogin) { Redirect("/index.html"); } SystemService sysService = Context.GetService <SystemService>(); DocService ds = Context.GetService <DocService>(); OrderService os = Context.GetService <OrderService>(); PropertyBag["firstCatalog"] = sysService.SCatalogBll.GetTopNode(); //大家在阅读什么 IList <DDocInfo> hotList = ds.DDocInfoBll.GetHotList(0, 12); PropertyBag["hotList"] = hotList; //最新文档 PropertyBag["newList"] = ds.DDocInfoBll.GetNewList(0, 10); //阅读top 10 //同hotList //新闻公告(3条系统公告) Service.Bll.User.M_MessageBLL msgBll = new TMM.Service.Bll.User.M_MessageBLL(); IList <M_Message> mlist = msgBll.GetSysMessageList(0, 3); mlist.ToList().ForEach(m => m.Content = m.Content.ReplaceEnterStr()); PropertyBag["messages"] = mlist; UserService us = Context.GetService <UserService>(); U_UserInfo u = base.GetUser(); //账户余额 PropertyBag["accountBalance"] = us.MAccountBll.GetByUserId(u.UserId).Amount; //最近账单 PropertyBag["billList"] = os.MAccountLogBll.GetList(u.UserId, 0, 3); //可能喜欢的文档 //获取最近一条购买记录 IList <MPurchase> purchaseList = us.MPurchaseBll.GetList(u.UserId, 0, 1); if (purchaseList == null || purchaseList.Count == 0) { PropertyBag["maybeLikeList"] = ds.DDocInfoBll.GetRecommendList(0, 12); } else { MPurchase mp = purchaseList[0]; Core.Search.Index si = new TMM.Core.Search.Index(); si.TableName = "vwDocInfo"; ArrayList maybeLike = si.SearchMaybeLike(mp.Title, 0, 12, mp.DocId); if (maybeLike.Count < 12) { maybeLike.AddRange(ds.DDocInfoBll.GetRecommendList(0, 12 - maybeLike.Count).ToArray()); } PropertyBag["maybeLikeList"] = maybeLike; } RenderView("LogonDefault"); }
public ActionResult History(Guid requestID, Guid responseID) { var ri = DataContext.Responses.Where(r => r.ID == responseID).FirstOrDefault(); if (ri == null) { return(HttpNotFound()); } var rc = RequestService.GetRequestContext(requestID); var ctx = ResponseService.GetResponseHistoryContext(rc, new[] { ri }); bool canViewIndividualResults = DataContext.CanViewIndividualResults(Auth.ApiIdentity, Auth.CurrentUserID, requestID); return(View("~/Views/Response/History.cshtml", new Models.ResponseViewModel { //TreeNode = TreeNodes.Node(rc.Request), BodyView = DocService.GetListVisualization( canViewIndividualResults ? ctx.DataMartResponses.SelectMany(d => d.Documents) : null, "Response", rc.Plugin.DisplayResponse(ctx, rc.Plugin.GetAggregationModes(rc).EmptyIfNull().FirstOrDefault())) })); }
private void button1_Click(object sender, EventArgs e) { // 保存sprint_doc_catalog,用来生成文档任务 DocService.saveSprintDocCatalog(this.sprintId, this.treeList1.FocusedNode["KeyFieldName"].ToString(), this.owner_id); this.documentTreeViews = DocService.findDocumentTreeViewByDocTemplateId(this.doc_template_id, this.sprintId); this.treeList1.DataSource = this.documentTreeViews; // 数据绑定 }
public void SetConvert(int docId) { DocService ds = Context.GetService <DocService>(); ds.DDocInfoBll.UpdateConvertFlag(docId); base.SuccessInfo(); RedirectToReferrer(); }
public void CommentList(int docId) { CancelLayout(); DocService ds = Context.GetService <DocService>(); IList <D_Comment> list = ds.DCommentBll.GetList(docId); list.ToList().ForEach(dc => dc.Content = dc.Content.ReplaceEnterStr()); PropertyBag["list"] = list; }
/// <summary> /// 设置中标 /// </summary> /// <param name="joinId"></param> public void SetZb(int joinId) { try { DocService ds = Context.GetService <DocService>(); UserService us = Context.GetService <UserService>(); U_UserInfo u = base.GetUser(); //投稿对象 TJoinDoc tj = ds.TJoinDocBll.Get(joinId); //是否已经中标了 if (tj.IsWin) { throw new TmmException("此投稿已经设置为中标"); } //悬赏对象 TReqDoc trDoc = ds.TReqDocBll.Get(tj.TId); //余额检测 decimal ye = us.MAccountBll.GetByUserId(u.UserId).Amount; if (ye < trDoc.Price) { throw new TmmException("您的余额不足,请先充值"); } //扣除需求方余额 us.MAccountBll.AccountExpend(u.UserId, trDoc.Price, Utils.TmmUtils.IPAddress(), trDoc.Title); //为投稿人增加余额 us.MAccountBll.AddAmount(tj.UserId, trDoc.Price, Utils.TmmUtils.IPAddress(), trDoc.Title); //更改原文档的owner DDocInfo doc = ds.DDocInfoBll.Get(tj.DocId); doc.UserId = u.UserId; doc.IsTaskDoc = false; ds.DDocInfoBll.Update(doc); PropertyBag["doc"] = doc; //更改投稿文档的状态 tj.IsWin = true; tj.WinTime = DateTime.Now; ds.TJoinDocBll.Update(tj); //发送通知 M_Message msg = new M_Message() { Mtype = (int)Model.Enums.MessageType.Inform, SenderId = ConfigHelper.AdminUserId, RecieverId = tj.UserId, Title = "您的投稿被选中", IsRead = false, CreateTime = DateTime.Now, Content = string.Format("您的投稿【{0}】被{1}设置中标,获得收入¥{2}", tj.Title, "<a href='/home/" + u.UserId + ".html' target='_blank'>" + u.TmmDispName + "</a>" , string.Format("{0:N2}", trDoc.Price)) }; us.MessageBll.Insert(msg); } catch (TmmException te) { AddError(te.Message); RedirectToReferrer(); } }
public ActionResult ListOfDocs() { DateTime dt = DateTime.Now; // var offset = int.Parse(Session["timeZoneOfset"].ToString()); // dt = dt.AddMinutes(-1 * offset); var docs = DocService.GetAllDocs(); return(View(docs)); }
public void AuditReward(int tid) { DocService ds = Context.GetService <DocService>(); TReqDoc tr = ds.TReqDocBll.Get(tid); tr.Status = 2; ds.TReqDocBll.Update(tr); AddSuccess("操作成功"); RedirectToReferrer(); }
public void Default() { SystemService sysService = Context.GetService <SystemService>(); DocService ds = Context.GetService <DocService>(); OrderService os = Context.GetService <OrderService>(); PropertyBag["firstCatalog"] = sysService.SCatalogBll.GetTopNode(); //大家在阅读什么 IList <DDocInfo> hotList = ds.DDocInfoBll.GetHotList(0, 12); PropertyBag["hotList"] = hotList; //精选文档 PropertyBag["recommendList"] = ds.DDocInfoBll.GetRecommendList(0, 10); //最新文档 PropertyBag["newList"] = ds.DDocInfoBll.GetNewList(0, 10); //最新悬赏top 10 PropertyBag["rewardList"] = ds.TReqDocBll.GetList(0, 10, "CreateTime DESC"); //阅读top 10 //同hotList //tags IList <D_Tag> tags = ds.DTagBll.GetList(null, "UseCount Desc", 0, 15); var t = from tag in tags.ToList() orderby tag.TagId descending select tag; if (t != null && t.Count() > 0) { int maxUseCount = t.Max(tt => tt.UseCount); int minUseCount = t.Min(tt => tt.UseCount); t.ToList().ForEach(g => { if (g.UseCount == maxUseCount) { g.TagWeight = 1; } else if (g.UseCount == minUseCount) { g.TagWeight = 0; } else { g.TagWeight = Math.Round((decimal)g.UseCount / maxUseCount, 2); } }); PropertyBag["tags"] = t; } //新闻公告(3条系统公告) Service.Bll.User.M_MessageBLL msgBll = new TMM.Service.Bll.User.M_MessageBLL(); IList <M_Message> mlist = msgBll.GetSysMessageList(0, 3); mlist.ToList().ForEach(m => m.Content = m.Content.ReplaceEnterStr()); PropertyBag["messages"] = mlist; //最近兑换 PropertyBag["exchangeList"] = os.TOrderBll.GetListForExchange(0, 6); }
public void EditDoc(int docId) { DocService ds = Context.GetService <DocService>(); DDocInfo doc = ds.DDocInfoBll.Get(docId); PropertyBag["doc"] = doc; SystemService ss = Context.GetService <SystemService>(); IList <S_Catalog> cates = ss.SCatalogBll.GetTopNode(); PropertyBag["cates"] = cates; }
public void RecommendDoc(int docId) { DocService ds = Context.GetService <DocService>(); DDocInfo doc = ds.DDocInfoBll.Get(docId); doc.IsRecommend = true; ds.DDocInfoBll.Update(doc); base.SuccessInfo(); RedirectToReferrer(); }
public void DeleteComment(int[] commentIds) { DocService ds = Context.GetService <DocService>(); foreach (int cid in commentIds) { ds.DCommentBll.Delete(cid); } base.SuccessInfo(); RedirectToReferrer(); }
/// <summary> /// 我的投稿 /// </summary> public void MyContribute(int first) { PropertyBag["cur_page_addreward"] = true; DocService ds = Context.GetService <DocService>(); U_UserInfo u = base.GetUser(); int rows = 10; int count = 0; IList <TJoinDoc> list = ds.TJoinDocBll.GetList(u.UserId, out count, first, rows); ListPage lp = new ListPage((IList)list, first, rows, count); PropertyBag["lp"] = lp; }
public IHttpActionResult LoadDefault(Dictionary <string, object> SearchData) { try { using (DocService obj = new DocService()) return(Ok(obj.LoadDefault(SearchData))); } catch (Exception Ex) { return(ResponseMessage(Request.CreateErrorResponse(HttpStatusCode.BadRequest, Ex.Message.ToString()))); } }
public ActionResult AddNewDoc(string docId) { var doc = new AppUserDoc { ShiftDays = "Friday,Monday" }; if (!string.IsNullOrEmpty(docId)) { doc = DocService.GetDoc(docId); } return(View(doc)); }
public void AddUp(int docId) { try { DocService ds = Context.GetService <DocService>(); ds.DDocInfoBll.UpdateUpCount(docId); RenderText("1"); } catch (Exception ex) { Utils.Log4Net.Error(ex); RenderText("-1"); } }
public IHttpActionResult GetRecord(Dictionary <string, object> SearchData) { try { string ServerImageURL = Lib.GetSeverImageURL(SearchData["comp_code"].ToString()); using (DocService obj = new DocService()) return(Ok(obj.GetRecord(SearchData, ServerImageURL))); } catch (Exception Ex) { return(ResponseMessage(Request.CreateErrorResponse(HttpStatusCode.BadRequest, Ex.Message.ToString()))); } }
public void DeleteReward(int tid) { DocService ds = Context.GetService <DocService>(); TReqDoc tr = ds.TReqDocBll.Get(tid); if (tr.Status == 2) { throw new Exception("悬赏已经发布,不能删除"); } ds.TReqDocBll.Delete(tr.TId); AddSuccess("操作成功"); RedirectToReferrer(); }
public void SetCommentDisp(int[] commentIds, bool isDisp) { DocService ds = Context.GetService <DocService>(); foreach (int cid in commentIds) { D_Comment dc = ds.DCommentBll.Get(cid); if (dc != null) { dc.IsDisp = isDisp; ds.DCommentBll.Update(dc); } } base.SuccessInfo(); RedirectToReferrer(); }
private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (DocUtil.fileCopy(Convert.ToString(this.treeList1.FocusedNode.GetValue("Doc_catalog_id")))) { this.richEditControl1.LoadDocument( Convert.ToString(this.treeList1.FocusedNode.GetValue("Doc_catalog_id")) + ".docx" ); } // TODO 上传文件 DocService.saveDocFile( new DocFileDTO( this.sprint_id , Convert.ToString(this.treeList1.FocusedNode.GetValue("Doc_catalog_id")) , Convert.ToString(this.treeList1.FocusedNode.GetValue("Doc_catalog_id")) + ".docx" ) ); }
public void CancelAudit(int[] docIds) { DocService ds = Context.GetService <DocService>(); foreach (int docId in docIds) { DDocInfo doc = ds.DDocInfoBll.Get(docId); doc.IsAudit = false; ds.DDocInfoBll.Update(doc); //更新用户表的UploadCount UserService us = Context.GetService <UserService>(); int uc = ds.DDocInfoBll.GetCountByUser(doc.UserId); us.UserInfoBll.UpdateUploadCount(uc, doc.UserId); } base.SuccessInfo(); Redirect("/admin/doc/index.do"); }
public void ReplaceDoc(int docId) { DocService ds = Context.GetService <DocService>(); DDocInfo originalDoc = ds.DDocInfoBll.Get(docId); DDocInfo replaceDoc = ds.DDocInfoBll.Get(originalDoc.ReplaceDocId.Value); originalDoc.ThumbnailUrl = replaceDoc.ThumbnailUrl; originalDoc.FlashUrl = replaceDoc.FlashUrl; originalDoc.PageCount = replaceDoc.PageCount; ds.DDocInfoBll.Update(originalDoc); //替换完成后删除文件 ds.DDocInfoBll.Delete(replaceDoc.DocId); //删除物理文件 File.Delete(replaceDoc.PhysicalPath); base.SuccessInfo(); RedirectToReferrer(); }
/// <summary> /// 选稿 /// </summary> public void SelectContribute(int first, int reqId) { PropertyBag["cur_page_addreward"] = true; int rows = 10; int count = 0; DocService ds = Context.GetService <DocService>(); U_UserInfo u = base.GetUser(); TReqDoc trDoc = ds.TReqDocBll.Get(reqId); if (trDoc.UserId != u.UserId) { throw new TmmException("操作错误,您不是该悬赏的所有者"); } IList <TJoinDoc> list = ds.TJoinDocBll.GetListForXg(reqId, out count, first, rows); ListPage lp = new ListPage((IList)list, first, rows, count); PropertyBag["lp"] = lp; }
public void InsertComment([DataBind("D_Comment")] D_Comment model) { try { DocService ds = Context.GetService <DocService>(); model.Content = model.Content.ToUrlDecode().FilterHtml(); model.CreateTime = DateTime.Now; model.IsDisp = true; ds.DCommentBll.Insert(model); //更新评论量 ds.DDocInfoBll.UpdateCommentCount(model.DocId); RenderText("1"); } catch (Exception ex) { Utils.Log4Net.Error(ex); RenderText("-1"); } }