Esempio n. 1
0
 /// <summary>
 /// 新增招揽信息
 /// </summary>
 /// <param name="solicitInfo">招揽信息</param>
 public void Add(SolicitInfo solicitInfo)
 {
     try
     {
         solicit.Add(solicitInfo);
     }
     catch (Exception ex)
     {
         BusinessExceptionHandler.HandlerException("新增招揽信息失败!", ex);
     }
 }
Esempio n. 2
0
        /// <summary>
        /// 新增招揽信息
        /// </summary>
        /// <param name="solicitInfo">招揽信息对象</param>
        public void Add(SolicitInfo solicitInfo)
        {
            string commandText = "INSERT INTO Solicit(Id,BizId,CustomerId,CarId,ActivityCode,EstimateDate,"
                + "Content,Feedback,Solicitor,SolicitDate,Result,Status,CreateDate,Creator,UpdateDate,Updater,"
                + "Valid) VALUES(@Id,@BizId,@CustomerId,@CarId,@ActivityCode,@EstimateDate,@Content,@Feedback,"
                + "@Solicitor,@SolicitDate,@Result,@Status,@CreateDate,@Creator,@UpdateDate,@Updater,@Valid)";

            try
            {
                base.Execute(commandText, connectionString: CarManageConfig.Instance.ConnectionString,
                    param: solicitInfo);
            }
            catch (Exception ex)
            {
                DataAccessExceptionHandler.HandlerException("新增招揽信息失败!", ex);
            }
        }
Esempio n. 3
0
 /// <summary>
 /// 更新招揽信息
 /// </summary>
 /// <param name="solicitInfo">招揽信息信息对象</param>
 public void Update(SolicitInfo solicitInfo)
 {
     try
     {
         solicit.Update(solicitInfo);
     }
     catch (Exception ex)
     {
         BusinessExceptionHandler.HandlerException("更新招揽信息失败!", ex);
     }
 }
Esempio n. 4
0
        /// <summary>
        /// 查询招揽信息
        /// </summary>
        /// <returns>招揽信息集合</returns>
        public List<SolicitInfo> Search(SolicitInfo queryInfo)
        {
            List<SolicitInfo> solicitList = new List<SolicitInfo>();

            try
            {
                solicitList = solicit.Search(queryInfo);
            }
            catch (Exception ex)
            {
                BusinessExceptionHandler.HandlerException("查询招揽信息失败!", ex);
            }

            return solicitList;
        }
Esempio n. 5
0
        /// <summary>
        /// 更新招揽信息
        /// </summary>
        /// <param name="solicitInfo">招揽信息对象</param>
        public void Update(SolicitInfo solicitInfo)
        {
            string commandText = "UPDATE Solicit SET "
                + "BizId=@BizId,CustomerId=@CustomerId,CarId=@CarId,ActivityCode=@ActivityCode,EstimateDate=@EstimateDate,"
                + "Content=@Content,Feedback=@Feedback,Solicitor=@Solicitor,SolicitDate=@SolicitDate,Result=@Result,"
                + "Status=@Status,CreateDate=@CreateDate,Creator=@Creator,UpdateDate=@UpdateDate,Updater=@Updater,"
                + "Valid=@Valid WHERE Id=@Id";

            try
            {
                base.Execute(commandText, connectionString: CarManageConfig.Instance.ConnectionString,
                    param: solicitInfo);
            }
            catch (Exception ex)
            {
                DataAccessExceptionHandler.HandlerException("更新招揽信息失败!", ex);
            }
        }
Esempio n. 6
0
        /// <summary>
        /// 获得所有招揽信息集合
        /// </summary>
        /// <returns>招揽信息集合</returns>
        public List<SolicitInfo> Search(SolicitInfo queryInfo)
        {
            IDbConnection connection = null;

            List<SolicitInfo> solicitList = new List<SolicitInfo>();

            try
            {
                string field = "*";

                string table = "Solicit";
                string order = "ORDER BY Id";

                StringBuilder filter = new StringBuilder();

                #region 查询条件

                #endregion

                string filterText = string.Empty;

                if (filter.Length > 0)
                {
                    filterText = filter.ToString().TrimStart(' ').Remove(0, 3).Insert(0, " WHERE ");
                }

                string commandText = string.Format("SELECT COUNT(*) FROM Solicit {0}", filterText);

                connection = base.CreateConnection(CarManageConfig.Instance.ConnectionString);

                queryInfo.TotalCount = base.ExecuteObject<int>(commandText: commandText,
                    connection: connection, param: queryInfo);

                if (queryInfo.TotalCount.Equals(0))
                    return solicitList;

                int pageCount = queryInfo.TotalCount / queryInfo.PageSize + 1;

                if (queryInfo.TotalCount % queryInfo.PageSize != 0)
                    pageCount++;

                int startIndex = queryInfo.PageIndex * queryInfo.PageSize;

                commandText = string.Format("SELECT {0} FROM {1} WHERE {2} ORDER BY {3} LIMIT {4},{5}",
                    field, table, filterText, order, startIndex, queryInfo.PageSize);

                solicitList = base.Query<SolicitInfo>(commandText, connection, param: queryInfo).ToList();
            }
            catch (Exception ex)
            {
                DataAccessExceptionHandler.HandlerException(
                    "查询招揽信息失败!", ex);
            }
            finally
            {
                CloseConnection(connection);
            }

            return solicitList;
        }