public ExecResult Save(FinanceContributeEntity model) { try { IFinanceContributeService service = ServiceContainer.Instance.Container.Resolve<IFinanceContributeService>(); return service.Save(model); } catch (Exception ex) { LogProvider.Instance.Error("保存稿件费用信息失败:" + ex.ToString()); ExecResult result = new ExecResult(); result.result = EnumJsonResult.failure.ToString(); result.msg = ex.Message; return result; } }
public ActionResult FContributeSave(FinanceContributeEntity model) { IFinanceFacadeAPIService service = ServiceContainer.Instance.Container.Resolve<IFinanceFacadeAPIService>(); model.JournalID = CurAuthor.JournalID; model.InUser = CurAuthor.AuthorID; model.IsSystem = CurAuthor.GroupID == 1; if (model.PKID == 0) { #region 改变稿件状态 为已经交费 ISiteConfigFacadeService facadeService = ServiceContainer.Instance.Container.Resolve<ISiteConfigFacadeService>(); IList<DictValueEntity> dicteEntity = null; IList<DictValueEntity> noticDicteEntity = null; if (model.FeeType == 1) { noticDicteEntity = facadeService.GetDictValueList(new DictValueQuery() { JournalID = CurAuthor.JournalID, DictKey = "PayNotice" }); dicteEntity = facadeService.GetDictValueList(new DictValueQuery() { JournalID = CurAuthor.JournalID, DictKey = "Payed" }); } else { noticDicteEntity = facadeService.GetDictValueList(new DictValueQuery() { JournalID = CurAuthor.JournalID, DictKey = "PayPageNotice" }); dicteEntity = facadeService.GetDictValueList(new DictValueQuery() { JournalID = CurAuthor.JournalID, DictKey = "PagePayed" }); } if (dicteEntity != null && dicteEntity.Count > 0 && noticDicteEntity != null && noticDicteEntity.Count > 0) { ISiteConfigFacadeService currentService = ServiceContainer.Instance.Container.Resolve<ISiteConfigFacadeService>(); CirculationEntity cirEntity = new CirculationEntity(); cirEntity.JournalID = CurAuthor.JournalID; cirEntity.SendUserID = CurAuthor.AuthorID; cirEntity.CID = model.CID; cirEntity.StatusID = noticDicteEntity.FirstOrDefault<DictValueEntity>().ValueID; cirEntity.ToStatusID = dicteEntity.FirstOrDefault<DictValueEntity>().ValueID; IFlowFacadeService flowService = ServiceContainer.Instance.Container.Resolve<IFlowFacadeService>(); flowService.DealFinaceInAccount(cirEntity); } #endregion } ExecResult result = service.SaveFinanceContribute(model); return Json(new { result = result.result, msg = result.msg }); }
private FinanceContributeEntity GetFinanceArticleModel(Int64 PKID) { FinanceContributeEntity model = null; if (PKID > 0) { FinanceContributeQuery query = new FinanceContributeQuery(); query.JournalID = CurAuthor.JournalID; query.PKID = PKID; IFinanceFacadeAPIService service = ServiceContainer.Instance.Container.Resolve<IFinanceFacadeAPIService>(); model = service.GetFinanceContributeModel(query); } if (model == null) model = new FinanceContributeEntity(); return model; }
/// <summary> /// 将实体数据存入存储媒介(持久化一个对象) /// </summary> /// <param name="financeContribute">FinanceContributeEntity实体对象</param> /// <returns>true:存储成功 false:存储失败</returns> public bool AddFinanceContribute(FinanceContributeEntity financeContribute) { return FinanceContributeDataAccess.Instance.AddFinanceContribute(financeContribute); }
/// <summary> /// 从存储媒介删除实体数据 /// </summary> /// <param name="financeContribute">FinanceContributeEntity实体对象</param> /// <returns>true:删除成功 false:删除失败</returns> public bool DeleteFinanceContribute(FinanceContributeEntity financeContribute) { return FinanceContributeDataAccess.Instance.DeleteFinanceContribute(financeContribute); }
public bool AddFinanceContribute(FinanceContributeEntity financeContributeEntity) { using (DbConnection conn = db.CreateConnection()) { if (conn.State != ConnectionState.Open) conn.Open(); DbTransaction trans = conn.BeginTransaction(); try { StringBuilder sqlCommandText = new StringBuilder(); sqlCommandText.Append(" @JournalID"); sqlCommandText.Append(", @CID"); sqlCommandText.Append(", @FeeType"); sqlCommandText.Append(", @Amount"); sqlCommandText.Append(", @ArticleType"); sqlCommandText.Append(", @ArticleCount"); sqlCommandText.Append(", @PayType"); sqlCommandText.Append(", @RemitBillNo"); sqlCommandText.Append(", @InUser"); sqlCommandText.Append(", @InComeDate"); sqlCommandText.Append(", @InvoiceNo"); sqlCommandText.Append(", @PostNo"); sqlCommandText.Append(", @SendDate"); sqlCommandText.Append(", @Note"); sqlCommandText.Append(", @Status"); DbCommand cmd = db.GetSqlStringCommand(String.Format("INSERT INTO dbo.FinanceContribute ({0},AddDate) VALUES ({1},getdate())", sqlCommandText.ToString().Replace("@", ""), sqlCommandText.ToString())); db.AddInParameter(cmd, "@JournalID", DbType.Int64, financeContributeEntity.JournalID); db.AddInParameter(cmd, "@CID", DbType.Int64, financeContributeEntity.CID); db.AddInParameter(cmd, "@FeeType", DbType.Byte, financeContributeEntity.FeeType); db.AddInParameter(cmd, "@Amount", DbType.Decimal, financeContributeEntity.Amount); db.AddInParameter(cmd, "@ArticleType", DbType.Int32, financeContributeEntity.ArticleType); db.AddInParameter(cmd, "@ArticleCount", DbType.Decimal, financeContributeEntity.ArticleCount); db.AddInParameter(cmd, "@PayType", DbType.Byte, financeContributeEntity.PayType); db.AddInParameter(cmd, "@RemitBillNo", DbType.AnsiString, financeContributeEntity.RemitBillNo); db.AddInParameter(cmd, "@InUser", DbType.Int64, financeContributeEntity.InUser); db.AddInParameter(cmd, "@InComeDate", DbType.DateTime, financeContributeEntity.InComeDate); db.AddInParameter(cmd, "@InvoiceNo", DbType.AnsiString, financeContributeEntity.InvoiceNo); db.AddInParameter(cmd, "@PostNo", DbType.AnsiString, financeContributeEntity.PostNo); db.AddInParameter(cmd, "@SendDate", DbType.DateTime, financeContributeEntity.SendDate); db.AddInParameter(cmd, "@Note", DbType.AnsiString, financeContributeEntity.Note); db.AddInParameter(cmd, "@Status", DbType.Byte, financeContributeEntity.Status); bool result = db.ExecuteNonQuery(cmd, trans) > 0; if (!result) throw new Exception("新增稿件费用信息失败!"); if (financeContributeEntity.Status == 1 && (financeContributeEntity.FeeType == 1 || financeContributeEntity.FeeType == 2)) { string strSql = string.Format("Update dbo.ContributionInfo set {0}=1 WHERE CID={1}" , financeContributeEntity.FeeType == 1 ? "IsPayAuditFee" : "IsPayPageFee", financeContributeEntity.CID); cmd = db.GetSqlStringCommand(strSql); if (db.ExecuteNonQuery(cmd, trans) < 1) throw new Exception("更新稿件表" + (financeContributeEntity.FeeType == 1 ? "审稿费" : "版面费") + "状态失败!"); } trans.Commit(); return true; } catch (Exception ex) { trans.Rollback(); throw ex; } } }
/// <summary> /// 获取版面费报表分页数据 /// </summary> /// <param name="query"></param> /// <returns></returns> public Pager<FinanceContributeEntity> GetFinancePageFeeReportPageList(FinanceContributeQuery query) { string tableSql = @"SELECT {0} FROM dbo.ContributionInfo a with(nolock) LEFT JOIN (select distinct (AuthorID),JournalID, Address,InvoiceUnit,Tel,Mobile from dbo.AuthorDetail ) as ad ON a.AuthorID=ad.AuthorID AND a.JournalID=ad.JournalID LEFT JOIN dbo.PayNotice b with(nolock) ON b.JournalID=a.JournalID and b.CID=a.CID and b.PayType=2 LEFT JOIN dbo.FinanceContribute c ON c.JournalID=b.JournalID and c.CID=b.CID and c.FeeType=2 and c.Status=1 INNER JOIN dbo.ContributionAuthor d with(nolock) ON a.JournalID=d.JouranalID and a.CID=d.CID and d.IsCommunication=1 WHERE " + GetFinancePageFeeReportFilter(query); string strSql = string.Format(tableSql, @"c.PKID,a.CID,a.CNumber,a.Title,a.AuthorID as UserID,a.Year,a.Issue,a.AddDate,dbo.fn_GetContributionCurrentEditor(a.JournalID,a.CID) as EditAuthorID,ad.Address,ad.InvoiceUnit,ad.Tel,ad.Mobile,d.CAuthorID as AuthorID,d.AuthorName,d.WorkUnit, b.Amount as NoticeMoney,c.Amount as PageMoney,c.FeeType,c.InUser,c.InComeDate,c.InvoiceNo,c.RemitBillNo,c.PostNo,c.SendDate,c.Note,b.NoticeID as PageNoticeID,d.Email,d.ZipCode,ROW_NUMBER() OVER(ORDER BY a.AddDate desc) AS ROW_ID") , sumStr = string.Empty; if (!query.IsReport) { strSql = string.Format(SQL_Page_Select, strSql, query.StartIndex, query.EndIndex); sumStr = string.Format(tableSql, "RecordCount=COUNT(1),PageMoneyTotal=SUM(c.Amount)"); } return db.GetPageList<FinanceContributeEntity>(strSql , sumStr , query.CurrentPage, query.PageSize , (dr, pager) => { pager.TotalRecords = TypeParse.ToLong(dr["RecordCount"]); pager.PageMoney = dr.GetDrValue<Decimal>("PageMoneyTotal"); } , (dr) => { List<FinanceContributeEntity> list = new List<FinanceContributeEntity>(); FinanceContributeEntity model = null; while (dr.Read()) { model = new FinanceContributeEntity(); model.PKID = dr.GetDrValue<Int64>("PKID"); model.CID = dr.GetDrValue<Int64>("CID"); model.CNumber = dr.GetDrValue<String>("CNumber"); model.Title = dr.GetDrValue<String>("Title"); model.UserID = dr.GetDrValue<Int64>("UserID"); model.EditAuthorID = dr.GetDrValue<Int64>("EditAuthorID"); model.Address = dr.GetDrValue<String>("Address"); model.ZipCode = dr.GetDrValue<String>("ZipCode"); model.Tel = dr.GetDrValue<String>("Tel"); model.Mobile = dr.GetDrValue<String>("Mobile"); model.InvoiceUnit = dr.GetDrValue<String>("InvoiceUnit"); model.AuthorID = dr.GetDrValue<Int64>("AuthorID"); model.AuthorName = dr.GetDrValue<String>("AuthorName"); model.Email = dr.GetDrValue<String>("Email"); model.WorkUnit = dr.GetDrValue<String>("WorkUnit"); model.PageMoney = dr.GetDrValue<Decimal>("PageMoney"); model.PageMoneyNotice = dr.GetDrValue<Decimal>("NoticeMoney"); model.FeeType = dr.GetDrValue<Byte>("FeeType"); model.InUser = dr.GetDrValue<Int64>("InUser"); model.InComeDate = dr.GetDrValue<DateTime?>("InComeDate"); model.InvoiceNo = dr.GetDrValue<String>("InvoiceNo"); model.RemitBillNo = dr.GetDrValue<String>("RemitBillNo"); model.PostNo = dr.GetDrValue<String>("PostNo"); model.SendDate = dr.GetDrValue<DateTime?>("SendDate"); model.Note = dr.GetDrValue<String>("Note") == null ? "" : dr.GetDrValue<String>("Note"); model.PageNoticeID = dr.GetDrValue<Int64>("PageNoticeID"); list.Add(model); } return list; }); }
public bool DeleteFinanceContribute(FinanceContributeEntity financeContributeEntity) { bool flag = false; StringBuilder sqlCommandText = new StringBuilder(); sqlCommandText.Append("DELETE FROM dbo.FinanceContribute"); sqlCommandText.Append(" WHERE PKID=@PKID"); DbCommand cmd = db.GetSqlStringCommand(sqlCommandText.ToString()); db.AddInParameter(cmd, "@PKID", DbType.Int64, financeContributeEntity.PKID); try { db.ExecuteNonQuery(cmd); flag = true; } catch (SqlException sqlEx) { throw sqlEx; } return flag; }
/// <summary> /// 获取财务统计一览表分页数据 /// </summary> /// <param name="query"></param> /// <returns></returns> public Pager<FinanceContributeEntity> GetFinanceGlancePageList(FinanceContributeQuery query) { string tableSql = @"SELECT {0} FROM dbo.ContributionInfo a with(nolock) LEFT JOIN (select distinct (AuthorID),JournalID,AuthorName,Address,InvoiceUnit,Tel,Mobile from dbo.AuthorDetail ) as ad ON a.AuthorID=ad.AuthorID AND a.JournalID=ad.JournalID INNER JOIN dbo.FinanceContribute b ON a.JournalID=b.JournalID and a.CID=b.CID and b.FeeType!=4 LEFT JOIN dbo.PayNotice c with(nolock) ON b.JournalID=c.JournalID and b.CID=c.CID and b.FeeType=c.PayType LEFT JOIN dbo.ContributionAuthor d with(nolock) ON d.JouranalID=a.JournalID and d.CID=a.CID and d.IsFirst=1 LEFT JOIN dbo.ContributionAuthor e with(nolock) ON e.JouranalID=a.JournalID and e.CID=a.CID and e.IsCommunication=1 WHERE " + GetFinanceGlanceFilter(query); string strSql = string.Format(tableSql, @"b.PKID ,a.CID ,a.CNumber ,a.Title ,a.AuthorID ,ad.AuthorName ,ad.Address ,ad.InvoiceUnit ,ad.Tel ,ad.Mobile ,d.CAuthorID as FirstAuthorID ,d.AuthorName as FirstAuthorName ,d.WorkUnit ,e.CAuthorID as CommunicationAuthorID ,e.AuthorName as CommunicationAuthorName ,b.FeeType ,c.Amount as ShouldMoney ,b.Amount as SolidMoney ,b.InUser ,b.InComeDate ,b.InvoiceNo ,b.RemitBillNo ,b.PostNo ,b.SendDate ,b.Note ,ROW_NUMBER() OVER(ORDER BY a.AddDate desc) AS ROW_ID"), sumStr = string.Empty; if (!query.IsReport) { strSql = string.Format(SQL_Page_Select, strSql, query.StartIndex, query.EndIndex); sumStr = string.Format(tableSql, "RecordCount=COUNT(1),Money=SUM(b.Amount)"); } return db.GetPageList<FinanceContributeEntity>(strSql , sumStr , query.CurrentPage, query.PageSize , (dr, pager) => { pager.TotalRecords = TypeParse.ToLong(dr["RecordCount"]); pager.Money = dr.GetDrValue<Decimal>("Money"); } , (dr) => { List<FinanceContributeEntity> list = new List<FinanceContributeEntity>(); FinanceContributeEntity model = null; while (dr.Read()) { model = new FinanceContributeEntity(); model.PKID = dr.GetDrValue<Int64>("PKID"); model.CID = dr.GetDrValue<Int64>("CID"); model.CNumber = dr.GetDrValue<String>("CNumber"); model.Title = dr.GetDrValue<String>("Title"); model.UserID = dr.GetDrValue<Int64>("AuthorID"); model.Address = dr.GetDrValue<String>("Address"); model.Tel = dr.GetDrValue<String>("Tel"); model.Mobile = dr.GetDrValue<String>("Mobile"); model.InvoiceUnit = dr.GetDrValue<String>("InvoiceUnit"); model.AuthorID = dr.GetDrValue<Int64>("AuthorID"); model.AuthorName = dr.GetDrValue<String>("AuthorName"); model.FirstAuthorID = dr.GetDrValue<Int64>("FirstAuthorID"); model.FirstAuthorName = dr.GetDrValue<String>("FirstAuthorName"); model.CommunicationAuthorID = dr.GetDrValue<Int64>("CommunicationAuthorID"); model.CommunicationAuthorName = dr.GetDrValue<String>("CommunicationAuthorName"); model.WorkUnit = dr.GetDrValue<String>("WorkUnit"); model.FeeType = dr.GetDrValue<Byte>("FeeType"); model.ShouldMoney = dr.GetDrValue<Decimal>("ShouldMoney"); model.Amount = dr.GetDrValue<Decimal>("SolidMoney"); model.InUser = dr.GetDrValue<Int64>("InUser"); model.InComeDate = dr.GetDrValue<DateTime?>("InComeDate"); model.InvoiceNo = dr.GetDrValue<String>("InvoiceNo"); model.RemitBillNo = dr.GetDrValue<String>("RemitBillNo"); model.PostNo = dr.GetDrValue<String>("PostNo"); model.SendDate = dr.GetDrValue<DateTime?>("SendDate"); model.Note = dr.GetDrValue<String>("Note"); list.Add(model); } return list; }); }
public FinanceContributeEntity MakeFinanceContribute(DataRow dr) { FinanceContributeEntity financeContributeEntity = null; if (dr != null) { financeContributeEntity = new FinanceContributeEntity(); financeContributeEntity.PKID = (Int64)dr["PKID"]; financeContributeEntity.JournalID = (Int64)dr["JournalID"]; financeContributeEntity.CID = (Int64)dr["CID"]; financeContributeEntity.FeeType = (Byte)dr["FeeType"]; financeContributeEntity.Amount = (Decimal)dr["Amount"]; financeContributeEntity.ArticleType = (Int32)dr["ArticleType"]; financeContributeEntity.ArticleCount = (Decimal)dr["ArticleCount"]; financeContributeEntity.PayType = Convert.IsDBNull(dr["PayType"]) ? null : (Byte?)dr["PayType"]; financeContributeEntity.RemitBillNo = Convert.IsDBNull(dr["RemitBillNo"]) ? null : (String)dr["RemitBillNo"]; financeContributeEntity.InUser = (Int64)dr["InUser"]; financeContributeEntity.InComeDate = Convert.IsDBNull(dr["InComeDate"]) ? null : (DateTime?)dr["InComeDate"]; financeContributeEntity.InvoiceNo = Convert.IsDBNull(dr["InvoiceNo"]) ? null : (String)dr["InvoiceNo"]; financeContributeEntity.PostNo = Convert.IsDBNull(dr["PostNo"]) ? null : (String)dr["PostNo"]; financeContributeEntity.SendDate = Convert.IsDBNull(dr["SendDate"]) ? null : (DateTime?)dr["SendDate"]; financeContributeEntity.Note = Convert.IsDBNull(dr["Note"]) ? null : (String)dr["Note"]; financeContributeEntity.AddDate = (DateTime)dr["AddDate"]; } return financeContributeEntity; }
public List<FinanceContributeEntity> MakeFinanceContributeList(IDataReader dr) { List<FinanceContributeEntity> list = new List<FinanceContributeEntity>(); while (dr.Read()) { FinanceContributeEntity financeContributeEntity = new FinanceContributeEntity(); financeContributeEntity.PKID = (Int64)dr["PKID"]; financeContributeEntity.JournalID = (Int64)dr["JournalID"]; financeContributeEntity.CID = (Int64)dr["CID"]; financeContributeEntity.FeeType = (Byte)dr["FeeType"]; financeContributeEntity.Amount = (Decimal)dr["Amount"]; financeContributeEntity.ArticleType = (Int32)dr["ArticleType"]; financeContributeEntity.ArticleCount = (Decimal)dr["ArticleCount"]; financeContributeEntity.PayType = Convert.IsDBNull(dr["PayType"]) ? null : (Byte?)dr["PayType"]; financeContributeEntity.RemitBillNo = Convert.IsDBNull(dr["RemitBillNo"]) ? null : (String)dr["RemitBillNo"]; financeContributeEntity.InUser = (Int64)dr["InUser"]; financeContributeEntity.InComeDate = Convert.IsDBNull(dr["InComeDate"]) ? null : (DateTime?)dr["InComeDate"]; financeContributeEntity.InvoiceNo = Convert.IsDBNull(dr["InvoiceNo"]) ? null : (String)dr["InvoiceNo"]; financeContributeEntity.PostNo = Convert.IsDBNull(dr["PostNo"]) ? null : (String)dr["PostNo"]; financeContributeEntity.SendDate = Convert.IsDBNull(dr["SendDate"]) ? null : (DateTime?)dr["SendDate"]; financeContributeEntity.Note = Convert.IsDBNull(dr["Note"]) ? null : (String)dr["Note"]; financeContributeEntity.AddDate = (DateTime)dr["AddDate"]; financeContributeEntity.Status = dr.GetDrValue<Byte>("Status"); if (dr.HasColumn("Title")) financeContributeEntity.Title = dr.GetDrValue<String>("Title"); if (dr.HasColumn("AuthorID")) financeContributeEntity.AuthorID = dr.GetDrValue<Int64>("AuthorID"); if (dr.HasColumn("CNumber")) financeContributeEntity.CNumber = dr.GetDrValue<String>("CNumber"); list.Add(financeContributeEntity); } dr.Close(); return list; }
/// <summary> /// 将实体数据存入存储媒介(持久化一个对象) /// </summary> /// <param name="financeContribute">FinanceContributeEntity实体对象</param> /// <returns>true:存储成功 false:存储失败</returns> public bool AddFinanceContribute(FinanceContributeEntity financeContribute) { return FinanceContributeBusProvider.AddFinanceContribute(financeContribute); }
/// <summary> /// 更新存储媒介中的实体数据 /// </summary> /// <param name="financeContribute">FinanceContributeEntity实体对象</param> /// <returns>true:更新成功 false:更新失败</returns> public bool UpdateFinanceContribute(FinanceContributeEntity financeContribute) { return FinanceContributeBusProvider.UpdateFinanceContribute(financeContribute); }
/// <summary> /// 保存稿件费用信息 /// </summary> /// <param name="model"></param> /// <returns></returns> public ExecResult Save(FinanceContributeEntity model) { ExecResult execResult = new ExecResult(); bool result = false; model.RemitBillNo = model.RemitBillNo.TextFilter(); model.InvoiceNo = model.InvoiceNo.TextFilter(); model.PostNo = model.PostNo.TextFilter(); model.Note = model.Note.TextFilter(); if (model.IsSystem) { model.InComeDate = DateTime.Now; model.Status = 1; } if (model.PKID == 0) { FinanceContributeQuery fQuery = new FinanceContributeQuery(); fQuery.JournalID = model.JournalID; fQuery.CID = model.CID; fQuery.FeeType = model.FeeType; if (FinanceContributeBusProvider.FinanceContributeIsExists(fQuery)) { execResult.result = EnumJsonResult.failure.ToString(); execResult.msg = "该费用已经存在!"; return execResult; } result = AddFinanceContribute(model); if (result) { execResult.result = EnumJsonResult.success.ToString(); execResult.msg = "新增稿件费用成功!"; } else { execResult.result = EnumJsonResult.failure.ToString(); execResult.msg = "新增稿件费用失败!"; } } else { result = UpdateFinanceContribute(model); if (result) { execResult.result = EnumJsonResult.success.ToString(); execResult.msg = "修改稿件费用成功!"; } else { execResult.result = EnumJsonResult.failure.ToString(); execResult.msg = "修改稿件费用失败!"; } } if (result) { //更新缴费通知记录 if (model.NoticeID > 0) { PayNoticeQuery query = new PayNoticeQuery(); query.NoticeID = model.NoticeID; query.Status = (Byte)(model.IsSystem ? 1 : 2); PayNoticeBusiness business = new PayNoticeBusiness(); business.ChangeStatus(query); } } return execResult; }
/// <summary> /// 从存储媒介删除实体数据 /// </summary> /// <param name="financeContribute">FinanceContributeEntity实体对象</param> /// <returns>true:删除成功 false:删除失败</returns> public bool DeleteFinanceContribute(FinanceContributeEntity financeContribute) { return FinanceContributeBusProvider.DeleteFinanceContribute(financeContribute); }
/// <summary> /// 保存稿件费用数据 /// </summary> /// <param name="model"></param> /// <returns></returns> public ExecResult SaveFinanceContribute(FinanceContributeEntity model) { HttpClientHelper clientHelper = new HttpClientHelper(); ExecResult result = clientHelper.Post<ExecResult, FinanceContributeEntity>(GetAPIUrl(APIConstant.FINANCECONTRIBUTE_SAVE), model); return result; }