/// <summary>
        /// 保存数据
        /// </summary>
        /// <param name="baseFilter"></param>
        /// <param name="responseEntity"></param>
        public void SaveData(BaseFilter baseFilter, ResponseEntity responseEntity)
        {
            var filter = baseFilter as ClearLoanReasonSaveFilter;

            if (filter == null)
            {
                ServiceUtility.SetResponseStatus(responseEntity, EnumResponseState.RequestCommandError);
                return;
            }

            var searchFilter = new ClearLoanReasonSearchFilter();

            searchFilter.ContractNo = filter.ContractNo;

            var lstResult = Singleton <ClearLoanReasonSearchDAL <ClearLoanReasonSearchViewData> >
                            .Instance.SearchData(searchFilter);

            if (lstResult == null || lstResult.Count == 0)
            {
                ServiceUtility.SetResponseStatus(responseEntity, EnumResponseState.Others, "内部异常");
                m_Logger.Info("内部异常。");
                return;
            }
            else
            {
                var business = lstResult[0];

                if (business.ClearLoanType == filter.ClearLoanType &&
                    business.ClearLoanRemark == filter.ClearLoanRemark)
                {
                    ServiceUtility.SetResponseStatus(responseEntity
                                                     , EnumResponseState.Others, "未更改原因,请更改原因后保存。");
                    m_Logger.Info("未更改原因,请更改原因后保存。");
                    return;
                }

                filter.BusinessId = business.BusinessID;
                int ret = Singleton <ClearLoanReasonSaveDAL> .Instance.Update(filter);

                if (ret > 0)
                {
                    var responseResult = new ResponseListResult <ClearLoanReasonSearchViewData>();
                    responseResult.TotalCount = 1;
                    responseResult.LstResult  = lstResult;

                    ServiceUtility.SetResponseStatus(responseEntity, EnumResponseState.Success);
                    responseEntity.Results = responseResult;
                }
                else
                {
                    ServiceUtility.SetResponseStatus(responseEntity, EnumResponseState.Others, "更新失败。");
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 根据过滤条件,返回检索数据的Sql文
        /// </summary>
        /// <param name="baseFilter"></param>
        /// <returns></returns>
        protected override string GetSearchSql(BaseFilter baseFilter)
        {
            ClearLoanReasonSearchFilter filter = baseFilter as ClearLoanReasonSearchFilter;

            if (filter == null)
            {
                return("");
            }

            StringBuilder sb = new StringBuilder();

            sb.Append(" SELECT BillID");
            sb.Append("       ,BusinessID");
            //sb.Append("       ,CustomerID");
            sb.Append("       ,BillType");
            sb.Append("       ,BillStatus");
            sb.Append("       ,BillMonth");
            sb.Append("       ,CompanyKey");
            sb.Append("       ,BeginTime");
            sb.Append("       ,EndTime");
            sb.Append("       ,LimitTime");
            sb.Append("       ,CreateTime");
            //sb.Append("       ,OperatorID");
            sb.Append("       ,IsCurrent");
            sb.Append("       ,FullPaidTime");
            sb.Append("       ,IsShelve");
            //sb.Append("       ,DeductionID");
            //sb.Append("       ,IsFixed");
            sb.Append("       ,DueDate");
            sb.Append(" FROM dbo.Bill WITH (NOLOCK)");

            if (filter != null)
            {
                sb.Append(" WHERE BusinessID IN ('" + filter.BusinessIds + "')");
            }
            sb.Append(" ORDER BY BillID");

            return(sb.ToString());
        }
        /// <summary>
        /// 根据过滤条件,返回检索数据的Sql文
        /// </summary>
        /// <param name="baseFilter"></param>
        /// <returns></returns>
        protected override string GetSearchSql(BaseFilter baseFilter)
        {
            ClearLoanReasonSearchFilter filter = baseFilter as ClearLoanReasonSearchFilter;

            if (filter == null)
            {
                return("");
            }

            StringBuilder sb = new StringBuilder();

            sb.Append(" SELECT BillItemID");
            sb.Append("       ,BillID");
            sb.Append("       ,Subject");
            sb.Append("       ,DueDate");
            sb.Append("       ,Amount");
            sb.Append("       ,DueAmt");
            sb.Append("       ,ReceivedAmt");
            sb.Append("       ,CreateTime");
            sb.Append("       ,FullPaidTime");
            sb.Append("       ,Overdue");
            sb.Append("       ,SubjectType");
            sb.Append("       ,IsCurrent");
            sb.Append("       ,IsShelve");
            sb.Append("       ,BusinessID");
            sb.Append("       ,PenaltyIntAmt");
            sb.Append(" FROM dbo.BillItem WITH (NOLOCK)");
            sb.Append(" WHERE BillID IN (SELECT BillID FROM dbo.Bill ");

            if (filter != null)
            {
                sb.Append(" WHERE BusinessID IN ('" + filter.BusinessIds + "'))");
            }

            return(sb.ToString());
        }