public ExecResult SaveYearVolume(YearVolumeEntity model)
 {
     IIssueService service = ServiceContainer.Instance.Container.Resolve<IIssueService>();
     return service.SaveYearVolume(model);
 }
Beispiel #2
0
 /// <summary>
 /// 组装年卷数据
 /// </summary>
 /// <param name="dr"></param>
 /// <returns></returns>
 private YearVolumeEntity MakeYearVolume(IDataReader dr)
 {
     YearVolumeEntity model = new YearVolumeEntity();
     model.SetID = (Int64)dr["SetID"];
     model.JournalID = (Int64)dr["JournalID"];
     model.Year = (Int32)dr["Year"];
     model.Volume = (Int32)dr["Volume"];
     model.Status = (Byte)dr["Status"];
     model.AddDate = (DateTime)dr["AddDate"];
     return model;
 }
Beispiel #3
0
        /// <summary>
        /// 新增年卷
        /// </summary>
        /// <param name="yearVolumeEntity"></param>
        /// <returns></returns>
        public bool AddYearVolume(YearVolumeEntity yearVolumeEntity)
        {
            bool flag = false;
            StringBuilder sqlCommandText = new StringBuilder();
            sqlCommandText.Append(" @JournalID");
            sqlCommandText.Append(", @Year");
            sqlCommandText.Append(", @Volume");
            sqlCommandText.Append(", @Status");

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

            db.AddInParameter(cmd, "@JournalID", DbType.Int64, yearVolumeEntity.JournalID);
            db.AddInParameter(cmd, "@Year", DbType.Int32, yearVolumeEntity.Year);
            db.AddInParameter(cmd, "@Volume", DbType.Int32, yearVolumeEntity.Volume);
            db.AddInParameter(cmd, "@Status", DbType.Byte, yearVolumeEntity.Status);

            try
            {
                db.ExecuteNonQuery(cmd);
                flag = true;
            }
            catch (SqlException sqlEx)
            {
                throw sqlEx;
            }
            return flag;
        }
Beispiel #4
0
        /// <summary>
        /// 编辑年卷
        /// </summary>
        /// <param name="yearVolumeEntity"></param>
        /// <returns></returns>
        public bool UpdateYearVolume(YearVolumeEntity yearVolumeEntity)
        {
            bool flag = false;
            StringBuilder whereCommandText = new StringBuilder();
            whereCommandText.Append("  SetID=@SetID");
            StringBuilder sqlCommandText = new StringBuilder();
            sqlCommandText.Append(" Year=@Year");
            sqlCommandText.Append(", Volume=@Volume");
            sqlCommandText.Append(", Status=@Status");

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

            db.AddInParameter(cmd, "@SetID", DbType.Int64, yearVolumeEntity.SetID);
            db.AddInParameter(cmd, "@Year", DbType.Int32, yearVolumeEntity.Year);
            db.AddInParameter(cmd, "@Volume", DbType.Int32, yearVolumeEntity.Volume);
            db.AddInParameter(cmd, "@Status", DbType.Byte, yearVolumeEntity.Status);

            try
            {
                db.ExecuteNonQuery(cmd);
                flag = true;
            }
            catch (SqlException sqlEx)
            {
                throw sqlEx;
            }
            return flag;
        }
Beispiel #5
0
 /// <summary>
 /// 年是否存在
 /// </summary>
 /// <param name="yearVolumeEntity"></param>
 /// <returns></returns>
 public bool YearVolumeYearIsExists(YearVolumeEntity yearVolumeEntity)
 {
     string strSql = string.Format("SELECT 1 FROM dbo.YearVolume WHERE JournalID={0} and Year={1}", yearVolumeEntity.JournalID, yearVolumeEntity.Year);
     if (yearVolumeEntity.SetID > 0)
         strSql += " and SetID<>" + yearVolumeEntity.SetID;
     DbCommand cmd = db.GetSqlStringCommand(strSql);
     return db.ExecuteScalar(cmd).TryParse<Int32>() == 1;
 }
Beispiel #6
0
 /// <summary>
 /// 新增年卷
 /// </summary>
 /// <param name="yearVolumeEntity"></param>
 /// <returns></returns>
 public bool AddYearVolume(YearVolumeEntity yearVolumeEntity)
 {
     return IssueDataAccess.Instance.AddYearVolume(yearVolumeEntity);
 }
Beispiel #7
0
 /// <summary>
 /// 获取最新的年卷
 /// </summary>
 /// <param name="JournalID"></param>
 /// <returns></returns>
 public YearVolumeEntity GetMaxYearVolume(Int64 JournalID)
 {
     YearVolumeEntity model = null;
     string strSql = string.Format("SELECT MAX(Year) as Year,MAX(Volume) as Volume FROM dbo.YearVolume WHERE JournalID={0}", JournalID);
     DbCommand cmd = db.GetSqlStringCommand(strSql);
     using (IDataReader dr = db.ExecuteReader(cmd))
     {
         if (dr.Read())
         {
             model = new YearVolumeEntity();
             model.Year = dr.GetDrValue<Int32>("Year", 2004) + 1;
             model.Volume = dr.GetDrValue<Int32>("Volume", 0) + 1;
         }
         dr.Close();
     }
     return model;
 }
Beispiel #8
0
 /// <summary>
 /// 编辑年卷
 /// </summary>
 /// <param name="yearVolumeEntity"></param>
 /// <returns></returns>
 public bool UpdateYearVolume(YearVolumeEntity yearVolumeEntity)
 {
     return IssueDataAccess.Instance.UpdateYearVolume(yearVolumeEntity);
 }
Beispiel #9
0
 /// <summary>
 /// 年是否存在
 /// </summary>
 /// <param name="yearVolumeEntity"></param>
 /// <returns></returns>
 public bool YearVolumeYearIsExists(YearVolumeEntity yearVolumeEntity)
 {
     return IssueDataAccess.Instance.YearVolumeYearIsExists(yearVolumeEntity);
 }
Beispiel #10
0
 public ActionResult SaveYearVolume(YearVolumeEntity model)
 {
     IIssueFacadeService service = ServiceContainer.Instance.Container.Resolve<IIssueFacadeService>();
     model.JournalID = CurAuthor.JournalID;
     ExecResult result = service.SaveYearVolume(model);
     return Json(new { result = result.result, msg = result.msg });
 }
Beispiel #11
0
 private YearVolumeEntity GetYearVolumeModel(Int64 SetID)
 {
     YearVolumeQuery query = new YearVolumeQuery();
     query.JournalID = CurAuthor.JournalID;
     query.setID = SetID;
     IIssueFacadeService service = ServiceContainer.Instance.Container.Resolve<IIssueFacadeService>();
     YearVolumeEntity model = service.GetYearVolumeModel(query);
     if (model == null)
         model = new YearVolumeEntity();
     return model;
 }
 /// <summary>
 /// 保存年卷设置
 /// </summary>
 /// <param name="query"></param>
 /// <returns></returns>       
 public ExecResult SaveYearVolume(YearVolumeEntity model)
 {
     HttpClientHelper clientHelper = new HttpClientHelper();
     ExecResult result = clientHelper.Post<ExecResult, YearVolumeEntity>(GetAPIUrl(APIConstant.YEARVOLUME_SAVE), model);
     return result;
 }
Beispiel #13
0
 /// <summary>
 /// 年是否存在
 /// </summary>
 /// <param name="yearVolumeEntity"></param>
 /// <returns></returns>
 public bool YearVolumeYearIsExists(YearVolumeEntity yearVolumeEntity)
 {
     return IssueBusProvider.YearVolumeYearIsExists(yearVolumeEntity);
 }
Beispiel #14
0
 /// <summary>
 /// 编辑年卷
 /// </summary>
 /// <param name="yearVolumeEntity"></param>
 /// <returns></returns>
 public bool UpdateYearVolume(YearVolumeEntity yearVolumeEntity)
 {
     return IssueBusProvider.UpdateYearVolume(yearVolumeEntity);
 }
Beispiel #15
0
 /// <summary>
 /// 保存年卷设置
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public ExecResult SaveYearVolume(YearVolumeEntity model)
 {
     ExecResult execResult = new ExecResult();
     if (YearVolumeYearIsExists(model))
     {
         execResult.result = EnumJsonResult.failure.ToString();
         execResult.msg = "该年信息已经存在!";
         return execResult;
     }
     if (YearVolumeVolumeIsExists(model))
     {
         execResult.result = EnumJsonResult.failure.ToString();
         execResult.msg = "该卷信息已经存在!";
         return execResult;
     }
     bool result = false;
     if (model.SetID == 0)
         result = AddYearVolume(model);
     else
         result = UpdateYearVolume(model);
     if (result)
     {
         execResult.result = EnumJsonResult.success.ToString();
         execResult.msg = "保存年卷设置成功!";
     }
     else
     {
         execResult.result = EnumJsonResult.failure.ToString();
         execResult.msg = "保存年卷设置失败!";
     }
     return execResult;
 }
Beispiel #16
0
 /// <summary>
 /// 新增年卷
 /// </summary>
 /// <param name="yearVolumeEntity"></param>
 /// <returns></returns>
 public bool AddYearVolume(YearVolumeEntity yearVolumeEntity)
 {
     return IssueBusProvider.AddYearVolume(yearVolumeEntity);
 }