Esempio n. 1
0
        /// <summary>
        /// 组装期设置数据
        /// </summary>
        /// <param name="dr"></param>
        /// <returns></returns>
        private IssueSetEntity MakeIssueSet(IDataReader dr)
        {
            IssueSetEntity issueSetEntity = new IssueSetEntity();
            issueSetEntity.IssueSetID = (Int64)dr["IssueSetID"];
            issueSetEntity.JournalID = (Int64)dr["JournalID"];
            issueSetEntity.Issue = (Int32)dr["Issue"];
            issueSetEntity.TitlePhoto = (String)dr["TitlePhoto"];
            issueSetEntity.Status = (Byte)dr["Status"];
            issueSetEntity.AddDate = (DateTime)dr["AddDate"];
            if (dr.HasColumn("PrintExpenses"))
            {
                issueSetEntity.PrintExpenses = Convert.IsDBNull(dr["PrintExpenses"]) ? 0 : (decimal)dr["PrintExpenses"];
            }

            return issueSetEntity;
        }
Esempio n. 2
0
        /// <summary>
        /// 编辑期设置
        /// </summary>
        /// <param name="issueSetEntity"></param>
        /// <returns></returns>
        public bool UpdateIssueSet(IssueSetEntity issueSetEntity)
        {
            bool flag = false;
            StringBuilder whereCommandText = new StringBuilder();
            whereCommandText.Append("  IssueSetID=@IssueSetID");
            StringBuilder sqlCommandText = new StringBuilder();
            sqlCommandText.Append(" Issue=@Issue");
            sqlCommandText.Append(", TitlePhoto=@TitlePhoto");
            sqlCommandText.Append(", Status=@Status");

            DbCommand cmd = db.GetSqlStringCommand(String.Format("UPDATE dbo.IssueSet SET {0} WHERE  {1}", sqlCommandText.ToString(), whereCommandText.ToString()));

            db.AddInParameter(cmd, "@IssueSetID", DbType.Int64, issueSetEntity.IssueSetID);
            db.AddInParameter(cmd, "@Issue", DbType.Int32, issueSetEntity.Issue);
            db.AddInParameter(cmd, "@TitlePhoto", DbType.AnsiString, issueSetEntity.TitlePhoto);
            db.AddInParameter(cmd, "@Status", DbType.Byte, issueSetEntity.Status);

            try
            {
                db.ExecuteNonQuery(cmd);
                UpdateJournalOfCost(issueSetEntity);
                flag = true;
            }
            catch (SqlException sqlEx)
            {
                throw sqlEx;
            }
            return flag;
        }
Esempio n. 3
0
 /// <summary>
 /// 期刊费用   列于:印刷费
 /// </summary>
 /// <param name="issueSetEntity"></param>
 /// <returns></returns>
 public bool UpdateJournalOfCost(IssueSetEntity issueSetEntity)
 {
     bool flag = false;
     StringBuilder whereCommandText = new StringBuilder();
     whereCommandText.Append("  Issue=@Issue and Year=@Year AND JournalID=@JournalID");
     StringBuilder sqlCommandText = new StringBuilder();
     sqlCommandText.Append("PrintExpenses=@PrintExpenses");
     DbCommand cmd = db.GetSqlStringCommand(String.Format("UPDATE dbo.JournalOfCost SET {0} WHERE  {1}", sqlCommandText.ToString(), whereCommandText.ToString()));
     db.AddInParameter(cmd, "@Issue", DbType.Int32, issueSetEntity.Issue);
     db.AddInParameter(cmd, "@Year", DbType.Int32, issueSetEntity.Year);
     db.AddInParameter(cmd, "@PrintExpenses", DbType.Decimal, issueSetEntity.PrintExpenses);
     db.AddInParameter(cmd, "@JournalID", DbType.Decimal, issueSetEntity.JournalID);
     try
     {
         db.ExecuteNonQuery(cmd);
         flag = true;
     }
     catch (SqlException sqlEx)
     {
         throw sqlEx;
     }
     return flag;
 }
Esempio n. 4
0
        /// <summary>
        /// 新增期设置
        /// </summary>
        /// <param name="issueSetEntity"></param>
        /// <returns></returns>
        public bool AddIssueSet(IssueSetEntity issueSetEntity)
        {
            bool flag = false;
            StringBuilder sqlCommandText = new StringBuilder();
            sqlCommandText.Append(" @JournalID");
            sqlCommandText.Append(", @Issue");
            sqlCommandText.Append(", @TitlePhoto");
            sqlCommandText.Append(", @Status");

            DbCommand cmd = db.GetSqlStringCommand(String.Format("INSERT INTO dbo.IssueSet ({0},AddDate) VALUES ({1},getdate())", sqlCommandText.ToString().Replace("@", ""), sqlCommandText.ToString()));

            db.AddInParameter(cmd, "@JournalID", DbType.Int64, issueSetEntity.JournalID);
            db.AddInParameter(cmd, "@Issue", DbType.Int32, issueSetEntity.Issue);
            db.AddInParameter(cmd, "@TitlePhoto", DbType.AnsiString, issueSetEntity.TitlePhoto);
            db.AddInParameter(cmd, "@Status", DbType.Byte, issueSetEntity.Status);

            try
            {
                db.ExecuteNonQuery(cmd);
                AddJournalOfCost(issueSetEntity);
                flag = true;
            }
            catch (SqlException sqlEx)
            {
                throw sqlEx;
            }
            return flag;
        }
Esempio n. 5
0
 /// <summary>
 /// 期设置是否存在
 /// </summary>
 /// <param name="issueSetEntity"></param>
 /// <returns></returns>
 public bool IssueSetIsExists(IssueSetEntity issueSetEntity)
 {
     string strSql = string.Format("SELECT 1 FROM dbo.IssueSet with(nolock) WHERE JournalID={0} and Issue={1}", issueSetEntity.JournalID, issueSetEntity.Issue);
     if (issueSetEntity.IssueSetID > 0)
         strSql += " and IssueSetID<>" + issueSetEntity.IssueSetID;
     DbCommand cmd = db.GetSqlStringCommand(strSql);
     return db.ExecuteNonQuery(cmd).TryParse<Int32>() == 1;
 }
Esempio n. 6
0
        /// <summary>
        /// 期刊费用   列于:印刷费
        /// </summary>
        public bool AddJournalOfCost(IssueSetEntity issueSetEntity)
        {
            bool flag = false;
            StringBuilder sqlCommandText = new StringBuilder();
            sqlCommandText.Append(" @JournalID");
            sqlCommandText.Append(", @Issue");
            sqlCommandText.Append(", @Year");
            sqlCommandText.Append(", @PrintExpenses");
            sqlCommandText.Append(", @Type");
            DbCommand cmd = db.GetSqlStringCommand(String.Format("INSERT INTO dbo.JournalOfCost ({0},AddDate) VALUES ({1},getdate())", sqlCommandText.ToString().Replace("@", ""), sqlCommandText.ToString()));

            db.AddInParameter(cmd, "@JournalID", DbType.Int64, issueSetEntity.JournalID);
            db.AddInParameter(cmd, "@Issue", DbType.Int32, issueSetEntity.Issue);
            db.AddInParameter(cmd, "@Year", DbType.Int32, issueSetEntity.Year);
            db.AddInParameter(cmd, "@PrintExpenses", DbType.Decimal, issueSetEntity.PrintExpenses);
            db.AddInParameter(cmd, "@Type", DbType.Int32, issueSetEntity.Type);
            try
            {
                db.ExecuteNonQuery(cmd);
                flag = true;
            }
            catch (SqlException sqlEx)
            {
                throw sqlEx;
            }
            return flag;
        }
Esempio n. 7
0
 /// <summary>
 /// 保存期设置
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public ExecResult SaveIssueSet(IssueSetEntity model)
 {
     ExecResult execResult = new ExecResult();
     if (IssueSetIsExists(model))
     {
         execResult.result = EnumJsonResult.failure.ToString();
         execResult.msg = "该期设置已经存在!";
         return execResult;
     }
     bool result = false;
     if (model.IssueSetID == 0)
         result = AddIssueSet(model);
     else
         result = UpdateIssueSet(model);
     if (result)
     {
         execResult.result = EnumJsonResult.success.ToString();
         execResult.msg = "保存期设置成功!";
     }
     else
     {
         execResult.result = EnumJsonResult.failure.ToString();
         execResult.msg = "保存期设置失败!";
     }
     return execResult;
 }
Esempio n. 8
0
 /// <summary>
 /// 期设置是否存在
 /// </summary>
 /// <param name="issueSetEntity"></param>
 /// <returns></returns>
 public bool IssueSetIsExists(IssueSetEntity issueSetEntity)
 {
     return IssueDataAccess.Instance.IssueSetIsExists(issueSetEntity);
 }
Esempio n. 9
0
 /// <summary>
 /// 新增期设置
 /// </summary>
 /// <param name="issueSetEntity"></param>
 /// <returns></returns>
 public bool AddIssueSet(IssueSetEntity issueSetEntity)
 {
     return IssueDataAccess.Instance.AddIssueSet(issueSetEntity);
 }
Esempio n. 10
0
 public ActionResult SaveIssueSet(IssueSetEntity model)
 {
     IIssueFacadeService service = ServiceContainer.Instance.Container.Resolve<IIssueFacadeService>();
     model.JournalID = CurAuthor.JournalID;
     ExecResult result = service.SaveIssueSet(model);
     return Json(new { result = result.result, msg = result.msg });
 }
Esempio n. 11
0
 private IssueSetEntity GetIssueSetModel(Int64 IssueSetID,int year)
 {
     IssueSetQuery query = new IssueSetQuery();
     query.JournalID = CurAuthor.JournalID;
     query.IssueSetID = IssueSetID;
     query.Year = year;
     IIssueFacadeService service = ServiceContainer.Instance.Container.Resolve<IIssueFacadeService>();
     IssueSetEntity model = service.GetIssueSetModel(query);
     if (model == null)
         model = new IssueSetEntity();
     return model;
 }
Esempio n. 12
0
 /// <summary>
 /// 保存期设置
 /// </summary>
 /// <param name="query"></param>
 /// <returns></returns>       
 public ExecResult SaveIssueSet(IssueSetEntity model)
 {
     HttpClientHelper clientHelper = new HttpClientHelper();
     ExecResult result = clientHelper.Post<ExecResult, IssueSetEntity>(GetAPIUrl(APIConstant.ISSUESET_SAVE), model);
     return result;
 }
Esempio n. 13
0
 /// <summary>
 /// 新增期设置
 /// </summary>
 /// <param name="issueSetEntity"></param>
 /// <returns></returns>
 public bool AddIssueSet(IssueSetEntity issueSetEntity)
 {
     return IssueBusProvider.AddIssueSet(issueSetEntity);
 }
Esempio n. 14
0
 /// <summary>
 /// 编辑期设置
 /// </summary>
 /// <param name="issueSetEntity"></param>
 /// <returns></returns>
 public bool UpdateIssueSet(IssueSetEntity issueSetEntity)
 {
     return IssueBusProvider.UpdateIssueSet(issueSetEntity);
 }
Esempio n. 15
0
        /// <summary>
        /// 组装期设置数据
        /// </summary>
        /// <param name="dr"></param>
        /// <returns></returns>
        private IssueSetEntity MakeIssueSetInit(IDataReader dr)
        {
            IssueSetEntity issueSetEntity = new IssueSetEntity();
            issueSetEntity.IssueSetID = (Int64)dr["IssueSetID"];
            issueSetEntity.JournalID = (Int64)dr["JournalID"];
            issueSetEntity.Issue = (Int32)dr["Issue"];
            issueSetEntity.TitlePhoto = (String)dr["TitlePhoto"];
            issueSetEntity.Status = (Byte)dr["Status"];
            issueSetEntity.AddDate = (DateTime)dr["AddDate"];

            return issueSetEntity;
        }
Esempio n. 16
0
 /// <summary>
 /// 编辑期设置
 /// </summary>
 /// <param name="issueSetEntity"></param>
 /// <returns></returns>
 public bool UpdateIssueSet(IssueSetEntity issueSetEntity)
 {
     return IssueDataAccess.Instance.UpdateIssueSet(issueSetEntity);
 }
Esempio n. 17
0
        /// <summary>
        /// 组装期设置数据
        /// </summary>
        /// <param name="dr"></param>
        /// <returns></returns>
        private IssueSetEntity MakeJournalOfCost(IDataReader dr)
        {
            IssueSetEntity issueSetEntity = new IssueSetEntity();
            issueSetEntity.PrintExpenses = Convert.IsDBNull(dr["PrintExpenses"]) ? 0 : (decimal)dr["PrintExpenses"];

            return issueSetEntity;
        }
Esempio n. 18
0
 /// <summary>
 /// 获取最新的期设置
 /// </summary>
 /// <param name="JournalID"></param>
 /// <returns></returns>
 public IssueSetEntity GetMaxIssueSet(Int64 JournalID)
 {
     IssueSetEntity model = null;
     string strSql = "SELECT MAX(Issue) as Issue FROM dbo.IssueSet with(nolock) WHERE JournalID=" + JournalID;
     DbCommand cmd = db.GetSqlStringCommand(strSql);
     using (IDataReader dr = db.ExecuteReader(cmd))
     {
         if (dr.Read())
         {
             model = new IssueSetEntity();
             model.Issue = dr.GetDrValue<Int32>("Issue", 0) + 1;
         }
         dr.Close();
     }
     return model;
 }
Esempio n. 19
0
 public ExecResult SaveIssueSet(IssueSetEntity model)
 {
     IIssueService service = ServiceContainer.Instance.Container.Resolve<IIssueService>();
     return service.SaveIssueSet(model);
 }
Esempio n. 20
0
 /// <summary>
 /// 期设置是否存在
 /// </summary>
 /// <param name="issueSetEntity"></param>
 /// <returns></returns>
 public bool IssueSetIsExists(IssueSetEntity issueSetEntity)
 {
     return IssueBusProvider.IssueSetIsExists(issueSetEntity);
 }