private void PREBusinessesComboBox_TextChanged(object sender, EventArgs e) { listbox1.Visible = false; if (!this.Parent.Controls.Contains(listbox1)) { this.Parent.Controls.Add(listbox1); } listbox1.Width = this.Width; listbox1.Location = new System.Drawing.Point(this.Left, this.Top + this.Height); if (string.IsNullOrEmpty(this.Text)) { return; } PreferentialReportSearchCondition con = new PreferentialReportSearchCondition(); con.BusinessName = this.Text; PREBusinessesBll bll = new PREBusinessesBll(AppSettings.CurrentSetting.ParkConnect); List <PREBusinesses> items = bll.GetBusinesses(con).QueryObjects; if (items.Count > 0) { listbox1.DataSource = items; listbox1.ValueMember = "BusinessesID"; listbox1.DisplayMember = "BusinessesName"; listbox1.Visible = true; listbox1.BringToFront(); } }
private void ItemSearching_Handler(object sender, EventArgs e) { PreferentialReportSearchCondition con = new PreferentialReportSearchCondition(); con.RecordDateTimeRange = new DateTimeRange(); con.RecordDateTimeRange.Begin = this.ucDateTimeInterval1.StartDateTime; con.RecordDateTimeRange.End = this.ucDateTimeInterval1.EndDateTime; con.CardID = this.txtCardID.Text.Trim(); con.BusinessName = this.cmbBusiness.Text.Trim(); con.StationIDs = this.txtWorkstations.Tag as List <string>; con.OperatorNames = this.txtOperators.Tag as List <string>; //附加查询条件 con.CancelReason = this.txtCancelReason.Text.Trim(); if (!string.IsNullOrEmpty(this.txtHour.Text)) { try { con.Hour = Convert.ToInt32(this.txtHour.Text.Trim()); } catch { } } QueryResultList <PREPreferentialLog> result = _LogBLL.GetPreferentials(con); if (result.Result == ResultCode.Successful) { ShowReportsOnGrid(result.QueryObjects); } else { MessageBox.Show(result.Message); } }
protected override List <object> GetDataSource() { PreferentialReportSearchCondition con = new PreferentialReportSearchCondition(); con.BusinessName = this.txtBusinessesName.Text.Trim(); PREBusinessesBll busBll = new PREBusinessesBll(AppSettings.CurrentSetting.ParkConnect); businesses = busBll.GetBusinesses(con).QueryObjects.ToList(); List <object> source = new List <object>(); foreach (object o in businesses) { source.Add(o); } return(source); }
protected override List <PREPreferentialLog> GetingItems(ParkDataContext parking, SearchCondition search) { if (search is PreferentialReportSearchCondition) { PreferentialReportSearchCondition con = search as PreferentialReportSearchCondition; DataLoadOptions opt = new DataLoadOptions(); opt.LoadWith <PREPreferentialLog>(o => o.Operator); parking.LoadOptions = opt; IQueryable <PREPreferentialLog> result = parking.PREPreferentialLog.AsQueryable(); if (con.RecordDateTimeRange != null) { result = result.Where(o => o.OperatorTime >= con.RecordDateTimeRange.Begin).AsQueryable(); result = result.Where(o => o.OperatorTime <= con.RecordDateTimeRange.End).AsQueryable(); } if (!string.IsNullOrEmpty(con.CardID)) { result = result.Where(o => o.CardID.IndexOf(con.CardID) != -1); } if (!string.IsNullOrEmpty(con.BusinessName)) { result = result.Where(o => o.BusinessesName1 == con.BusinessName || o.BusinessesName2 == con.BusinessName || o.BusinessesName3 == con.BusinessName); } if (!string.IsNullOrEmpty(con.CancelReason)) { result = result.Where(o => o.CancelReason.IndexOf(con.CancelReason) != -1); } if (con.Hour != null) { result = result.Where(o => o.PreferentialHour == con.Hour); } if (con.StationIDs != null && con.StationIDs.Count > 0) { result = result.Where(c => con.StationIDs.Contains(c.WorkstationName)); } if (con.OperatorNames != null && con.OperatorNames.Count > 0) { result = result.Where(c => con.OperatorNames.Contains(c.Operator.OperatorName)); } return(result.ToList()); } else { return(new List <PREPreferentialLog>()); } }
protected override List <PREBusinesses> GetingItems(ParkDataContext parking, SearchCondition search) { if (search is PreferentialReportSearchCondition) { PreferentialReportSearchCondition con = search as PreferentialReportSearchCondition; IQueryable <PREBusinesses> result = parking.PREBusinesses.AsQueryable(); if (!string.IsNullOrEmpty(con.BusinessName)) { result = result.Where(o => o.BusinessesName.IndexOf(con.BusinessName) != -1);//相当于%A% } return(result.ToList()); } else { return(new List <PREBusinesses>()); } }
/// <summary> /// 导出优惠记录到Excel中,并直接打印出来 /// </summary> /// <param name="preLog"></param> public void PrintByExcel(PREPreferentialLog preLog) { PreferentialReportSearchCondition recordCon = new PreferentialReportSearchCondition(); recordCon.CardID = preLog.CardID; Application app = new Application(); Workbook book = null; book = app.Workbooks.Add(ReportModal); Worksheet sheet = book.ActiveSheet as Worksheet; FillPreferentialLog(sheet, preLog, 3); PREPreferentialLogBll bll = new PREPreferentialLogBll(AppSettings.CurrentSetting.ParkConnect); List <PREPreferentialLog> logs = bll.GetPreferentials(recordCon).QueryObjects; FillDetail(sheet, logs, 6); sheet.PrintOutEx(Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing); book.Close(false, Type.Missing, Type.Missing); }
public QueryResultList <PREBusinesses> GetBusinesses(PreferentialReportSearchCondition search) { return(provider.GetItems(search)); }
/// <summary> /// 根据查询条件获取优惠信息 /// </summary> public QueryResultList <PREPreferentialLog> GetPreferentials(PreferentialReportSearchCondition search) { return(provider.GetItems(search)); }