예제 #1
0
        /// <summary>
        /// 取得个人最后消费记录
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public ConsumeRecord_csr_Info GetLastRecord(ConsumeRecord_csr_Info query)
        {
            try
            {
                return this._icmDA.GetLastRecord(query);
            }
            catch (Exception Ex)
            {

                throw Ex;
            }
        }
예제 #2
0
 public Model.General.ReturnValueInfo InsertRecord(ConsumeRecord_csr_Info infoObject)
 {
     throw new NotImplementedException();
 }
예제 #3
0
        /// <summary>
        /// 显示查询结果
        /// </summary>
        private void ShowRecord()
        {
            _showList = new List<ViewInfo>();

            try
            {
                this.lblRecordAmount.Text = "0";
                this.lvList.Items.Clear();

                DateTime startTime = DateTime.Parse(dtpDateFrom.Value.ToString("yyyy/MM/dd"));
                DateTime endTime = DateTime.Parse(dtpDateTo.Value.ToString("yyyy/MM/dd"));

                if (startTime > endTime)
                {
                    base.MessageDialog("提示", "开始时间要小于结束时间!");
                    return;
                }

                System.TimeSpan ts = endTime.Subtract(startTime);//TimeSpan得到dt1和dt2的时间间隔
                int countDays = ts.Days;//相隔天数
                if (countDays > 60)
                {
                    base.MessageDialog("提示", "最多只能查询前后60天的记录!");
                    startTime = startTime.AddDays(60);
                    this.dtpDateTo.Value = startTime;
                    return;
                }

                CardUserAccount_cua_Info cuaInfo = new CardUserAccount_cua_Info();
                cuaInfo.cua_cCUSID = _userID;
                cuaInfo = _icuaBL.SearchRecords(cuaInfo).FirstOrDefault() as CardUserAccount_cua_Info;

                CardUserAccountDetail_cuad_Info cuadInfo = new CardUserAccountDetail_cuad_Info();
                cuadInfo.cuad_cCUAID = cuaInfo.cua_cRecordID;
                cuadInfo.OptTime_From = startTime;
                cuadInfo.OptTime_To = endTime.AddDays(1);

                List<CardUserAccountDetail_cuad_Info> infoList = _icuadBL.SearchRecords(cuadInfo);

                if (infoList != null)
                {
                    infoList = infoList.OrderByDescending(x => x.cuad_dOptTime).ToList();

                    int rowNo = 1;

                    for (int index = 0; index < infoList.Count; index++)
                    {
                        cuadInfo = infoList[index] as CardUserAccountDetail_cuad_Info;

                        ViewInfo vi = new ViewInfo();
                        vi.index = rowNo;
                        vi.times = cuadInfo.cuad_dOptTime.ToString("yyyy/MM/dd");
                        vi.cost = cuadInfo.cuad_fFlowMoney.ToString();
                        vi.type = cuadInfo.cuad_cFlowType;

                        try
                        {
                            //PreConsumeRecord_pcs_Info pcsinfo = new PreConsumeRecord_pcs_Info();
                            //pcsinfo.pcs_cRecordID = (Guid)cuadInfo.cuad_cConsumeID;
                            //pcsinfo = _ipcrBL.DisplayRecord(pcsinfo);

                            //if (pcsinfo != null)
                            //{
                            //    vi.mealTime = pcsinfo.pcs_dConsumeDate.ToString("yyyy/MM/dd HH:mm:ss");
                            //}
                            //else
                            //{
                            //    vi.mealTime = cuadInfo.cuad_dOptTime.ToString("yyyy/MM/dd HH:mm:ss");
                            //}

                            ConsumeRecord_csr_Info csrInfo = new ConsumeRecord_csr_Info();
                            csrInfo.csr_cRecordID = (Guid)cuadInfo.cuad_cConsumeID;
                            csrInfo = _IConsumeRecordBL.DisplayRecord(csrInfo);
                            if (csrInfo != null)
                            {
                                vi.mealTime = csrInfo.csr_dConsumeDate.ToString("yyyy/MM/dd HH:mm:ss");
                            }
                            else
                            {
                                PreConsumeRecord_pcs_Info pcsinfo = new PreConsumeRecord_pcs_Info();
                                pcsinfo.pcs_cRecordID = (Guid)cuadInfo.cuad_cConsumeID;
                                pcsinfo = _ipcrBL.DisplayRecord(pcsinfo);

                                if (pcsinfo != null)
                                {
                                    vi.mealTime = pcsinfo.pcs_dConsumeDate.ToString("yyyy/MM/dd HH:mm:ss");
                                }
                                else
                                {
                                    vi.mealTime = cuadInfo.cuad_dOptTime.ToString("yyyy/MM/dd HH:mm:ss");
                                }
                            }
                        }
                        catch
                        {

                        }
                        if (cuadInfo.MacNo != null)
                        {
                            vi.CostType = cuadInfo.MacNo.ToString() + "号机";
                        }
                        else
                        {
                            vi.CostType = "系统补扣";
                        }

                        SetShowViewInfo(vi, _showList);
                        //_showList.Add(vi);

                        rowNo = _showList.Count + 1;
                    }
                }

                if (_showList.Count == 0)
                {
                    if (startTime == endTime && startTime == DateTime.Parse(System.DateTime.Now.ToString("yyyy/MM/dd")))
                    {
                        base.MessageDialog("提示", "今天内无消费记录!");
                    }
                    else
                    {
                        base.MessageDialog("提示", "查找时间内无消费记录!");
                    }
                }

                this.lblRecordAmount.Text = _showList.Count.ToString();
            }
            catch
            {

            }
            finally
            {
                //計算最大頁數
                if (_showList != null)
                {
                    _MaxPage = _showList.Count / _PageSize;

                    if (_showList.Count % _PageSize != 0)
                    {
                        _MaxPage++;
                    }

                    if (_MaxPage == 0)
                    {
                        _PageIndex = 0;
                    }
                    else
                    {
                        if (_PageIndex == 0)
                        {
                            _PageIndex = 1;
                        }
                    }

                    ShowList();//顯示內容
                }
                SetUpDownBtnStatus();
            }
        }
예제 #4
0
        /// <summary>
        /// 取得个人最后消费记录
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public ConsumeRecord_csr_Info GetLastRecord(ConsumeRecord_csr_Info query)
        {
            if (query != null)
            {
                try
                {
                    using (SIOTSDB_HHZXDataContext db = new SIOTSDB_HHZXDataContext())
                    {
                        IEnumerable<ConsumeRecord_csr> searchRecord = (from t in db.ConsumeRecord_csr
                                                                       where t.csr_cCardUserID == query.csr_cCardUserID && t.csr_dConsumeDate <= query.csr_dConsumeDate
                                                                       orderby t.csr_dConsumeDate descending
                                                                       select t);

                        if (searchRecord != null && searchRecord.Count() > 0)
                        {
                            ConsumeRecord_csr info = searchRecord.First();

                            query = Common.General.CopyObjectValue<ConsumeRecord_csr, ConsumeRecord_csr_Info>(info);
                        }
                        else
                        {
                            query = null;
                        }
                    }
                }
                catch (Exception Ex)
                {

                    throw Ex;
                }
            }

            return query;
        }