/// <summary> /// 添加审稿单 /// </summary> /// <param name="model"></param> /// <returns></returns> public bool AddReviewBillContent(ReviewBillContentEntity model, DbTransaction trans = null) { StringBuilder sqlCommandText = new StringBuilder(); sqlCommandText.Append(" @CID"); sqlCommandText.Append(", @JournalID"); sqlCommandText.Append(", @ItemID"); sqlCommandText.Append(", @ContentValue"); sqlCommandText.Append(", @IsChecked"); sqlCommandText.Append(", @AddUser"); DbCommand cmd = db.GetSqlStringCommand(String.Format("INSERT INTO dbo.ReviewBillContent ({0},AddDate) VALUES ({1},getdate())", sqlCommandText.ToString().Replace("@", ""), sqlCommandText.ToString())); db.AddInParameter(cmd, "@ItemContentID", DbType.Int64, model.ItemContentID); db.AddInParameter(cmd, "@CID", DbType.Int64, model.CID); db.AddInParameter(cmd, "@JournalID", DbType.Int64, model.JournalID); db.AddInParameter(cmd, "@ItemID", DbType.AnsiString, model.ItemID); db.AddInParameter(cmd, "@ContentValue", DbType.AnsiString, model.ContentValue); db.AddInParameter(cmd, "@IsChecked", DbType.Boolean, model.IsChecked); db.AddInParameter(cmd, "@AddUser", DbType.Int64, model.AddUser); try { bool result = false; if (trans == null) result = db.ExecuteNonQuery(cmd) > 0; else result = db.ExecuteNonQuery(cmd, trans) > 0; if (!result) throw new Exception("新增审稿单失败!"); return result; } catch (Exception ex) { throw ex; } }
/// <summary> /// 组装数据 /// </summary> /// <param name="dr"></param> /// <returns></returns> private ReviewBillContentEntity MakeReviewBillContent(IDataReader dr) { ReviewBillContentEntity reviewBillContentEntity = new ReviewBillContentEntity(); reviewBillContentEntity.ItemContentID = (Int64)dr["ItemContentID"]; reviewBillContentEntity.CID = (Int64)dr["CID"]; reviewBillContentEntity.JournalID = (Int64)dr["JournalID"]; reviewBillContentEntity.ItemID = (Int64)dr["ItemID"]; reviewBillContentEntity.ContentValue = (String)dr["ContentValue"]; reviewBillContentEntity.IsChecked = (Boolean)dr["IsChecked"]; reviewBillContentEntity.AddUser = (Int64)dr["AddUser"]; reviewBillContentEntity.AddDate = (DateTime)dr["AddDate"]; reviewBillContentEntity.Title = (String)dr["Title"]; reviewBillContentEntity.ItemType = (Byte)dr["ItemType"]; reviewBillContentEntity.PItemID = (Int64)dr["PItemID"]; reviewBillContentEntity.SortID = (Int32)dr["SortID"]; return reviewBillContentEntity; }
/// <summary> /// 根据稿件编号获取审稿单信息 /// </summary> /// <param name="query"></param> /// <returns></returns> public IList<ReviewBillContentEntity> GetReviewBillContentListByCID(ReviewBillContentQuery query) { var list = GetReviewBillContentList(query); if (list == null || list.Count == 0) { ReviewBillService service = new ReviewBillService(); var billList = service.GetReviewBillList(new ReviewBillQuery() { JournalID = query.JournalID }); ReviewBillContentEntity model = null; foreach (var item in billList) { model = new ReviewBillContentEntity(); model.ItemContentID = 0; model.JournalID = query.JournalID; model.CID = query.CID.Value; model.ItemID = item.ItemID; model.ContentValue = string.Empty; model.IsChecked = false; model.AddUser = query.AddUser.Value; model.AddDate = item.AddDate; model.Title = item.Title; model.ItemType = item.ItemType; model.PItemID = item.PItemID; model.SortID = item.SortID; list.Add(model); } } return list; }
/// <summary> /// 添加审稿单 /// </summary> /// <param name="model"></param> /// <returns></returns> public bool AddReviewBillContent(ReviewBillContentEntity model) { return ReviewBillContentBusProvider.AddReviewBillContent(model); }
/// <summary> /// 保存审稿单 /// </summary> /// <param name="list"></param> /// <returns></returns> public ExecResult SaveReviewBillContent(ReviewBillContentQuery query) { ExecResult execResult = new ExecResult(); List<ReviewBillContentEntity> list = new List<ReviewBillContentEntity>(); bool result = true; if (query.list!=null && query.list.Count > 0) { list = query.list.ToList(); if (list == null || list.Count == 0) { execResult.result = EnumJsonResult.failure.ToString(); execResult.msg = "没有需要保存的数据!"; } foreach (var item in list) { item.JournalID = query.JournalID; item.AddUser = query.AddUser.Value; } ReviewBillService service = new ReviewBillService(); var billList = service.GetReviewBillList(new ReviewBillQuery() { JournalID = query.JournalID, PItemID = 0 }); ReviewBillContentEntity model = null; foreach (var item in billList) { if (list.Find(p => p.ItemID == item.ItemID) != null) continue; model = new ReviewBillContentEntity(); model.ItemContentID = 0; model.JournalID = query.JournalID; model.AddUser = query.AddUser.Value; model.CID = list[0].CID; model.ItemID = item.ItemID; model.ContentValue = string.Empty; model.IsChecked = false; list.Add(model); } result = ReviewBillContentBusProvider.SaveReviewBillContent(list); } if (result) { FlowCirculationBusiness business = new FlowCirculationBusiness(); CirculationEntity item = new CirculationEntity(); item.CID = query.CID == null ? 0 : query.CID.Value; item.AuthorID = query.AddUser.Value; item.JournalID = query.JournalID; if (query.IsEnExpert == true) { if (query.IsReReview == true) item.EnumCStatus = EnumContributionStatus.ReAuditedEn; else item.EnumCStatus = EnumContributionStatus.AuditedEn; } else { if (query.IsReReview == true) item.EnumCStatus = EnumContributionStatus.ReAudited; else item.EnumCStatus = EnumContributionStatus.Audited; } item.DealAdvice = WKT.Common.Security.SecurityUtils.SafeSqlString(query.DealAdvice); item.CPath = query.PathUrl; item.CFileName = query.CFileName; item.OtherPath = query.OtherPath; item.FigurePath = query.figurePath; item.FFileName = query.FFileName; item.IsHaveBill = 1; //专家审回到固定编辑设置 DictValueBusiness siteConfigBusiness = new DictValueBusiness(); DictValueQuery DictQuery = new DictValueQuery(); IDictionary<int, string> dict = siteConfigBusiness.GetDictValueDcit(query.JournalID, "ExpertToEditor"); if (dict != null && dict.Count > 0) { foreach (var dictItem in dict) { item.IsExpertToEditor = true; item.RecUserID = Convert.ToInt64(dictItem.Value); } } if (business.AuthorContribution(item)) { execResult.result = EnumJsonResult.success.ToString(); execResult.msg = "保存审稿单成功!"; } else { execResult.result = EnumJsonResult.success.ToString(); execResult.msg = "保存审核信息失败!"; } } else { execResult.result = EnumJsonResult.failure.ToString(); execResult.msg = "保存审稿单失败!"; } return execResult; }
/// <summary> /// 添加审稿单 /// </summary> /// <param name="model"></param> /// <returns></returns> public bool AddReviewBillContent(ReviewBillContentEntity model) { return ReviewBillContentDataAccess.Instance.AddReviewBillContent(model); }