private void ShowButton_Click(object sender, EventArgs e) { try { stiViewerControl1.Visible = false; CarAllTrafficfoGridView.Visible = true; if ((string.IsNullOrEmpty(NumberPlate_nvcTextBox.Text) && string.IsNullOrEmpty(SerialPlate_nvcTextBox.Text)) && string.IsNullOrEmpty(CarCardNumber_nvcTextBox.Text)) { throw new ApplicationException("لطفاً شماره کامیون یا کارت هوشمند را وارد نمایید"); } //HPS.Reports.ReportDoc.CarAllTrafficReport rpt = new HPS.Reports.ReportDoc.CarAllTrafficReport(FromDatefaDatePicker.Text, ToDatefaDatePicker.Text, NumberPlate_nvcTextBox.Text, SerialPlate_nvcTextBox.Text, CarCardNumber_nvcTextBox.Text); //CarAllTrafficfoGridView.DataSource = rpt.DataSource; //rpt.Document.Printer.PrinterName = string.Empty; //viewer1.Document = rpt.Document; //rpt.Run(); string TrafficCondition = string.Empty; if (!string.IsNullOrEmpty(NumberPlate_nvcTextBox.Text) && !string.IsNullOrEmpty(SerialPlate_nvcTextBox.Text)) { TrafficCondition += string.Format(" T.NumberPlate_nvc='{0}' AND T.SerialPlate_nvc='{1}' ", NumberPlate_nvcTextBox.Text, SerialPlate_nvcTextBox.Text); if (!string.IsNullOrEmpty(CarCardNumber_nvcTextBox.Text)) { TrafficCondition += string.Format(" AND T.CarCardNumber_nvc={0} ", CarCardNumber_nvcTextBox.Text); } } else if (!string.IsNullOrEmpty(CarCardNumber_nvcTextBox.Text)) { TrafficCondition += string.Format(" T.CarCardNumber_nvc={0} ", CarCardNumber_nvcTextBox.Text); } if (!FromDatefaDatePicker.IsNull && !ToDatefaDatePicker.IsNull) { TrafficCondition += string.Format(" AND T.Date_nvc>='{0}' AND T.Date_nvc<='{1}' ", FromDatefaDatePicker.Text, ToDatefaDatePicker.Text); } BLL.TrafficBLL.BLLTraffic_TFactory TrafficFactory = new BLL.TrafficBLL.BLLTraffic_TFactory(); DataTable TraficTable = new DataTable(); TrafficFactory.GetAllByConditionAllTraffic(TrafficCondition, ref TraficTable); CarAllTrafficfoGridView.DataSource = TraficTable; } catch (Exception ex) { Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message); } }
private void ShowButton_Click(object sender, EventArgs e) { BLL.TrafficBLL.BLLTraffic_TFactory factory = new BLL.TrafficBLL.BLLTraffic_TFactory(); DT.DataTable dt; try { if (FromDatefaDatePicker.IsNull) { throw new ApplicationException("از تاریخ خالی است"); } else if (ToDatefaDatePicker.IsNull) { throw new ApplicationException("تا تاریخ خالی است"); } else if (string.IsNullOrEmpty(Hepsa.Core.Common.PersentationController.GetMaskedTextBoxValue(FromTimeTextBox))) { throw new ApplicationException("از ساعت خالی است"); } else if (string.IsNullOrEmpty(Hepsa.Core.Common.PersentationController.GetMaskedTextBoxValue(ToTimeTextBox))) { throw new ApplicationException("تا ساعت خالی است"); } Hepsa.Core.Validation.TimeRule <string> FromTimeValidator = new Hepsa.Core.Validation.TimeRule <string>("FromTime", "از ساعت", null, null); if (FromTimeValidator.Validate(Hepsa.Core.Common.PersentationController.GetMaskedTextBoxValue(FromTimeTextBox)) == false) { throw new ApplicationException(FromTimeValidator.Description); } Hepsa.Core.Validation.TimeRule <string> ToTimeValidator = new Hepsa.Core.Validation.TimeRule <string>("ToTime", "تا ساعت", null, null); if (ToTimeValidator.Validate(Hepsa.Core.Common.PersentationController.GetMaskedTextBoxValue(ToTimeTextBox)) == false) { throw new ApplicationException(ToTimeValidator.Description); } Hepsa.Core.Validation.DateRule <string> FromDateValidator = new Hepsa.Core.Validation.DateRule <string>("FromDate", "از تاریخ", null, null); if (FromDateValidator.Validate(FromDatefaDatePicker.Text) == false) { throw new ApplicationException(FromDateValidator.Description); } Hepsa.Core.Validation.DateRule <string> ToDateValidator = new Hepsa.Core.Validation.DateRule <string>("ToDate", "تا تاریخ", null, null); if (ToDateValidator.Validate(ToDatefaDatePicker.Text) == false) { throw new ApplicationException(ToDateValidator.Description); } if (_TrafficType == 1) { string Turn = string.Empty; if (TurnAcceptedradioButton.Checked == true) { Turn = "Traffic_T.TurnAccepted_bit=1 "; } else if (AllTurnradioButton.Checked == true) { Turn = "Traffic_T.TurnAccepted_bit IS NULL"; } if (!string.IsNullOrEmpty(Turn)) { Turn += " AND "; } Turn += " Traffic_T.TrafficNumber_bint NOT IN (SELECT trafficNumber_bint FROM Traffic_T WHERE Traffic_T.Out_bit = 1 AND (Traffic_T.Date_nvc + ' ' + Traffic_T.Time_nvc >= '" + FromDatefaDatePicker.Text + " " + ToDatefaDatePicker.Text + "') AND (Traffic_T.Date_nvc + ' ' + Traffic_T.Time_nvc <='" + FromDatefaDatePicker.Text + " " + ToDatefaDatePicker.Text + "') ) AND Traffic_T.TrafficNumber_bint NOT IN (SELECT trafficNumber_bint FROM Traffic_T WHERE Traffic_T.TemporaryOut_bit = 1 AND (Traffic_T.Date_nvc + ' ' + Traffic_T.Time_nvc >= '" + FromDatefaDatePicker.Text + " " + ToDatefaDatePicker.Text + "') AND (Traffic_T.Date_nvc + ' ' + Traffic_T.Time_nvc <='" + FromDatefaDatePicker.Text + " " + ToDatefaDatePicker.Text + "')) AND "; //HPS.Reports.ReportDoc.IranianInTrafficReport rpt = new HPS.Reports.ReportDoc.IranianInTrafficReport(FromDatefaDatePicker.Text, ToDatefaDatePicker.Text, "1", FromTimeTextBox.Text, ToTimeTextBox.Text, FromTrafficNumbertxt.Text, ToTrafficNumbertxt.Text, // Convert.ToString(LaderPivotGroupID_intComboBox.SelectedValue), Convert.ToString(LaderTypeID_intComboBox.SelectedValue), Convert.ToString(ServicescomboBox.SelectedValue), Turn); //rpt.Document.Printer.PrinterName = string.Empty; //viewer1.Document = rpt.Document; //rpt.Run(); IranianInTrafficstiReport.Dictionary.Synchronize(); IranianInTrafficstiReport.Dictionary.Databases.Clear(); IranianInTrafficstiReport.Dictionary.Databases.Add(new Stimulsoft.Report.Dictionary.StiSqlDatabase("Connection", Hepsa.Core.Common.ConnectionString.ConnectionString)); IranianInTrafficstiReport.Compile(); IranianInTrafficstiReport["organ"] = new HPS.BLL.SettingsBLL.BLLSetting_TFactory().GetBy(new BLL.SettingsBLL.BLLSetting_TKeys() { SettingID_int = 1029 }).Value_nvc.ToString(); HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory PortPlaceFactory = new HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory(); IranianInTrafficstiReport["fromdate_vc"] = FromDatefaDatePicker.Text; IranianInTrafficstiReport["todate_vc"] = ToDatefaDatePicker.Text; IranianInTrafficstiReport["date_vc"] = PortPlaceFactory.ServerJalaliDate + " " + PortPlaceFactory.ServerTime;; IranianInTrafficstiReport["UserName_vc"] = HPS.Common.CurrentUser.user.UserName_nvc; IranianInTrafficstiReport["fromTrafficNumber"] = FromTrafficNumbertxt.Text; IranianInTrafficstiReport["toTrafficNumber"] = ToTrafficNumbertxt.Text; IranianInTrafficstiReport["FromTime_vc"] = FromTimeTextBox.Text; IranianInTrafficstiReport["ToTime_vc"] = ToTimeTextBox.Text; if (string.IsNullOrEmpty(FromDatefaDatePicker.Text)) { IranianInTrafficstiReport["@FromDateTime_nvc"] = DBNull.Value; } else { IranianInTrafficstiReport["@FromDateTime_nvc"] = FromDatefaDatePicker.Text + ' ' + FromTimeTextBox.Text; } if (string.IsNullOrEmpty(ToDatefaDatePicker.Text)) { IranianInTrafficstiReport["@ToDateTime_nvc"] = DBNull.Value; } else { IranianInTrafficstiReport["@ToDateTime_nvc"] = ToDatefaDatePicker.Text + ' ' + ToTimeTextBox.Text; } if (string.IsNullOrEmpty(FromTrafficNumbertxt.Text)) { IranianInTrafficstiReport["@FromTrafficNumber_nvc"] = DBNull.Value; } else { IranianInTrafficstiReport["@FromTrafficNumber_nvc"] = FromTrafficNumbertxt.Text; } if (string.IsNullOrEmpty(ToTrafficNumbertxt.Text)) { IranianInTrafficstiReport["@ToTrafficNumber_nvc"] = DBNull.Value; } else { IranianInTrafficstiReport["@ToTrafficNumber_nvc"] = ToTrafficNumbertxt.Text; } if (LaderPivotGroupID_intComboBox.SelectedValue == null) { IranianInTrafficstiReport["@LaderPivotGroupID_nvc"] = DBNull.Value; } else { IranianInTrafficstiReport["@LaderPivotGroupID_nvc"] = LaderPivotGroupID_intComboBox.SelectedValue; } //@LaderTypeID_nvc if (LaderTypeID_intComboBox.SelectedValue == null) { IranianInTrafficstiReport["@LaderTypeID_nvc"] = DBNull.Value; } else { IranianInTrafficstiReport["@LaderTypeID_nvc"] = LaderTypeID_intComboBox.SelectedValue; } //@ServiceID_nvc if (ServicescomboBox.SelectedValue == null) { IranianInTrafficstiReport["@ServiceID_nvc"] = DBNull.Value; } else { IranianInTrafficstiReport["@ServiceID_nvc"] = ServicescomboBox.SelectedValue; } // @TrafficTypeID_nvc , IranianInTrafficstiReport["@TrafficTypeID_nvc"] = 1; IranianInTrafficstiReport["@TrafficInbit_nvc"] = 1; IranianInTrafficstiReport["@TrafficOutbit_nvc"] = DBNull.Value; IranianInTrafficstiReport["@TurnAccepted_nvc"] = Turn; if (LaderPivotGroupID_intComboBox.SelectedValue != null) { if (Convert.ToInt32(LaderPivotGroupID_intComboBox.SelectedValue) == 1) { IranianInTrafficstiReport["PivotGrouptxt"] = "(دو محور)"; } else if (Convert.ToInt32(LaderPivotGroupID_intComboBox.SelectedValue) == 2) { IranianInTrafficstiReport["PivotGrouptxt"] = "(سه محور به بالا)"; } } else { IranianInTrafficstiReport["PivotGrouptxt"] = "(تمامی کامیون ها)"; } if (LaderTypeID_intComboBox.SelectedValue != null) { IranianInTrafficstiReport["PivotGrouptxt"] = (string)Hepsa.Core.Common.PersentationController.GetComboBoxDisplayMember(this.LaderTypeID_intComboBox); } IranianInTrafficstiReport.Render(); stiViewerControl1.Report = IranianInTrafficstiReport; dt = new DT.DataTable(); ExportExcelDt = new System.Data.DataTable(); factory.ReportSelectByFieds( IranianInTrafficstiReport["@FromDateTime_nvc"], IranianInTrafficstiReport["@ToDateTime_nvc"], IranianInTrafficstiReport["@FromTrafficNumber_nvc"], IranianInTrafficstiReport["@ToTrafficNumber_nvc"], IranianInTrafficstiReport["@LaderPivotGroupID_nvc"], IranianInTrafficstiReport["@LaderTypeID_nvc"], IranianInTrafficstiReport["@TrafficTypeID_nvc"], IranianInTrafficstiReport["@TrafficInbit_nvc"], IranianInTrafficstiReport["@TrafficOutbit_nvc"], IranianInTrafficstiReport["@ServiceID_nvc"], Turn, ref dt); Dictionary <string, string> Columns = new Dictionary <string, string>(); Columns.Add("TrafficNumber_bint", "شماره قبض"); Columns.Add("TurnNumber_bint", "شماره نوبت"); Columns.Add("DriverCardNumber_nvc", "شماره کارت راننده "); Columns.Add("carCardNumber_nvc", "شماره کارت ناوگان"); Columns.Add("FirstName_nvc", "نام راننده"); Columns.Add("LastName_nvc", "نام خانوادگی راننده"); Columns.Add("NumberPlate_nvc", "شماره پلاک"); Columns.Add("UserName_nvc", "کاربر"); Columns.Add("Date_nvc", "تاریخ ورود"); Columns.Add("Time_nvc", "زمان ورود"); Columns.Add("EditUserName_nvc", "کاربر تایید کننده"); Columns.Add("TurnDate_nvc", "ترایخ نوبت"); Columns.Add("TurnTime_nvc", "زمان نوبت"); Columns.Add("PriceNoTax_dec", "مبلغ"); Columns.Add("PriceTax_dec", "ارزش افزوده"); Columns.Add("Price_dec", "مبلغ دریافتی"); Columns.Add("WithLade_bit", "با بار"); Columns.Add("ServiceID_intServiceType_nvc", "مراجعه به"); foreach (var col in Columns) { ExportExcelDt.Columns.Add(col.Value, col.Key.EndsWith("_bit") ? typeof(bool) : typeof(string)); } DataRow dr; for (int i = 0; i <= dt.Rows.Count - 1; i++) { dr = ExportExcelDt.NewRow(); for (int j = 0; j < Columns.Count; j++) { dr[j] = dt.Rows[i][Columns.Keys.ElementAt(j)]; } ExportExcelDt.Rows.Add(dr); } //gridControl1.DataSource = dt; //gridView1.Columns.Clear(); ////gridView1.PopulateColumns(); //GridColumn column; //int x = 0; //foreach (DataColumn i in dt.Columns) //{ // x++; // if (x == 6) // break; // column = new GridColumn() { FieldName = i.ColumnName,Width = 200,MinWidth = 200,MaxWidth = 200}; // Columns.Add(); //} //gridView1.PopulateColumns(Columns); //gridView1.RefreshData(); //foreach (GridColumn clm in gridView1.Columns) //{ // clm.Width = clm.MinWidth = clm.MaxWidth = 200; //} } if (_TrafficType == 2) { //HPS.Reports.ReportDoc.ForeignInTrafficReport rpt = new HPS.Reports.ReportDoc.ForeignInTrafficReport(FromDatefaDatePicker.Text, ToDatefaDatePicker.Text, 2, FromTimeTextBox.Text, ToTimeTextBox.Text, FromTrafficNumbertxt.Text, ToTrafficNumbertxt.Text); //rpt.Document.Printer.PrinterName = string.Empty; //viewer1.Document = rpt.Document; //rpt.Run(); HPS.BLL.TrafficBLL.BLLTraffic_TFactory TrafficFactory = new HPS.BLL.TrafficBLL.BLLTraffic_TFactory(); DT.DataTable TrafficDataTable = new DT.DataTable(); string Condition = string.Empty; string FromTime = FromTimeTextBox.Text; string ToTime = ToTimeTextBox.Text; string FromTrafficNumber = FromTrafficNumbertxt.Text; string ToTrafficNumber = ToTrafficNumbertxt.Text; string FromDate = FromDatefaDatePicker.Text; string ToDate = ToDatefaDatePicker.Text; if (!(string.IsNullOrEmpty(FromTrafficNumber) && string.IsNullOrEmpty(ToTrafficNumber)) && (string.IsNullOrEmpty(FromTime) && string.IsNullOrEmpty(ToTime))) { Condition = "(T.In_bit='True') AND (T.TrafficTypeID_int='2') AND (T.Date_nvc>='" + FromDate + "') AND (T.Date_nvc<='" + ToDate + "') AND (T.TrafficNumber_bint>='" + FromTrafficNumber + "') AND (T.TrafficNumber_bint<='" + ToTrafficNumber + "')"; } else if (string.IsNullOrEmpty(FromTime) && string.IsNullOrEmpty(ToTime) && (string.IsNullOrEmpty(FromTrafficNumber) && string.IsNullOrEmpty(ToTrafficNumber))) { Condition = "(T.In_bit='True') AND (T.TrafficTypeID_int='2') AND (T.Date_nvc>='" + FromDate + "') AND (T.Date_nvc<='" + ToDate + "')"; } else if (!(string.IsNullOrEmpty(FromTime) && string.IsNullOrEmpty(ToTime)) && string.IsNullOrEmpty(FromTrafficNumber) && string.IsNullOrEmpty(ToTrafficNumber)) { Condition = "(T.In_bit='True') AND (T.TrafficTypeID_int='2') AND (T.Date_nvc+ ' ' +T.Time_nvc>='" + FromDate + ' ' + FromTime + "' ) AND (T.Date_nvc + ' ' + T.Time_nvc<='" + ToDate + ' ' + ToTime + "')"; } else if (!((string.IsNullOrEmpty(FromTime) && string.IsNullOrEmpty(ToTime)) && string.IsNullOrEmpty(FromTrafficNumber) && string.IsNullOrEmpty(ToTrafficNumber))) { Condition = "(T.In_bit='True') AND (T.TrafficTypeID_int='2') AND (T.Date_nvc + ' ' + T.Time_nvc>='" + FromDate + ' ' + FromTime + "' ) AND (T.Date_nvc + ' ' + T.Time_nvc<='" + ToDate + ' ' + ToTime + "') AND (T.TrafficNumber_bint>='" + FromTrafficNumber + "') AND (T.TrafficNumber_bint<='" + ToTrafficNumber + "')"; } dt = new DT.DataTable(); ExportExcelDt = new System.Data.DataTable(); ForeignInTrafficReportStiReport.Dictionary.Synchronize(); ForeignInTrafficReportStiReport.Dictionary.Databases.Clear(); ForeignInTrafficReportStiReport.Dictionary.Databases.Add(new Stimulsoft.Report.Dictionary.StiSqlDatabase("Connection", Hepsa.Core.Common.ConnectionString.ConnectionString)); ForeignInTrafficReportStiReport.Compile(); ForeignInTrafficReportStiReport["organ"] = new HPS.BLL.SettingsBLL.BLLSetting_TFactory().GetBy(new BLL.SettingsBLL.BLLSetting_TKeys() { SettingID_int = 1029 }).Value_nvc.ToString(); HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory PortPlaceFactory = new HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory(); ForeignInTrafficReportStiReport["@Condition"] = Condition; ForeignInTrafficReportStiReport["fromdate_vc"] = FromDatefaDatePicker.Text; ForeignInTrafficReportStiReport["todate_vc"] = ToDatefaDatePicker.Text; ForeignInTrafficReportStiReport["date_vc"] = PortPlaceFactory.ServerJalaliDate + " " + PortPlaceFactory.ServerTime;; ForeignInTrafficReportStiReport["UserName_vc"] = HPS.Common.CurrentUser.user.UserName_nvc; ForeignInTrafficReportStiReport["fromTrafficNumber"] = FromTrafficNumbertxt.Text; ForeignInTrafficReportStiReport["toTrafficNumber"] = ToTrafficNumbertxt.Text; ForeignInTrafficReportStiReport["FromTime_vc"] = FromTimeTextBox.Text; ForeignInTrafficReportStiReport["ToTime_vc"] = ToTimeTextBox.Text; ForeignInTrafficReportStiReport.Render(); stiViewerControl1.Report = ForeignInTrafficReportStiReport; factory.GetAllByConditionAllTraffic(Condition, ref dt); Dictionary <string, string> Columns = new Dictionary <string, string>(); Columns.Add("TrafficNumber_bint", "شماره قبض"); //Columns.Add("TurnNumber_bint", "شماره نوبت"); //Columns.Add("DriverCardNumber_nvc", "شماره کارت راننده "); //Columns.Add("carCardNumber_nvc", "شماره کارت ناوگان"); Columns.Add("FirstName_nvc", "نام راننده"); Columns.Add("LastName_nvc", "نام خانوادگی راننده"); Columns.Add("NumberPlate_nvc", "شماره پلاک"); Columns.Add("UserName_nvc", "کاربر"); Columns.Add("Date_nvc", "تاریخ ورود"); Columns.Add("Time_nvc", "زمان ورود"); Columns.Add("EditUserName_nvc", "کاربر تایید کننده"); //Columns.Add("TurnDate_nvc", "تاریخ نوبت"); //Columns.Add("TurnTime_nvc", "زمان نوبت"); Columns.Add("PriceNoTax_dec", "مبلغ"); Columns.Add("PriceTax_dec", "ارزش افزوده"); Columns.Add("Price_dec", "مبلغ دریافتی"); Columns.Add("WithLade_bit", "با بار"); Columns.Add("ServiceID_intServiceType_nvc", "مراجعه به"); foreach (var col in Columns) { ExportExcelDt.Columns.Add(col.Value, col.Key.EndsWith("_bit") ? typeof(bool) : typeof(string)); } DataRow dr; for (int i = 0; i <= dt.Rows.Count - 1; i++) { dr = ExportExcelDt.NewRow(); for (int j = 0; j < Columns.Count; j++) { dr[j] = dt.Rows[i][Columns.Keys.ElementAt(j)]; } ExportExcelDt.Rows.Add(dr); } } if (_TrafficType == 0) { string turn = string.Empty; turn = " Traffic_T.TrafficNumber_bint NOT IN (SELECT trafficNumber_bint FROM Traffic_T WHERE Traffic_T.Out_bit = 1 AND (Traffic_T.Date_nvc + ' ' + Traffic_T.Time_nvc >= '" + FromDatefaDatePicker.Text + " " + ToDatefaDatePicker.Text + "') AND (Traffic_T.Date_nvc + ' ' + Traffic_T.Time_nvc <='" + FromDatefaDatePicker.Text + " " + ToDatefaDatePicker.Text + "')) AND Traffic_T.TrafficNumber_bint NOT IN (SELECT trafficNumber_bint FROM Traffic_T WHERE Traffic_T.TemporaryOut_bit = 1 AND (Traffic_T.Date_nvc + ' ' + Traffic_T.Time_nvc >= '" + FromDatefaDatePicker.Text + " " + ToDatefaDatePicker.Text + "') AND (Traffic_T.Date_nvc + ' ' + Traffic_T.Time_nvc <='" + FromDatefaDatePicker.Text + " " + ToDatefaDatePicker.Text + "')) AND "; //HPS.Reports.ReportDoc.OtherInReport rpt = new HPS.Reports.ReportDoc.OtherInReport(FromDatefaDatePicker.Text, ToDatefaDatePicker.Text, FromTimeTextBox.Text, // ToTimeTextBox.Text, FromTrafficNumbertxt.Text, ToTrafficNumbertxt.Text, Convert.ToString(TrafficTypeID_intComboBox.SelectedValue), Convert.ToString(ServicescomboBox.SelectedValue), turn); //rpt.Document.Printer.PrinterName = string.Empty; //viewer1.Document = rpt.Document; //rpt.Run(); OtherInTrafficStiReport.Dictionary.Synchronize(); OtherInTrafficStiReport.Dictionary.Databases.Clear(); OtherInTrafficStiReport.Dictionary.Databases.Add(new Stimulsoft.Report.Dictionary.StiSqlDatabase("Connection", Hepsa.Core.Common.ConnectionString.ConnectionString)); OtherInTrafficStiReport.Compile(); OtherInTrafficStiReport["organ"] = new HPS.BLL.SettingsBLL.BLLSetting_TFactory().GetBy(new BLL.SettingsBLL.BLLSetting_TKeys() { SettingID_int = 1029 }).Value_nvc.ToString(); HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory PortPlaceFactory = new HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory(); OtherInTrafficStiReport["@FromDateTime_nvc"] = FromDatefaDatePicker.Text + ' ' + FromTimeTextBox.Text; OtherInTrafficStiReport["@ToDateTime_nvc"] = ToDatefaDatePicker.Text + ' ' + ToTimeTextBox.Text; if (string.IsNullOrEmpty(FromTrafficNumbertxt.Text)) { OtherInTrafficStiReport["@FromTrafficNumber_nvc"] = DBNull.Value; } else { OtherInTrafficStiReport["@FromTrafficNumber_nvc"] = FromTrafficNumbertxt.Text; } if (string.IsNullOrEmpty(ToTrafficNumbertxt.Text)) { OtherInTrafficStiReport["@ToTrafficNumber_nvc"] = DBNull.Value; } else { OtherInTrafficStiReport["@ToTrafficNumber_nvc"] = ToTrafficNumbertxt.Text; } OtherInTrafficStiReport["@LaderPivotGroupID_nvc"] = DBNull.Value; OtherInTrafficStiReport["@LaderTypeID_nvc"] = DBNull.Value; OtherInTrafficStiReport["@TrafficTypeID_nvc"] = Convert.ToString(TrafficTypeID_intComboBox.SelectedValue); OtherInTrafficStiReport["@TrafficInbit_nvc"] = "1"; OtherInTrafficStiReport["@TrafficOutbit_nvc"] = DBNull.Value; if (string.IsNullOrEmpty(Convert.ToString(ServicescomboBox.SelectedValue))) { OtherInTrafficStiReport["@ServiceID_nvc"] = DBNull.Value; } else { OtherInTrafficStiReport["@ServiceID_nvc"] = Convert.ToString(ServicescomboBox.SelectedValue); } OtherInTrafficStiReport["@TurnAccepted_nvc"] = turn; OtherInTrafficStiReport["fromdate_vc"] = FromDatefaDatePicker.Text; OtherInTrafficStiReport["todate_vc"] = ToDatefaDatePicker.Text; OtherInTrafficStiReport["date_vc"] = PortPlaceFactory.ServerJalaliDate + " " + PortPlaceFactory.ServerTime;; OtherInTrafficStiReport["UserName_vc"] = HPS.Common.CurrentUser.user.UserName_nvc; OtherInTrafficStiReport["FromTime_vc"] = FromTimeTextBox.Text; OtherInTrafficStiReport["ToTime_vc"] = ToTimeTextBox.Text; OtherInTrafficStiReport.Render(); stiViewerControl1.Report = OtherInTrafficStiReport; dt = new DT.DataTable(); ExportExcelDt = new System.Data.DataTable(); factory.ReportSelectByFieds( OtherInTrafficStiReport["@FromDateTime_nvc"], OtherInTrafficStiReport["@ToDateTime_nvc"], OtherInTrafficStiReport["@FromTrafficNumber_nvc"], OtherInTrafficStiReport["@ToTrafficNumber_nvc"], OtherInTrafficStiReport["@LaderPivotGroupID_nvc"], OtherInTrafficStiReport["@LaderTypeID_nvc"], OtherInTrafficStiReport["@TrafficTypeID_nvc"], OtherInTrafficStiReport["@TrafficInbit_nvc"], OtherInTrafficStiReport["@TrafficOutbit_nvc"], OtherInTrafficStiReport["@ServiceID_nvc"], "", ref dt); Dictionary <string, string> Columns = new Dictionary <string, string>(); Columns.Add("TrafficNumber_bint", "شماره قبض"); //Columns.Add("TurnNumber_bint", "شماره نوبت"); //Columns.Add("DriverCardNumber_nvc", "شماره کارت راننده "); //Columns.Add("carCardNumber_nvc", "شماره کارت ناوگان"); Columns.Add("FirstName_nvc", "نام راننده"); Columns.Add("LastName_nvc", "نام خانوادگی راننده"); Columns.Add("NumberPlate_nvc", "شماره پلاک"); Columns.Add("UserName_nvc", "کاربر"); Columns.Add("Date_nvc", "تاریخ ورود"); Columns.Add("Time_nvc", "زمان ورود"); // Columns.Add("EditUserName_nvc", "کاربر تایید کننده"); //Columns.Add("TurnDate_nvc", "تاریخ نوبت"); //Columns.Add("TurnTime_nvc", "زمان نوبت"); Columns.Add("PriceNoTax_dec", "مبلغ"); Columns.Add("PriceTax_dec", "ارزش افزوده"); Columns.Add("Price_dec", "مبلغ دریافتی"); // Columns.Add("WithLade_bit", "با بار"); Columns.Add("ServiceID_intServiceType_nvc", "مراجعه به"); foreach (var col in Columns) { ExportExcelDt.Columns.Add(col.Value, col.Key.EndsWith("_bit") ? typeof(bool) : typeof(string)); } DataRow dr; for (int i = 0; i <= dt.Rows.Count - 1; i++) { dr = ExportExcelDt.NewRow(); for (int j = 0; j < Columns.Count; j++) { dr[j] = dt.Rows[i][Columns.Keys.ElementAt(j)]; } ExportExcelDt.Rows.Add(dr); } } } catch (Exception ex) { Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message); } }