protected override void Delete() { HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory PortPlacesFactory = new HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory(); try { if (Hepsa.Core.Common.MessageBox.ConfirmMessage(HPS.Exceptions.ExceptionCs.DeleteMessage) == true) { PortPlacesFactory.BeginProc(); PortPlacesFactory.Delete((HPS.BLL.PortPlacesBLL.BLLPortPlaces_TKeys)Key); PortPlacesFactory.CommitProc(); if (DataTable != null) { DataRow[] dr = DataTable.Select(HPS.BLL.PortPlacesBLL.BLLPortPlaces_T.PortPlaces_TField.PortPlacesID_int.ToString() + "='" + ((HPS.BLL.PortPlacesBLL.BLLPortPlaces_TKeys)Key).PortPlacesID_int.ToString() + "'"); if (dr.Length > 0) { dr[0].Delete(); } DataTable.AcceptChanges(); } this.Close(); } } catch (Exception ex) { PortPlacesFactory.RollBackProc(); throw ex; } }
private void PrintCanceledButton_Click(object sender, EventArgs e) { try { HPS.BLL.TrafficBLL.BLLTraffic_TFactory TrafficFactory = new HPS.BLL.TrafficBLL.BLLTraffic_TFactory(); string Condition = string.Empty; AllCanceledTurnstiReport.Dictionary.Synchronize(); AllCanceledTurnstiReport.Dictionary.Databases.Clear(); AllCanceledTurnstiReport.Dictionary.Databases.Add(new Stimulsoft.Report.Dictionary.StiSqlDatabase("Connection", Hepsa.Core.Common.ConnectionString.ConnectionString)); AllCanceledTurnstiReport.Compile(); AllCanceledTurnstiReport["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(); AllCanceledTurnstiReport["@FromDate_nvc"] = FromDatefaDatePicker.Text; AllCanceledTurnstiReport["@ToDate_nvc"] = ToDatefaDatePicker.Text; AllCanceledTurnstiReport["@FromTime_nvc"] = FromTimeTextBox.Text; AllCanceledTurnstiReport["@ToTime_nvc"] = ToTimeTextBox.Text; AllCanceledTurnstiReport["fromdate_vc"] = FromDatefaDatePicker.Text; AllCanceledTurnstiReport["todate_vc"] = ToDatefaDatePicker.Text; AllCanceledTurnstiReport["date_vc"] = PortPlaceFactory.ServerJalaliDate + " " + PortPlaceFactory.ServerTime;; AllCanceledTurnstiReport["UserName_vc"] = HPS.Common.CurrentUser.user.UserName_nvc; AllCanceledTurnstiReport.Render(); AllCanceledTurnstiReport.Show(); } catch (Exception ex) { Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message); } }
protected override void Insert() { HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory PortPlacesFactory = new HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory(); try { HPS.BLL.PortPlacesBLL.BLLPortPlaces_T PortPlacesEntity = new HPS.BLL.PortPlacesBLL.BLLPortPlaces_T(); PortPlacesEntity.PortPlaces_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(PortPlaces_nvcTextBox.Text, TypeCode.String).ToString(); PortPlacesEntity.Active_bit = Active_bitCheckBox.Checked; PortPlacesFactory.BeginProc(); PortPlacesFactory.Insert(PortPlacesEntity); PortPlacesFactory.CommitProc(); if (DataTable != null) { DataRow dr = this.DataTable.NewRow(); dr[HPS.BLL.PortPlacesBLL.BLLPortPlaces_T.PortPlaces_TField.PortPlacesID_int.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(PortPlacesEntity.PortPlacesID_int, TypeCode.Int32); dr[HPS.BLL.PortPlacesBLL.BLLPortPlaces_T.PortPlaces_TField.PortPlaces_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(PortPlacesEntity.PortPlaces_nvc, TypeCode.String); dr[HPS.BLL.PortPlacesBLL.BLLPortPlaces_T.PortPlaces_TField.Active_bit.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(PortPlacesEntity.Active_bit, TypeCode.Boolean); DataTable.Rows.Add(dr); DataTable.AcceptChanges(); } this.ClearForm(this); } catch (Exception ex) { PortPlacesFactory.RollBackProc(); throw ex; } }
protected override void Edit() { HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory PortPlacesFactory = new HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory(); try { HPS.BLL.PortPlacesBLL.BLLPortPlaces_T PortPlacesEntity = new HPS.BLL.PortPlacesBLL.BLLPortPlaces_T(); PortPlacesEntity.PortPlaces_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(PortPlaces_nvcTextBox.Text, TypeCode.String).ToString(); PortPlacesEntity.Active_bit = Active_bitCheckBox.Checked; if (Hepsa.Core.Common.MessageBox.ConfirmMessage(HPS.Exceptions.ExceptionCs.EditMessage) == true) { PortPlacesFactory.BeginProc(); PortPlacesFactory.Update(PortPlacesEntity, (HPS.BLL.PortPlacesBLL.BLLPortPlaces_TKeys)Key); PortPlacesFactory.CommitProc(); if (DataTable != null) { DataRow[] dr = DataTable.Select(HPS.BLL.PortPlacesBLL.BLLPortPlaces_T.PortPlaces_TField.PortPlacesID_int.ToString() + "='" + ((HPS.BLL.PortPlacesBLL.BLLPortPlaces_TKeys)Key).PortPlacesID_int.ToString() + "'"); if (dr.Length > 0) { dr[0][HPS.BLL.PortPlacesBLL.BLLPortPlaces_T.PortPlaces_TField.PortPlaces_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(PortPlacesEntity.PortPlaces_nvc, TypeCode.String); dr[0][HPS.BLL.PortPlacesBLL.BLLPortPlaces_T.PortPlaces_TField.Active_bit.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(PortPlacesEntity.Active_bit, TypeCode.Boolean); } DataTable.AcceptChanges(); } } } catch (Exception ex) { PortPlacesFactory.RollBackProc(); throw ex; } }
private void DeleteButton_Click(object sender, EventArgs e) { HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory PortPlacesFactory = new HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory(); try { if (Hepsa.Core.Common.MessageBox.ConfirmDeleteMessage() == false) { return; } HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory PortPlaces_TFactory = new HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory(); HPS.BLL.PortPlacesBLL.BLLPortPlaces_TKeys PortPlacesKey = new HPS.BLL.PortPlacesBLL.BLLPortPlaces_TKeys(); PortPlacesKey.PortPlacesID_int = (Int32?)PortPlacesGridView.CurrentRow.Cells["colPortPlacesID_int"].Value; PortPlacesFactory.Delete(PortPlacesKey); DataRow[] dr = ((DataTable)this.PortPlacesGridView.DataSource).Select(HPS.BLL.PortPlacesBLL.BLLPortPlaces_T.PortPlaces_TField.PortPlacesID_int.ToString() + "='" + PortPlacesKey.PortPlacesID_int.ToString() + "'"); if (dr.Length > 0) { dr[0].Delete(); } ((DataTable)this.PortPlacesGridView.DataSource).AcceptChanges(); } catch (Exception ex) { Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message); } }
private void ShowButton_Click(object sender, EventArgs e) { string Condition = string.Empty; Condition = "LadeAssignment_T.Date_nvc>='" + FromDatefaDatePicker.Text + "' AND LadeAssignment_T.Date_nvc<='" + ToDatefaDatePicker.Text + "'"; if (CompanyID_intComboBox.SelectedValue != null && (int)CompanyID_intComboBox.SelectedValue != 0) { Condition += " AND LadeAssignment_T.CompanyID_int=" + Convert.ToInt32(CompanyID_intComboBox.SelectedValue); } HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TFactory LadeAssignmentFactory = new HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TFactory(); CompanyAllLadeAssignmentedstiReport.Dictionary.Synchronize(); CompanyAllLadeAssignmentedstiReport.Dictionary.Databases.Clear(); CompanyAllLadeAssignmentedstiReport.Dictionary.Databases.Add(new Stimulsoft.Report.Dictionary.StiSqlDatabase("Connection", Hepsa.Core.Common.ConnectionString.ConnectionString)); CompanyAllLadeAssignmentedstiReport.Compile(); CompanyAllLadeAssignmentedstiReport["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(); CompanyAllLadeAssignmentedstiReport["FromDate_vc"] = FromDatefaDatePicker.Text; CompanyAllLadeAssignmentedstiReport["ToDate_vc"] = ToDatefaDatePicker.Text; CompanyAllLadeAssignmentedstiReport["Date_vc"] = PortPlaceFactory.ServerJalaliDate + " " + PortPlaceFactory.ServerTime;; CompanyAllLadeAssignmentedstiReport["UserName_vc"] = HPS.Common.CurrentUser.user.UserName_nvc; CompanyAllLadeAssignmentedstiReport["@Condition"] = Condition; CompanyAllLadeAssignmentedstiReport.Render(); this.stiViewerControl1.Report = CompanyAllLadeAssignmentedstiReport; }
private void FillCombo() { try { HPS.BLL.LaderTypeBLL.BLLLaderType_TFactory LaderTypeID_intFactory = new HPS.BLL.LaderTypeBLL.BLLLaderType_TFactory(); DataTable LaderTypeID_intDataTable = new DataTable(); string laderCondition = "[LaderType_T].[Active_bit]='true'"; LaderTypeID_intFactory.GetAllByCondition(laderCondition, ref LaderTypeID_intDataTable); this.LaderTypeID_intComboBox.DisplayMember = HPS.BLL.LaderTypeBLL.BLLLaderType_T.LaderType_TField.LaderType_nvc.ToString(); this.LaderTypeID_intComboBox.ValueMember = HPS.BLL.LaderTypeBLL.BLLLaderType_T.LaderType_TField.LaderTypeID_int.ToString(); this.LaderTypeID_intComboBox.DataSource = LaderTypeID_intDataTable; this.LaderTypeID_intComboBox.SelectedIndex = -1; HPS.BLL.CompanyBLL.BLLCompany_TFactory CompanyID_intFactory = new HPS.BLL.CompanyBLL.BLLCompany_TFactory(); //string CompanyCondition = "[Company_T].[Active_bit]='true'"; //CompanyID_intFactory.GetAllByCondition(CompanyCondition, ref CompanyID_intDataTable); ////DataRow Companydr = CompanyID_intDataTable.NewRow(); ////Companydr["CompanyID_int"] = 0; ////CompanyID_intDataTable.Rows.InsertAt(Companydr, 0); //this.CompanyID_intComboBox.DisplayMember = HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.Company_nvc.ToString(); //this.CompanyID_intComboBox.ValueMember = HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.CompanyID_int.ToString(); //this.CompanyID_intComboBox.DataSource = CompanyID_intDataTable; //this.CompanyID_intComboBox.SelectedIndex = -1; HPS.BLL.GoodBLL.BLLGood_TFactory GoodFactory = new HPS.BLL.GoodBLL.BLLGood_TFactory(); DataTable GoodID_intDataTable = new DataTable(); GoodFactory.GetAll(ref GoodID_intDataTable); this.GoodID_intcomboBox.DisplayMember = HPS.BLL.GoodBLL.BLLGood_T.Good_TField.Good_nvc.ToString(); this.GoodID_intcomboBox.ValueMember = HPS.BLL.GoodBLL.BLLGood_T.Good_TField.GoodID_int.ToString(); this.GoodID_intcomboBox.DataSource = GoodID_intDataTable; this.GoodID_intcomboBox.SelectedIndex = -1; HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory PortPlaceFactory = new HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory(); DataTable PortPlaceID_intDataTable = new DataTable(); PortPlaceFactory.GetAll(ref PortPlaceID_intDataTable); this.PortPlaceID_intcomboBox.DisplayMember = HPS.BLL.PortPlacesBLL.BLLPortPlaces_T.PortPlaces_TField.PortPlaces_nvc.ToString(); this.PortPlaceID_intcomboBox.ValueMember = HPS.BLL.PortPlacesBLL.BLLPortPlaces_T.PortPlaces_TField.PortPlacesID_int.ToString(); this.PortPlaceID_intcomboBox.DataSource = PortPlaceID_intDataTable; this.PortPlaceID_intcomboBox.SelectedIndex = -1; HPS.BLL.CityBLL.BLLCity_TFactory CityFactory = new HPS.BLL.CityBLL.BLLCity_TFactory(); DataTable DestinationCityID_intDataTable = new DataTable(); CityFactory.GetAll(ref DestinationCityID_intDataTable); this.DestinationCityID_intcomboBox.DisplayMember = HPS.BLL.CityBLL.BLLCity_T.City_TField.City_nvc.ToString(); this.DestinationCityID_intcomboBox.ValueMember = HPS.BLL.CityBLL.BLLCity_T.City_TField.CityID_int.ToString(); this.DestinationCityID_intcomboBox.DataSource = DestinationCityID_intDataTable; this.DestinationCityID_intcomboBox.SelectedIndex = -1; } catch (Exception ex) { Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message); } }
protected override void ShowForm() { this.FillCombo(); HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory PortPlacesFactory = new HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory(); HPS.BLL.PortPlacesBLL.BLLPortPlaces_T PortPlacesEntity = PortPlacesFactory.GetBy((HPS.BLL.PortPlacesBLL.BLLPortPlaces_TKeys)Key); if (PortPlacesEntity == null) { throw new HPS.Exceptions.PortPlacesNotFound(); } PortPlaces_nvcTextBox.Text = Hepsa.Core.Common.PersentationController.GetEntityValue(PortPlacesEntity.PortPlaces_nvc, TypeCode.String).ToString(); Active_bitCheckBox.Checked = (Boolean)Hepsa.Core.Common.PersentationController.GetEntityValue(PortPlacesEntity.Active_bit, TypeCode.Boolean); }
private void ShowButton_Click(object sender, EventArgs e) { try { if (FromDatefaDatePicker.IsNull) { throw new ApplicationException("از تاریخ خالی است"); } else if (ToDatefaDatePicker.IsNull) { throw new ApplicationException("تا تاریخ خالی است"); } 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); } //HPS.Reports.ReportDoc.LastTurnNumberAndRemaindCountByLaderTypeReport report = new HPS.Reports.ReportDoc.LastTurnNumberAndRemaindCountByLaderTypeReport(FromDatefaDatePicker.Text, ToDatefaDatePicker.Text); //report.Document.Printer.PrinterName = string.Empty; //viewer1.Document = report.Document; //report.Run(); LastTurnNumberAndRemaindCountByLaderTypeReport.Dictionary.Synchronize(); LastTurnNumberAndRemaindCountByLaderTypeReport.Dictionary.Databases.Clear(); LastTurnNumberAndRemaindCountByLaderTypeReport.Dictionary.Databases.Add(new Stimulsoft.Report.Dictionary.StiSqlDatabase("Connection", Hepsa.Core.Common.ConnectionString.ConnectionString)); LastTurnNumberAndRemaindCountByLaderTypeReport.Compile(); LastTurnNumberAndRemaindCountByLaderTypeReport["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(); LastTurnNumberAndRemaindCountByLaderTypeReport["fromdate_vc"] = FromDatefaDatePicker.Text; LastTurnNumberAndRemaindCountByLaderTypeReport["todate_vc"] = ToDatefaDatePicker.Text; LastTurnNumberAndRemaindCountByLaderTypeReport["date_vc"] = PortPlaceFactory.ServerJalaliDate + " " + PortPlaceFactory.ServerTime;; LastTurnNumberAndRemaindCountByLaderTypeReport["UserName_vc"] = HPS.Common.CurrentUser.user.UserName_nvc; LastTurnNumberAndRemaindCountByLaderTypeReport["@FromDate_nvc"] = FromDatefaDatePicker.Text; LastTurnNumberAndRemaindCountByLaderTypeReport["@ToDate_nvc"] = ToDatefaDatePicker.Text; LastTurnNumberAndRemaindCountByLaderTypeReport.Render(); this.stiViewerControl1.Report = LastTurnNumberAndRemaindCountByLaderTypeReport; } catch (Exception ex) { Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message); } }
private void LoadPortPlaces() { try { HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory PortPlacesFactory = new HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory(); DataTable PortPlacesDataTable = new DataTable(); PortPlacesFactory.GetAll(ref PortPlacesDataTable); this.PortPlacesGridView.DataSource = PortPlacesDataTable; } catch (System.Exception ex) { throw ex; } }
private void FillGrid() { try { HPS.BLL.LaderTypeBLL.BLLLaderType_TFactory LaderTypeID_intFactory = new HPS.BLL.LaderTypeBLL.BLLLaderType_TFactory(); DataTable LaderTypeID_intDataTable = new DataTable(); string laderCondition = "[LaderType_T].[Active_bit]='true'"; LaderTypeID_intFactory.GetAllByCondition(laderCondition, ref LaderTypeID_intDataTable); laderTypeGrid.SetDataBinding(LaderTypeID_intDataTable, "LaderTypeID_intDataTable"); HPS.BLL.CompanyBLL.BLLCompany_TFactory CompanyID_intFactory = new HPS.BLL.CompanyBLL.BLLCompany_TFactory(); string CompanyCondition = "[Company_T].[Active_bit]='true'"; CompanyID_intFactory.GetAllByCondition(CompanyCondition, ref CompanyID_intDataTable); companyGrid.SetDataBinding(CompanyID_intDataTable, "CompanyID_intDataTable"); HPS.BLL.GoodBLL.BLLGood_TFactory GoodFactory = new HPS.BLL.GoodBLL.BLLGood_TFactory(); DataTable GoodID_intDataTable = new DataTable(); GoodFactory.GetAll(ref GoodID_intDataTable); goodGrid.SetDataBinding(GoodID_intDataTable, "GoodID_intDataTable"); HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory PortPlaceFactory = new HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory(); DataTable PortPlaceID_intDataTable = new DataTable(); string PortPlacesCondition = "[PortPlaces_T].[Active_bit]='true'"; PortPlaceFactory.GetAllByCondition(PortPlacesCondition, ref PortPlaceID_intDataTable); portPlaceGrid.SetDataBinding(PortPlaceID_intDataTable, "PortPlaceID_intDataTable"); HPS.BLL.CityBLL.BLLCity_TFactory CityFactory = new HPS.BLL.CityBLL.BLLCity_TFactory(); DataTable DestinationCityID_intDataTable = new DataTable(); string CityCondition = "[City_T].[Active_bit]='true'"; CityFactory.GetAllByCondition(CityCondition, ref DestinationCityID_intDataTable); destinationCityGrid.SetDataBinding(DestinationCityID_intDataTable, "DestinationCityID_intDataTable"); this.FromDatefaDatePicker.SelectedDateTime = FarsiLibrary.Utils.PersianDateConverter.ToGregorianDateTime(CityFactory.ServerJalaliDate); this.ToDatefaDatePicker.SelectedDateTime = FarsiLibrary.Utils.PersianDateConverter.ToGregorianDateTime(CityFactory.ServerJalaliDate); //this.FromTimeTextBox.Text = "08:00:00"; //this.ToTimeTextBox.Text = CityFactory.ServerTime; } catch (Exception ex) { Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message); } }
private void PortPlaceCountReportForm_Load(object sender, EventArgs e) { HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory PortPlaceFactory = new HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory(); DataTable PortPlaceDataTable = new DataTable(); PortPlaceFactory.GetAll(ref PortPlaceDataTable); this.portPlacecheckedComboBox.DropDownDataSource = PortPlaceDataTable; this.portPlacecheckedComboBox.DropDownDataMember = "PortPlace_T"; this.portPlacecheckedComboBox.DropDownDisplayMember = HPS.BLL.PortPlacesBLL.BLLPortPlaces_T.PortPlaces_TField.PortPlaces_nvc.ToString(); this.portPlacecheckedComboBox.DropDownValueMember = HPS.BLL.PortPlacesBLL.BLLPortPlaces_T.PortPlaces_TField.PortPlacesID_int.ToString(); portPlacecheckedComboBox.RetrieveStructure(); portPlacecheckedComboBox.DropDownList.Columns[1].Visible = false; portPlacecheckedComboBox.DropDownList.Columns[3].Visible = false; portPlacecheckedComboBox.DropDownList.Columns[2].Caption = "محل بارگیری"; portPlacecheckedComboBox.DropDownList.Columns[2].Width = 300; this.FromDatefaDatePicker.SelectedDateTime = FarsiLibrary.Utils.PersianDateConverter.ToGregorianDateTime(PortPlaceFactory.ServerJalaliDate); this.ToDatefaDatePicker.SelectedDateTime = FarsiLibrary.Utils.PersianDateConverter.ToGregorianDateTime(PortPlaceFactory.ServerJalaliDate); }
private void ShowButton_Click(object sender, EventArgs e) { try { if (FromDatefaDatePicker.IsNull) { throw new ApplicationException("از تاریخ خالی است"); } else if (string.IsNullOrEmpty(Hepsa.Core.Common.PersentationController.GetMaskedTextBoxValue(FromTimeTextBox))) { throw new ApplicationException("از ساعت خالی است"); } else if (ToDatefaDatePicker.IsNull) { throw new ApplicationException("تا تاریخ خالی است"); } else if (string.IsNullOrEmpty(Hepsa.Core.Common.PersentationController.GetMaskedTextBoxValue(ToTimeTextBox))) { throw new ApplicationException("تا ساعت خالی است"); } 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); } 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); } string CompanyList_nvc = string.Empty; foreach (Janus.Windows.GridEX.GridEXRow itm in companyGrid.GetCheckedRows()) { CompanyList_nvc += itm.Cells["CompanyID_int"].Value.ToString() + ","; } if (CompanyList_nvc.EndsWith(",")) { CompanyList_nvc = CompanyList_nvc.Remove(CompanyList_nvc.Length - 1); } companyGrid.UnCheckAllRecords(); string LaderTypeList_nvc = string.Empty; foreach (Janus.Windows.GridEX.GridEXRow itm in laderTypeGrid.GetCheckedRows()) { LaderTypeList_nvc += itm.Cells["LaderTypeID_int"].Value.ToString() + ","; } if (LaderTypeList_nvc.EndsWith(",")) { LaderTypeList_nvc = LaderTypeList_nvc.Remove(LaderTypeList_nvc.Length - 1); } laderTypeGrid.UnCheckAllRecords(); string GoodList_nvc = string.Empty; foreach (Janus.Windows.GridEX.GridEXRow itm in goodGrid.GetCheckedRows()) { GoodList_nvc += itm.Cells["GoodID_int"].Value.ToString() + ","; } if (GoodList_nvc.EndsWith(",")) { GoodList_nvc = GoodList_nvc.Remove(GoodList_nvc.Length - 1); } goodGrid.UnCheckAllRecords(); string PortPlaceList_nvc = string.Empty; foreach (Janus.Windows.GridEX.GridEXRow itm in portPlaceGrid.GetCheckedRows()) { PortPlaceList_nvc += itm.Cells["PortPlacesID_int"].Value.ToString() + ","; } if (PortPlaceList_nvc.EndsWith(",")) { PortPlaceList_nvc = PortPlaceList_nvc.Remove(PortPlaceList_nvc.Length - 1); } portPlaceGrid.UnCheckAllRecords(); string DestinationCityList_nvc = string.Empty; foreach (Janus.Windows.GridEX.GridEXRow itm in destinationCityGrid.GetCheckedRows()) { DestinationCityList_nvc += itm.Cells["CityID_int"].Value.ToString() + ","; } if (DestinationCityList_nvc.EndsWith(",")) { DestinationCityList_nvc = DestinationCityList_nvc.Remove(DestinationCityList_nvc.Length - 1); } destinationCityGrid.UnCheckAllRecords(); //HPS.Reports.ReportDoc.CompanyLadeAssignmentDetailReport rpt = new HPS.Reports.ReportDoc.CompanyLadeAssignmentDetailReport(FromDatefaDatePicker.Text, FromTimeTextBox.Text, ToDatefaDatePicker.Text, ToTimeTextBox.Text, LaderTypeList_nvc, CompanyList_nvc, GoodList_nvc, DestinationCityList_nvc, PortPlaceList_nvc); //viewer1.Document = rpt.Document; //rpt.Document.Printer.PrinterName = string.Empty; //rpt.Run(); CompanyLadeAssignmentDetailReportstiReport.Dictionary.Synchronize(); CompanyLadeAssignmentDetailReportstiReport.Dictionary.Databases.Clear(); CompanyLadeAssignmentDetailReportstiReport.Dictionary.Databases.Add(new Stimulsoft.Report.Dictionary.StiSqlDatabase("Connection", Hepsa.Core.Common.ConnectionString.ConnectionString)); CompanyLadeAssignmentDetailReportstiReport.Compile(); HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory PortPlaceFactory = new HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory(); CompanyLadeAssignmentDetailReportstiReport["organ"] = new HPS.BLL.SettingsBLL.BLLSetting_TFactory().GetBy(new BLL.SettingsBLL.BLLSetting_TKeys() { SettingID_int = 1029 }).Value_nvc.ToString(); CompanyLadeAssignmentDetailReportstiReport["FromDate_vc"] = FromDatefaDatePicker.Text; CompanyLadeAssignmentDetailReportstiReport["ToDate_vc"] = ToDatefaDatePicker.Text; CompanyLadeAssignmentDetailReportstiReport["FromTime_vc"] = FromTimeTextBox.Text; CompanyLadeAssignmentDetailReportstiReport["ToTime_vc"] = ToTimeTextBox.Text; CompanyLadeAssignmentDetailReportstiReport["Date_vc"] = PortPlaceFactory.ServerJalaliDate + " " + PortPlaceFactory.ServerTime;; CompanyLadeAssignmentDetailReportstiReport["UserName_vc"] = HPS.Common.CurrentUser.user.UserName_nvc; CompanyLadeAssignmentDetailReportstiReport["@fromdate_nvc"] = FromDatefaDatePicker.Text; CompanyLadeAssignmentDetailReportstiReport["@todate_nvc"] = ToDatefaDatePicker.Text; CompanyLadeAssignmentDetailReportstiReport["@fromtime_nvc"] = FromTimeTextBox.Text; CompanyLadeAssignmentDetailReportstiReport["@totime_nvc"] = ToTimeTextBox.Text; if (string.IsNullOrEmpty(LaderTypeList_nvc)) { CompanyLadeAssignmentDetailReportstiReport["@LaderTypeID_int"] = DBNull.Value; } else { CompanyLadeAssignmentDetailReportstiReport["@LaderTypeID_int"] = LaderTypeList_nvc; } if (string.IsNullOrEmpty(CompanyList_nvc)) { CompanyLadeAssignmentDetailReportstiReport["@CompanyID_int"] = DBNull.Value; } else { CompanyLadeAssignmentDetailReportstiReport["@CompanyID_int"] = CompanyList_nvc; } if (string.IsNullOrEmpty(GoodList_nvc)) { CompanyLadeAssignmentDetailReportstiReport["@GoodIDList_nvc"] = DBNull.Value; } else { CompanyLadeAssignmentDetailReportstiReport["@GoodIDList_nvc"] = GoodList_nvc; } if (string.IsNullOrEmpty(DestinationCityList_nvc)) { CompanyLadeAssignmentDetailReportstiReport["@DestinationCityIDList_nvc"] = DBNull.Value; } else { CompanyLadeAssignmentDetailReportstiReport["@DestinationCityIDList_nvc"] = DestinationCityList_nvc; } if (string.IsNullOrEmpty(PortPlaceList_nvc)) { CompanyLadeAssignmentDetailReportstiReport["@PortPlaceIDList_nvc"] = DBNull.Value; } else { CompanyLadeAssignmentDetailReportstiReport["@PortPlaceIDList_nvc"] = PortPlaceList_nvc; } CompanyLadeAssignmentDetailReportstiReport["@OrderColumns_nvc"] = DBNull.Value; CompanyLadeAssignmentDetailReportstiReport.Render(); this.stiViewerControl1.Report = CompanyLadeAssignmentDetailReportstiReport; } catch (Exception ex) { Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message); } }
private void PrintstripButton_Click(object sender, EventArgs e) { CarAllTrafficfoGridView.Visible = false; stiViewerControl1.Visible = true; 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); } CarAllTrafficstiReport.Dictionary.Synchronize(); CarAllTrafficstiReport.Dictionary.Databases.Clear(); CarAllTrafficstiReport.Dictionary.Databases.Add(new Stimulsoft.Report.Dictionary.StiSqlDatabase("Connection", Hepsa.Core.Common.ConnectionString.ConnectionString)); CarAllTrafficstiReport.Compile(); //مقدار دهی متغیرها //stiReport1["fromDate_nvc"] = 1393 / 01 / 20;//FromDatefaDatePicker.Text; CarAllTrafficstiReport["organ"] = new HPS.BLL.SettingsBLL.BLLSetting_TFactory().GetBy(new BLL.SettingsBLL.BLLSetting_TKeys() { SettingID_int = 1029 }).Value_nvc.ToString(); if (FromDatefaDatePicker.IsNull) { CarAllTrafficstiReport["fromDate_nvc"] = string.Empty; } else { CarAllTrafficstiReport["fromDate_nvc"] = FromDatefaDatePicker.Text; } if (ToDatefaDatePicker.IsNull) { CarAllTrafficstiReport["toDate_nvc"] = string.Empty; } else { CarAllTrafficstiReport["toDate_nvc"] = ToDatefaDatePicker.Text; } HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory PortPlaceFactory = new HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory(); CarAllTrafficstiReport["date_vc"] = PortPlaceFactory.ServerJalaliDate + " " + PortPlaceFactory.ServerTime; CarAllTrafficstiReport["userName_nvc"] = HPS.Common.CurrentUser.user.UserName_nvc; CarAllTrafficstiReport["@Condition"] = TrafficCondition; CarAllTrafficstiReport.Render(); stiViewerControl1.Report = CarAllTrafficstiReport; }
private void PrintButton_Click(object sender, EventArgs e) { try { bool isCanceldedLadBill = (bool)LadBillWithTrafficGridView.CurrentRow.Cells["colCanceled_bit"].Value; //if (WithProductionYear == true && !FromDatefaDatePicker.IsNull && !ToDatefaDatePicker.IsNull) //{ if (isCanceldedLadBill && HPS.Common.CurrentUser.user.UserGroupID_int != 1) { throw new ApplicationException("این مجوز باطل شده و امکان چاپ ندارد"); } HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory LadBillFactory = new HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory(); string condition = string.Empty; if (!string.IsNullOrEmpty(ToDatefaDatePicker.Text) && !string.IsNullOrEmpty(FromDatefaDatePicker.Text)) { condition = string.Format(" LadBillCredit_T.Date_nvc>='{0}' And LadBillCredit_T.Date_nvc<='{1}'", FromDatefaDatePicker.Text, ToDatefaDatePicker.Text); } if (!string.IsNullOrEmpty(LadBillCrediteID_binttextBox.Text)) { condition += string.Format(" OR LadBillCredit_T.LadBillCreditID_int='{0}'", LadBillCrediteID_binttextBox.Text); } if (!string.IsNullOrEmpty(AcceptedTurnNumber_binttextBox.Text)) { condition += string.Format(" OR Traffic_T.AcceptedTurnNumber_bint='{0}'", AcceptedTurnNumber_binttextBox.Text); } if (!string.IsNullOrEmpty(DriverCardNumber_nvctextBox.Text)) { condition += string.Format(" OR Driver_T.DriverCardNumber_nvc='{0}'", DriverCardNumber_nvctextBox.Text); } if (!string.IsNullOrEmpty(NationalCode_inttextBox.Text)) { condition += string.Format(" OR Driver_T.NationalCode_int='{0}'", NationalCode_inttextBox.Text); } if (!string.IsNullOrEmpty(DriverLastName_nvctextBox.Text)) { condition += string.Format(" OR Driver_T.LastName_nvc='{0}'", DriverLastName_nvctextBox.Text); } if (!string.IsNullOrEmpty(CarSerialnumbertextBox.Text) && !string.IsNullOrEmpty(NumberPlate_nvctextBox.Text)) { condition += string.Format(" OR Car_T.NumberPlate_nvc='{0}' And Car_T.SerialPlate_nvc = '{1}'", NumberPlate_nvctextBox.Text, CarSerialnumbertextBox.Text); } LadBillCreditReportstiReport.Dictionary.Synchronize(); LadBillCreditReportstiReport.Dictionary.Databases.Clear(); LadBillCreditReportstiReport.Dictionary.Databases.Add(new Stimulsoft.Report.Dictionary.StiSqlDatabase("Connection", Hepsa.Core.Common.ConnectionString.ConnectionString)); LadBillCreditReportstiReport.Compile(); HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory PortPlaceFactory = new HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory(); LadBillCreditReportstiReport["organ"] = new HPS.BLL.SettingsBLL.BLLSetting_TFactory().GetBy(new BLL.SettingsBLL.BLLSetting_TKeys() { SettingID_int = 1029 }).Value_nvc.ToString(); LadBillCreditReportstiReport["FromDate_vc"] = FromDatefaDatePicker.Text; LadBillCreditReportstiReport["ToDate_vc"] = ToDatefaDatePicker.Text; LadBillCreditReportstiReport["FromTime_vc"] = FromDatefaDatePicker.Text; LadBillCreditReportstiReport["ToTime_vc"] = ToDatefaDatePicker.Text; LadBillCreditReportstiReport["Date_vc"] = PortPlaceFactory.ServerJalaliDate + " " + PortPlaceFactory.ServerTime;; LadBillCreditReportstiReport["UserName_vc"] = HPS.Common.CurrentUser.user.UserName_nvc; LadBillCreditReportstiReport["@fromdate_nvc"] = FromDatefaDatePicker.Text; LadBillCreditReportstiReport["@todate_nvc"] = ToDatefaDatePicker.Text; LadBillCreditReportstiReport["@fromtime_nvc"] = FromDatefaDatePicker.Text; LadBillCreditReportstiReport["@totime_nvc"] = ToDatefaDatePicker.Text; LadBillCreditReportstiReport["@Condition"] = condition; LadBillCreditReportstiReport.Render(); LadBillWithTrafficGridView.Visible = false; stiViewerControl1.Visible = true; stiViewerControl1.Report = LadBillCreditReportstiReport; //} //else //{ // HPS.Reports.Forms.LadBillCreditReporForm frm = new LadBillCreditReporForm(); // frm.ShowDialog(); //} } catch (Exception ex) { Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message); } }
private void ShowButton_Click(object sender, EventArgs e) { 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.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); } 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); } //HPS.Reports.ReportDoc.InServiceTypeWithPivoteReport rpt = new HPS.Reports.ReportDoc.InServiceTypeWithPivoteReport(FromDatefaDatePicker.Text, FromTimeTextBox.Text, ToDatefaDatePicker.Text, ToTimeTextBox.Text); //viewer1.Document = rpt.Document; //rpt.Document.Printer.PrinterName = string.Empty; //rpt.Run(); HPS.BLL.TrafficBLL.BLLTraffic_TFactory TrafficFactory = new HPS.BLL.TrafficBLL.BLLTraffic_TFactory(); InServiceTypeWithPivotestiReport.Dictionary.Synchronize(); InServiceTypeWithPivotestiReport.Dictionary.Databases.Clear(); InServiceTypeWithPivotestiReport.Dictionary.Databases.Add(new Stimulsoft.Report.Dictionary.StiSqlDatabase("Connection", Hepsa.Core.Common.ConnectionString.ConnectionString)); InServiceTypeWithPivotestiReport.Compile(); HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory PortPlaceFactory = new HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory(); InServiceTypeWithPivotestiReport["organ"] = new HPS.BLL.SettingsBLL.BLLSetting_TFactory().GetBy(new BLL.SettingsBLL.BLLSetting_TKeys() { SettingID_int = 1029 }).Value_nvc.ToString(); InServiceTypeWithPivotestiReport["@FromDate_nvc"] = FromDatefaDatePicker.Text; InServiceTypeWithPivotestiReport["@FromTime_nvc"] = FromTimeTextBox.Text; InServiceTypeWithPivotestiReport["@ToDate_nvc"] = ToDatefaDatePicker.Text; InServiceTypeWithPivotestiReport["@ToTime_nvc"] = ToTimeTextBox.Text; InServiceTypeWithPivotestiReport["fromdate_vc"] = FromDatefaDatePicker.Text; InServiceTypeWithPivotestiReport["todate_vc"] = ToDatefaDatePicker.Text; InServiceTypeWithPivotestiReport["date_vc"] = PortPlaceFactory.ServerJalaliDate + " " + PortPlaceFactory.ServerTime;; InServiceTypeWithPivotestiReport["UserName_vc"] = HPS.Common.CurrentUser.user.UserName_nvc; InServiceTypeWithPivotestiReport["FromTime_vc"] = FromTimeTextBox.Text; InServiceTypeWithPivotestiReport["ToTime_vc"] = ToTimeTextBox.Text; InServiceTypeWithPivotestiReport.Render(); this.stiViewerControl1.Report = InServiceTypeWithPivotestiReport; } catch (Exception ex) { Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message); } }
private void ChartShowButton_Click(object sender, EventArgs e) { try { ExistsLaderTypeGridView.Visible = false; 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.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); } 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); } object[] LaderTypeList = new object[100]; string LaderTypeList_nvc = string.Empty; int index = 0; LaderTypeList = LaderTypecheckedComboBox.CheckedValues; if (LaderTypeList != null) { foreach (object obj in LaderTypeList) { LaderTypeList_nvc = string.Format("{0},{1}", LaderTypeList_nvc, LaderTypeList[index].ToString()); index += 1; } LaderTypeList_nvc = LaderTypeList_nvc.Substring(1, LaderTypeList_nvc.Length - 1); } if (string.IsNullOrEmpty(LaderTypeList_nvc)) { throw new ApplicationException("نوع بارگیر انتخاب نشده است"); } if (LaderTypecheckedComboBox.CheckedValues.Length > 1) { throw new ApplicationException("یک بارگیر را انتخاب کنید"); } //HPS.Reports.ReportDoc.LaderTypeCountChart rpt = new HPS.Reports.ReportDoc.LaderTypeCountChart(FromDatefaDatePicker.Text, FromTimeTextBox.Text, ToDatefaDatePicker.Text, ToTimeTextBox.Text, LaderTypeList_nvc); //rpt.Document.Printer.PrinterName = string.Empty; //viewer1.Document = rpt.Document; //rpt.Run(); LaderTypeCountChartstiReport.Dictionary.Synchronize(); LaderTypeCountChartstiReport.Dictionary.Databases.Clear(); LaderTypeCountChartstiReport.Dictionary.Databases.Add(new Stimulsoft.Report.Dictionary.StiSqlDatabase("Connection", Hepsa.Core.Common.ConnectionString.ConnectionString)); LaderTypeCountChartstiReport.Compile(); LaderTypeCountChartstiReport["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(); LaderTypeCountChartstiReport["fromDate_nvc"] = FromDatefaDatePicker.Text; LaderTypeCountChartstiReport["toDate_nvc"] = ToDatefaDatePicker.Text; LaderTypeCountChartstiReport["fromTime_nvc"] = FromTimeTextBox.Text; LaderTypeCountChartstiReport["toTime_nvc"] = ToTimeTextBox.Text; LaderTypeCountChartstiReport["date_vc"] = PortPlaceFactory.ServerJalaliDate + " " + PortPlaceFactory.ServerTime;; LaderTypeCountChartstiReport["userName_nvc"] = HPS.Common.CurrentUser.user.UserName_nvc; LaderTypeCountChartstiReport["@fromdate_nvc"] = FromDatefaDatePicker.Text; LaderTypeCountChartstiReport["@todate_nvc"] = ToDatefaDatePicker.Text; LaderTypeCountChartstiReport["@fromtime_nvc"] = FromTimeTextBox.Text; LaderTypeCountChartstiReport["@totime_nvc"] = ToTimeTextBox.Text; LaderTypeCountChartstiReport["@LaderTypeList"] = LaderTypeList_nvc; LaderTypeCountChartstiReport.Render(); //this.stiViewerControl1.Report = LaderTypeCountChartstiReport; LaderTypeCountChartstiReport.Show(); } catch (Exception ex) { Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message); } }
private void ShowWithChartButton_Click(object sender, EventArgs e) { 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); } if (LaderTypeID_intComboBox.SelectedIndex != -1) { //HPS.Reports.ReportDoc.AllInInfoByDateChartReport rpt = new HPS.Reports.ReportDoc.AllInInfoByDateChartReport(FromDatefaDatePicker.Text, FromTimeTextBox.Text, ToDatefaDatePicker.Text, ToTimeTextBox.Text, Convert.ToInt32(LaderTypeID_intComboBox.SelectedValue), LaderTypeID_intComboBox.Text); //rpt.Document.Printer.PrinterName = string.Empty; //viewer1.Document = rpt.Document; //rpt.Run(); AllInInfoByDateChartReportstiReport.Dictionary.Synchronize(); AllInInfoByDateChartReportstiReport.Dictionary.Databases.Clear(); AllInInfoByDateChartReportstiReport.Dictionary.Databases.Add(new Stimulsoft.Report.Dictionary.StiSqlDatabase("Connection", Hepsa.Core.Common.ConnectionString.ConnectionString)); AllInInfoByDateChartReportstiReport.Compile(); HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory PortPlaceFactory = new HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory(); AllInInfoByDateChartReportstiReport["fromDate_nvc"] = FromDatefaDatePicker.Text; AllInInfoByDateChartReportstiReport["toDate_nvc"] = ToDatefaDatePicker.Text; AllInInfoByDateChartReportstiReport["fromTime_nvc"] = FromTimeTextBox.Text; AllInInfoByDateChartReportstiReport["toTime_nvc"] = ToTimeTextBox.Text; AllInInfoByDateChartReportstiReport["date_vc"] = PortPlaceFactory.ServerJalaliDate + " " + PortPlaceFactory.ServerTime; AllInInfoByDateChartReportstiReport["userName_nvc"] = HPS.Common.CurrentUser.user.UserName_nvc; AllInInfoByDateChartReportstiReport["@fromdate_nvc"] = FromDatefaDatePicker.Text; AllInInfoByDateChartReportstiReport["@todate_nvc"] = ToDatefaDatePicker.Text; AllInInfoByDateChartReportstiReport["@fromtime_nvc"] = FromTimeTextBox.Text; AllInInfoByDateChartReportstiReport["@totime_nvc"] = ToTimeTextBox.Text; AllInInfoByDateChartReportstiReport["@LaderTypeList"] = Convert.ToInt32(LaderTypeID_intComboBox.SelectedValue); AllInInfoByDateChartReportstiReport["@FromDate_nvc"] = FromDatefaDatePicker.Text; AllInInfoByDateChartReportstiReport["@ToDate_nvc"] = ToDatefaDatePicker.Text; AllInInfoByDateChartReportstiReport["@FromTime_nvc"] = FromTimeTextBox.Text; AllInInfoByDateChartReportstiReport["@ToTime_nvc"] = ToTimeTextBox.Text; AllInInfoByDateChartReportstiReport["@LaderTypeID_int"] = Convert.ToInt32(LaderTypeID_intComboBox.SelectedValue); AllInInfoByDateChartReportstiReport.Render(); AllInInfoByDateChartReportstiReport.Show(); } else { throw new ApplicationException("نوع بارگیر را انتخاب نمایید"); } } catch (Exception ex) { Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message); } }
private void ShowButton_Click(object sender, EventArgs e) { try { if (FromDatefaDatePicker.IsNull) { throw new ApplicationException("از تاریخ خالی است"); } else if (string.IsNullOrEmpty(Hepsa.Core.Common.PersentationController.GetMaskedTextBoxValue(FromTimeTextBox))) { throw new ApplicationException("از ساعت خالی است"); } else if (ToDatefaDatePicker.IsNull) { throw new ApplicationException("تا تاریخ خالی است"); } else if (string.IsNullOrEmpty(Hepsa.Core.Common.PersentationController.GetMaskedTextBoxValue(ToTimeTextBox))) { throw new ApplicationException("تا ساعت خالی است"); } 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); } 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); } string CompanyList_nvc = string.Empty; foreach (Janus.Windows.GridEX.GridEXRow itm in companyGrid.GetCheckedRows()) { CompanyList_nvc += itm.Cells["CompanyID_int"].Value.ToString() + ","; } if (CompanyList_nvc.EndsWith(",")) { CompanyList_nvc = CompanyList_nvc.Remove(CompanyList_nvc.Length - 1); } companyGrid.UnCheckAllRecords(); string LaderTypeList_nvc = string.Empty; foreach (Janus.Windows.GridEX.GridEXRow itm in laderTypeGrid.GetCheckedRows()) { LaderTypeList_nvc += itm.Cells["LaderTypeID_int"].Value.ToString() + ","; } if (LaderTypeList_nvc.EndsWith(",")) { LaderTypeList_nvc = LaderTypeList_nvc.Remove(LaderTypeList_nvc.Length - 1); } laderTypeGrid.UnCheckAllRecords(); //////create Order list string OrderColumns_nvc = string.Empty; OrderColumns_nvc = " T1.LadeDate_nvc "; bool justRemained = false; if (JustRemainedCheckBox.Checked) { justRemained = true; } string GoodList_nvc = string.Empty; foreach (Janus.Windows.GridEX.GridEXRow itm in goodGrid.GetCheckedRows()) { GoodList_nvc += itm.Cells["GoodID_int"].Value.ToString() + ","; } if (GoodList_nvc.EndsWith(",")) { GoodList_nvc = GoodList_nvc.Remove(GoodList_nvc.Length - 1); } goodGrid.UnCheckAllRecords(); string PortPlaceList_nvc = string.Empty; foreach (Janus.Windows.GridEX.GridEXRow itm in portPlaceGrid.GetCheckedRows()) { PortPlaceList_nvc += itm.Cells["PortPlacesID_int"].Value.ToString() + ","; } if (PortPlaceList_nvc.EndsWith(",")) { PortPlaceList_nvc = PortPlaceList_nvc.Remove(PortPlaceList_nvc.Length - 1); } portPlaceGrid.UnCheckAllRecords(); string DestinationCityList_nvc = string.Empty; foreach (Janus.Windows.GridEX.GridEXRow itm in destinationCityGrid.GetCheckedRows()) { DestinationCityList_nvc += itm.Cells["CityID_int"].Value.ToString() + ","; } if (DestinationCityList_nvc.EndsWith(",")) { DestinationCityList_nvc = DestinationCityList_nvc.Remove(DestinationCityList_nvc.Length - 1); } destinationCityGrid.UnCheckAllRecords(); //////////////////////////////////////// //HPS.Reports.ReportDoc.CompanyRemanedLadBillWithDateReport rpt = new HPS.Reports.ReportDoc.CompanyRemanedLadBillWithDateReport(FromDatefaDatePicker.Text, FromTimeTextBox.Text, ToDatefaDatePicker.Text, ToTimeTextBox.Text, LaderTypeList_nvc, CompanyList_nvc, OrderColumns_nvc, justRemained, GoodList_nvc, DestinationCityList_nvc, PortPlaceList_nvc); //viewer1.Document = rpt.Document; //rpt.Document.Printer.PrinterName = string.Empty; //rpt.Run(); HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TFactory LadeAssignmenFactory = new HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TFactory(); DataTable LaderTypeReportTable = new DataTable(); DataSet LaderTypeDataset = new DataSet(); LadeAssignmenFactory.SelectCompanyLadeAssignmentDetail(FromDatefaDatePicker.Text, FromTimeTextBox.Text, ToDatefaDatePicker.Text, ToTimeTextBox.Text, LaderTypeList_nvc, CompanyList_nvc, GoodList_nvc, DestinationCityList_nvc, PortPlaceList_nvc, OrderColumns_nvc, ref LaderTypeReportTable); DataTable dt = null; if (JustRemainedCheckBox.Checked) { LaderTypeReportTable.DefaultView.RowFilter = "RemainderCount_int <>0"; dt = LaderTypeReportTable.DefaultView.ToTable(); } else if (JustCanceledCheckBox.Checked) { LaderTypeReportTable.DefaultView.RowFilter = "CanceledByCompany <>0 OR CanceledByLadBillCanceled<>0"; dt = LaderTypeReportTable.DefaultView.ToTable(); } else { dt = LaderTypeReportTable; } dt.Columns.Add("RemainedPercent"); foreach (DataRow row in dt.Rows) { double RemainedPercent = (Convert.ToDouble(row["RemainderCount_int"]) * 100) / (Convert.ToDouble(row["CarCount_int"])); row["RemainedPercent"] = RemainedPercent.ToString("0.##"); } LaderTypeDataset.Tables.Add(dt.Copy()); CompanyRemanedLadBillStiReport.Dictionary.Synchronize(); CompanyRemanedLadBillStiReport.Dictionary.Databases.Clear(); CompanyRemanedLadBillStiReport.Dictionary.Databases.Add(new Stimulsoft.Report.Dictionary.StiSqlDatabase("Connection", Hepsa.Core.Common.ConnectionString.ConnectionString)); CompanyRemanedLadBillStiReport.RegData(LaderTypeDataset); CompanyRemanedLadBillStiReport.Compile(); CompanyRemanedLadBillStiReport["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(); CompanyRemanedLadBillStiReport["fromDate_nvc"] = FromDatefaDatePicker.Text; CompanyRemanedLadBillStiReport["fromTime_nvc"] = FromTimeTextBox.Text; CompanyRemanedLadBillStiReport["toTime_nvc"] = ToTimeTextBox.Text; CompanyRemanedLadBillStiReport["toDate_nvc"] = ToDatefaDatePicker.Text; CompanyRemanedLadBillStiReport["date_vc"] = PortPlaceFactory.ServerJalaliDate + " " + PortPlaceFactory.ServerTime;; CompanyRemanedLadBillStiReport["UserName_vc"] = HPS.Common.CurrentUser.user.UserName_nvc; if (JustRemainedCheckBox.Checked) { CompanyRemanedLadBillStiReport["title_nvc"] = "بارهای جامانده شرکت های حمل و نقل"; } else if (JustCanceledCheckBox.Checked) { CompanyRemanedLadBillStiReport["title_nvc"] = "بارهای ابطالی شرکت های حمل و نقل"; } else { CompanyRemanedLadBillStiReport["title_nvc"] = "بارهای درخواستی و جامانده شرکت های حمل و نقل"; } // //CompanyRemanedLadBillStiReport["@fromdate_nvc"] = FromDatefaDatePicker.Text; //CompanyRemanedLadBillStiReport["@fromtime_nvc"] = FromTimeTextBox.Text; //CompanyRemanedLadBillStiReport["@totime_nvc"] = ToTimeTextBox.Text; //CompanyRemanedLadBillStiReport["@todate_nvc"] = ToDatefaDatePicker.Text; //if (string.IsNullOrEmpty(LaderTypeList_nvc)) // CompanyRemanedLadBillStiReport["@LaderTypeID_int"] = DBNull.Value; //else // CompanyRemanedLadBillStiReport["@LaderTypeID_int"] = LaderTypeList_nvc; //if (string.IsNullOrEmpty(CompanyList_nvc)) // CompanyRemanedLadBillStiReport["@CompanyID_int"] = DBNull.Value; //else // CompanyRemanedLadBillStiReport["@CompanyID_int"] = CompanyList_nvc; //if (string.IsNullOrEmpty(GoodList_nvc)) // CompanyRemanedLadBillStiReport["@GoodIDList_nvc"] = DBNull.Value; //else // CompanyRemanedLadBillStiReport["@GoodIDList_nvc"] = GoodList_nvc; //if (string.IsNullOrEmpty(DestinationCityList_nvc)) // CompanyRemanedLadBillStiReport["@DestinationCityIDList_nvc"] = DBNull.Value; //else // CompanyRemanedLadBillStiReport["@DestinationCityIDList_nvc"] = DestinationCityList_nvc; //if (string.IsNullOrEmpty(PortPlaceList_nvc)) // CompanyRemanedLadBillStiReport["@PortPlaceIDList_nvc"] = DBNull.Value; //else // CompanyRemanedLadBillStiReport["@PortPlaceIDList_nvc"] = PortPlaceList_nvc; //if (string.IsNullOrEmpty(OrderColumns_nvc)) // CompanyRemanedLadBillStiReport["@OrderColumns_nvc"] = DBNull.Value; //else // CompanyRemanedLadBillStiReport["@OrderColumns_nvc"] = OrderColumns_nvc; CompanyRemanedLadBillStiReport.Render(); stiViewerControl1.Report = CompanyRemanedLadBillStiReport; } catch (Exception ex) { Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message); } }
private void FillCombo() { try { HPS.BLL.AnnouncementTimeBLL.BLLAnnouncementTime_TFactory AnnouncementTimeID_intFactory = new HPS.BLL.AnnouncementTimeBLL.BLLAnnouncementTime_TFactory(); DataTable AnnouncementTimeID_intDataTable = new DataTable(); AnnouncementTimeID_intFactory.GetAll(ref AnnouncementTimeID_intDataTable); this.AnnouncementTimeID_intComboBox.DisplayMember = HPS.BLL.AnnouncementTimeBLL.BLLAnnouncementTime_T.AnnouncementTime_TField.AnnouncementTime_nvc.ToString(); this.AnnouncementTimeID_intComboBox.ValueMember = HPS.BLL.AnnouncementTimeBLL.BLLAnnouncementTime_T.AnnouncementTime_TField.AnnouncementTimeID_int.ToString(); this.AnnouncementTimeID_intComboBox.DataSource = AnnouncementTimeID_intDataTable; this.AnnouncementTimeID_intComboBox.SelectedIndex = -1; HPS.BLL.CityBLL.BLLCity_TFactory CityID_intFactory = new HPS.BLL.CityBLL.BLLCity_TFactory(); DataTable CityID_intDataTable = new DataTable(); CityID_intFactory.GetAll(ref CityID_intDataTable); this.CityID_intComboBox.DisplayMember = HPS.BLL.CityBLL.BLLCity_T.City_TField.City_nvc.ToString(); this.CityID_intComboBox.ValueMember = HPS.BLL.CityBLL.BLLCity_T.City_TField.CityID_int.ToString(); this.CityID_intComboBox.DataSource = CityID_intDataTable; this.CityID_intComboBox.SelectedIndex = -1; HPS.BLL.GoodBLL.BLLGood_TFactory GoodID_intFactory = new HPS.BLL.GoodBLL.BLLGood_TFactory(); DataTable GoodID_intDataTable = new DataTable(); GoodID_intFactory.GetAll(ref GoodID_intDataTable); this.GoodID_intComboBox.DisplayMember = HPS.BLL.GoodBLL.BLLGood_T.Good_TField.Good_nvc.ToString(); this.GoodID_intComboBox.ValueMember = HPS.BLL.GoodBLL.BLLGood_T.Good_TField.GoodID_int.ToString(); this.GoodID_intComboBox.DataSource = GoodID_intDataTable; this.GoodID_intComboBox.SelectedIndex = -1; HPS.BLL.BoxingBLL.BLLBoxing_TFactory BoxingID_intFactory = new HPS.BLL.BoxingBLL.BLLBoxing_TFactory(); DataTable BoxingID_intDataTable = new DataTable(); BoxingID_intFactory.GetAll(ref BoxingID_intDataTable); this.BoxingID_intComboBox.DisplayMember = HPS.BLL.BoxingBLL.BLLBoxing_T.Boxing_TField.BoxingType_nvc.ToString(); this.BoxingID_intComboBox.ValueMember = HPS.BLL.BoxingBLL.BLLBoxing_T.Boxing_TField.BoxingID_int.ToString(); this.BoxingID_intComboBox.DataSource = BoxingID_intDataTable; this.BoxingID_intComboBox.SelectedIndex = -1; HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory PortPlaceID_intFactory = new HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory(); DataTable PortPlaceID_intDataTable = new DataTable(); PortPlaceID_intFactory.GetAll(ref PortPlaceID_intDataTable); this.PortPlaceID_intComboBox.DisplayMember = HPS.BLL.PortPlacesBLL.BLLPortPlaces_T.PortPlaces_TField.PortPlaces_nvc.ToString(); this.PortPlaceID_intComboBox.ValueMember = HPS.BLL.PortPlacesBLL.BLLPortPlaces_T.PortPlaces_TField.PortPlacesID_int.ToString(); this.PortPlaceID_intComboBox.DataSource = PortPlaceID_intDataTable; this.PortPlaceID_intComboBox.SelectedIndex = -1; HPS.BLL.LaderTypeBLL.BLLLaderType_TFactory LaderTypeID_intFactory = new HPS.BLL.LaderTypeBLL.BLLLaderType_TFactory(); DataTable LaderTypeID_intDataTable = new DataTable(); LaderTypeID_intFactory.GetAll(ref LaderTypeID_intDataTable); this.LaderTypeID_intComboBox.DisplayMember = HPS.BLL.LaderTypeBLL.BLLLaderType_T.LaderType_TField.LaderType_nvc.ToString(); this.LaderTypeID_intComboBox.ValueMember = HPS.BLL.LaderTypeBLL.BLLLaderType_T.LaderType_TField.LaderTypeID_int.ToString(); this.LaderTypeID_intComboBox.DataSource = LaderTypeID_intDataTable; this.LaderTypeID_intComboBox.SelectedIndex = -1; HPS.BLL.CompanyBLL.BLLCompany_TFactory CompanyID_intFactory = new HPS.BLL.CompanyBLL.BLLCompany_TFactory(); DataTable CompanyID_intDataTable = new DataTable(); CompanyID_intFactory.GetAll(ref CompanyID_intDataTable); this.CompanyID_intComboBox.DisplayMember = HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.Company_nvc.ToString(); this.CompanyID_intComboBox.ValueMember = HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.CompanyID_int.ToString(); this.CompanyID_intComboBox.DataSource = CompanyID_intDataTable; this.CompanyID_intComboBox.SelectedIndex = -1; HPS.BLL.TrafficTypeBLL.BLLTrafficType_TFactory TrafficTypeID_intFactory = new HPS.BLL.TrafficTypeBLL.BLLTrafficType_TFactory(); DataTable TrafficTypeID_intDataTable = new DataTable(); TrafficTypeID_intFactory.GetAll(ref TrafficTypeID_intDataTable); this.TrafficTypeID_intComboBox.DisplayMember = HPS.BLL.TrafficTypeBLL.BLLTrafficType_T.TrafficType_TField.TrafficType_nvc.ToString(); this.TrafficTypeID_intComboBox.ValueMember = HPS.BLL.TrafficTypeBLL.BLLTrafficType_T.TrafficType_TField.TrafficTypeID_int.ToString(); this.TrafficTypeID_intComboBox.DataSource = TrafficTypeID_intDataTable; this.TrafficTypeID_intComboBox.SelectedIndex = -1; } catch (Exception ex) { throw ex; } }
private void uiButton1_Click(object sender, EventArgs e) { try { if ((FromDatefaDatePicker.IsNull) && (string.IsNullOrEmpty(FromTrafficNumbertxt.Text) || string.IsNullOrEmpty(ToTrafficNumbertxt.Text))) { throw new ApplicationException("از تاریخ خالی است"); } else if ((ToDatefaDatePicker.IsNull && (string.IsNullOrEmpty(FromTrafficNumbertxt.Text) || string.IsNullOrEmpty(ToTrafficNumbertxt.Text)))) { 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.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); } 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); } object[] LaderTypeList = new object[100]; string LaderTypeList_nvc = string.Empty; int index = 0; LaderTypeList = LaderTypecheckedComboBox.CheckedValues; if (LaderTypeList != null) { foreach (object obj in LaderTypeList) { LaderTypeList_nvc = string.Format("{0},{1}", LaderTypeList_nvc, LaderTypeList[index].ToString()); index += 1; } LaderTypeList_nvc = LaderTypeList_nvc.Substring(1, LaderTypeList_nvc.Length - 1); } object[] ServiceList = new object[100]; string ServiceList_nvc = string.Empty; int Serviceindex = 0; ServiceList = this.ServicescheckedComboBox.CheckedValues; if (ServiceList != null) { foreach (object obj in ServiceList) { ServiceList_nvc = string.Format("{0},{1}", ServiceList_nvc, ServiceList[Serviceindex].ToString()); Serviceindex += 1; } ServiceList_nvc = ServiceList_nvc.Substring(1, ServiceList_nvc.Length - 1); } GroupTrafficstiReport.Dictionary.Synchronize(); GroupTrafficstiReport.Dictionary.Databases.Clear(); GroupTrafficstiReport.Dictionary.Databases.Add(new Stimulsoft.Report.Dictionary.StiSqlDatabase("Connection", Hepsa.Core.Common.ConnectionString.ConnectionString)); GroupTrafficstiReport.Compile(); GroupTrafficstiReport["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(); GroupTrafficstiReport["fromdate_vc"] = FromDatefaDatePicker.Text; GroupTrafficstiReport["todate_vc"] = ToDatefaDatePicker.Text; GroupTrafficstiReport["fromtime_nvc"] = FromTimeTextBox.Text; GroupTrafficstiReport["totime_nvc"] = ToTimeTextBox.Text; GroupTrafficstiReport["date_vc"] = PortPlaceFactory.ServerJalaliDate; GroupTrafficstiReport["UserName_vc"] = HPS.Common.CurrentUser.user.UserName_nvc; GroupTrafficstiReport["fromTrafficNumber"] = FromTrafficNumbertxt.Text; GroupTrafficstiReport["toTrafficNumber"] = ToTrafficNumbertxt.Text; if (string.IsNullOrEmpty(FromDatefaDatePicker.Text)) { GroupTrafficstiReport["@FromDateTime_nvc"] = DBNull.Value; } else { GroupTrafficstiReport["@FromDateTime_nvc"] = FromDatefaDatePicker.Text + ' ' + FromTimeTextBox.Text; } if (string.IsNullOrEmpty(ToDatefaDatePicker.Text)) { GroupTrafficstiReport["@ToDateTime_nvc"] = DBNull.Value; } else { GroupTrafficstiReport["@ToDateTime_nvc"] = ToDatefaDatePicker.Text + ' ' + ToTimeTextBox.Text; } if (string.IsNullOrEmpty(LaderTypeList_nvc)) { GroupTrafficstiReport["@LaderTypeID_nvc"] = DBNull.Value; } else { GroupTrafficstiReport["@LaderTypeID_nvc"] = Convert.ToString(LaderTypeList_nvc); } if (InTrafficradioButton.Checked) { GroupTrafficstiReport["@TrafficInbit_nvc"] = 1; GroupTrafficstiReport["@TrafficOutbit_nvc"] = DBNull.Value; GroupTrafficstiReport["TrafficType"] = "ورودی"; } else if (OutTrafficradioButton.Checked) { GroupTrafficstiReport["@TrafficInbit_nvc"] = DBNull.Value; GroupTrafficstiReport["@TrafficOutbit_nvc"] = 1; GroupTrafficstiReport["TrafficType"] = "خروجی"; } else { MessageBox.Show("نوع تردد ورودی یا خروجی بایستی انتخاب شود"); } if (string.IsNullOrEmpty(ServiceList_nvc)) { GroupTrafficstiReport["@ServiceID_nvc"] = DBNull.Value; } else { GroupTrafficstiReport["@ServiceID_nvc"] = Convert.ToString(ServiceList_nvc); } if (string.IsNullOrEmpty(FromTrafficNumbertxt.Text)) { GroupTrafficstiReport["@FromTrafficNumber_nvc"] = DBNull.Value; } else { GroupTrafficstiReport["@FromTrafficNumber_nvc"] = FromTrafficNumbertxt.Text; } if (string.IsNullOrEmpty(ToTrafficNumbertxt.Text)) { GroupTrafficstiReport["@ToTrafficNumber_nvc"] = DBNull.Value; } else { GroupTrafficstiReport["@ToTrafficNumber_nvc"] = ToTrafficNumbertxt.Text; } GroupTrafficstiReport.Render(); stiViewerControl1.Report = GroupTrafficstiReport; } 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); } }
private void StimulViewer_Load(object sender, EventArgs e) { //try //{ if (_Traffic_bit == false && _Othercar_bit == false) { AcceptedTurnstiReport.Dictionary.Synchronize(); AcceptedTurnstiReport.Dictionary.Databases.Clear(); AcceptedTurnstiReport.Dictionary.Databases.Add(new Stimulsoft.Report.Dictionary.StiSqlDatabase("Connection", Hepsa.Core.Common.ConnectionString.ConnectionString)); AcceptedTurnstiReport.Compile(); AcceptedTurnstiReport["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(); HPS.BLL.BillMessageBLL.BLLBillMessage_TFactory BillFactory = new HPS.BLL.BillMessageBLL.BLLBillMessage_TFactory(); if (TrafficEntity.BillMessageID_int == 0 || TrafficEntity.BillMessageID_int == null) { } else { string Billcondition = "[BillMessage_T].[BillMessageID_int]=" + TrafficEntity.BillMessageID_int; List <HPS.BLL.BillMessageBLL.BLLBillMessage_T> BillLst = BillFactory.GetAllByCondition(Billcondition); if (BillLst != null) { AcceptedTurnstiReport["Messagetxt"] = BillLst[0].Message_nvc; AcceptedTurnstiReport["Message_bit"] = true; } else { AcceptedTurnstiReport["Message_bit"] = false; } } NumericTextBox txt = new NumericTextBox(); txt.DigitsInGroup = 3; if (TrafficEntity.Price_dec != null) { txt.Text = TrafficEntity.Price_dec.ToString(); AcceptedTurnstiReport["Price_nvc"] = " مبلغ دریافت شده هنگام ورود " + txt.Text + " ريال می باشد"; } if (TrafficEntity.Price_dec != null) { AcceptedTurnstiReport["PricewithOutTax_nvc"] = (TrafficEntity.Price_dec - TrafficEntity.PriceTax_dec).ToString(); } if (!string.IsNullOrEmpty(TrafficEntity.AcceptedTurnComment_nvc)) { if (TrafficEntity.Area_bit) { AcceptedTurnstiReport["Comment_nvc"] = "توضيحات : " + TrafficEntity.AcceptedTurnComment_nvc;// +" حومه"; } else { AcceptedTurnstiReport["Comment_nvc"] = "توضيحات : " + TrafficEntity.AcceptedTurnComment_nvc; } } else { //if (TrafficEntity.Area_bit) //{ // AcceptedTurnstiReport["Comment_nvc"] = "حومه"; //} } if (TrafficEntity.TurnPrinted_bit == true) { AcceptedTurnstiReport["PrintedAgain_nvc"] = "المثنی"; } else { AcceptedTurnstiReport["PrintedAgain_nvc"] = ""; } HPS.BLL.PlateCityBLL.BLLPlateCity_TFactory PlatecityFactory = new HPS.BLL.PlateCityBLL.BLLPlateCity_TFactory(); HPS.BLL.PlateCityBLL.BLLPlateCity_TKeys Platecitykey = new HPS.BLL.PlateCityBLL.BLLPlateCity_TKeys(); Platecitykey.PlateCityID_int = TrafficEntity.PlateCityID_int; HPS.BLL.PlateCityBLL.BLLPlateCity_T PlateCityEntity = new HPS.BLL.PlateCityBLL.BLLPlateCity_T(); PlateCityEntity = PlatecityFactory.GetBy(Platecitykey); if (PlateCityEntity != null) { AcceptedTurnstiReport["Number_nvc"] = "شماره پلاک : " + Hepsa.Core.Common.PersentationController.CorrectNumberPlate(TrafficEntity.NumberPlate_nvc) + " - " + PlateCityEntity.PlateCity_nvc + " " + TrafficEntity.SerialPlate_nvc; } else { AcceptedTurnstiReport["Number_nvc"] = "شماره پلاک : " + Hepsa.Core.Common.PersentationController.CorrectNumberPlate(TrafficEntity.NumberPlate_nvc) + " - " + TrafficEntity.SerialPlate_nvc; } if (TrafficEntity.LadeReturn_bit == true) { AcceptedTurnstiReport["TurnNumber"] = "برگشت از بار"; } else { if (TrafficEntity.AcceptedTurnNumber_bint.HasValue) { AcceptedTurnstiReport["TurnNumber"] = "شماره نوبت : " + TrafficEntity.AcceptedTurnNumber_bint.ToString(); } else { AcceptedTurnstiReport["TurnNumber"] = "شماره نوبت رزرو : " + TrafficEntity.TurnNumber_bint.ToString(); } } AcceptedTurnstiReport["TrafficNumber"] = " شماره قبض پارکینگ: " + TrafficEntity.TrafficNumber_bint.ToString(); AcceptedTurnstiReport["InDate_vc"] = TrafficEntity.Date_nvc; AcceptedTurnstiReport["InTime_vc"] = TrafficEntity.Time_nvc; AcceptedTurnstiReport["Time_vc"] = PortPlaceFactory.ServerTime; AcceptedTurnstiReport["Date_vc"] = PortPlaceFactory.ServerJalaliDate; AcceptedTurnstiReport["username_nvc"] = HPS.Common.CurrentUser.user.UserName_nvc; HPS.BLL.LaderTypeBLL.BLLLaderType_TFactory laderTypeFactory = new HPS.BLL.LaderTypeBLL.BLLLaderType_TFactory(); string LaderTypecondition = "[LaderType_T].[LaderTypeID_int]='" + TrafficEntity.LaderTypeID_int + "'"; AcceptedTurnstiReport["@TrafficID_bint"] = TrafficEntity.TrafficID_bint; AcceptedTurnstiReport["@Condition"] = LaderTypecondition; AcceptedTurnstiReport.Render(); Properties.Settings s = new HPS.Properties.Settings(); System.Drawing.Printing.PrinterSettings PrinterSetting = new System.Drawing.Printing.PrinterSettings(); if (string.IsNullOrEmpty(s.PrinterName)) { AcceptedTurnstiReport.Print(true); } else { PrinterSetting.PrinterName = s.PrinterName; AcceptedTurnstiReport.Print(false, PrinterSetting); } this.Close(); } else if (_Traffic_bit == true && _Othercar_bit == false) { TrafficstiReport.Dictionary.Synchronize(); TrafficstiReport.Dictionary.Databases.Clear(); TrafficstiReport.Dictionary.Databases.Add(new Stimulsoft.Report.Dictionary.StiSqlDatabase("Connection", Hepsa.Core.Common.ConnectionString.ConnectionString)); TrafficstiReport.Compile(); TrafficstiReport["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(); HPS.BLL.BillMessageBLL.BLLBillMessage_TFactory BillFactory = new HPS.BLL.BillMessageBLL.BLLBillMessage_TFactory(); if (TrafficEntity.BillMessageID_int == 0 || TrafficEntity.BillMessageID_int == null) { } else { string Billcondition = "[BillMessage_T].[BillMessageID_int]=" + TrafficEntity.BillMessageID_int; List <HPS.BLL.BillMessageBLL.BLLBillMessage_T> BillLst = BillFactory.GetAllByCondition(Billcondition); if (BillLst != null) { TrafficstiReport["Messagetxt"] = BillLst[0].Message_nvc; TrafficstiReport["Message_bit"] = true; } else { TrafficstiReport["Message_bit"] = false; } } NumericTextBox txt = new NumericTextBox(); txt.DigitsInGroup = 3; if (TrafficEntity.Price_dec != null) { txt.Text = TrafficEntity.Price_dec.ToString(); TrafficstiReport["Price_nvc"] = " مبلغ دریافت شده هنگام ورود " + txt.Text + " ريال می باشد"; } if (!string.IsNullOrEmpty(TrafficEntity.AcceptedTurnComment_nvc)) { if (TrafficEntity.Area_bit) { TrafficstiReport["Comment_nvc"] = "توضيحات : " + TrafficEntity.AcceptedTurnComment_nvc;// +" حومه"; } else { TrafficstiReport["Comment_nvc"] = "توضيحات : " + TrafficEntity.AcceptedTurnComment_nvc; } } else { //if (TrafficEntity.Area_bit) //{ // TrafficstiReport["Comment_nvc"] = "حومه"; //} } if (TrafficEntity.TurnPrinted_bit == true) { TrafficstiReport["PrintedAgain_nvc"] = "المثنی"; } else { TrafficstiReport["PrintedAgain_nvc"] = ""; } HPS.BLL.PlateCityBLL.BLLPlateCity_TFactory PlatecityFactory = new HPS.BLL.PlateCityBLL.BLLPlateCity_TFactory(); HPS.BLL.PlateCityBLL.BLLPlateCity_TKeys Platecitykey = new HPS.BLL.PlateCityBLL.BLLPlateCity_TKeys(); Platecitykey.PlateCityID_int = TrafficEntity.PlateCityID_int; HPS.BLL.PlateCityBLL.BLLPlateCity_T PlateCityEntity = new HPS.BLL.PlateCityBLL.BLLPlateCity_T(); PlateCityEntity = PlatecityFactory.GetBy(Platecitykey); if (PlateCityEntity != null) { TrafficstiReport["Number_nvc"] = "شماره پلاک : " + Hepsa.Core.Common.PersentationController.CorrectNumberPlate(TrafficEntity.NumberPlate_nvc) + " - " + PlateCityEntity.PlateCity_nvc + " " + TrafficEntity.SerialPlate_nvc; } else { TrafficstiReport["Number_nvc"] = "شماره پلاک : " + Hepsa.Core.Common.PersentationController.CorrectNumberPlate(TrafficEntity.NumberPlate_nvc) + " - " + TrafficEntity.SerialPlate_nvc; } if (TrafficEntity.ServiceID_int == 2) { if (TrafficEntity.TurnAccepted_bit == true) { //نوبت تأیید شده داره TrafficstiReport["TurnNumber"] = "شماره نوبت : " + Convert.ToString(TrafficEntity.AcceptedTurnNumber_bint); //AcceptedDate2TextBox.Text = TrafficEntityrpt.TurnDate_nvc; //AcceptedTime2TextBox.Text = TrafficEntityrpt.TurnTime_nvc; //TurnNumber2txt.Text = TrafficEntityrpt.AcceptedTurnNumber_bint.ToString(); } else { //نوبت تأیید شده ندارد TrafficstiReport["TurnNumber"] = "شماره نوبت رزرو : " + Convert.ToString(TrafficEntity.TurnNumber_bint); } } else { // (عدم نمایش نوبت (مراجعه به غیر از نوبت TrafficstiReport["TurnNumber"] = ""; } TrafficstiReport["TrafficNumber"] = "شماره قبض پارکینگ : " + TrafficEntity.TrafficNumber_bint.ToString(); HPS.BLL.SettingsBLL.BLLSetting_TFactory settingsFactory = new HPS.BLL.SettingsBLL.BLLSetting_TFactory(); HPS.BLL.SettingsBLL.BLLSetting_T SettingEntity = new HPS.BLL.SettingsBLL.BLLSetting_T(); HPS.BLL.SettingsBLL.BLLSetting_TKeys SettingKey = new HPS.BLL.SettingsBLL.BLLSetting_TKeys(); SettingKey.SettingID_int = 1002; SettingEntity = settingsFactory.GetBy(SettingKey); if (TrafficEntity.ServiceID_int == 2) { TrafficstiReport["TAllowableHour"] = SettingEntity.Value_nvc; //TrafficEntityrpt.AllowableHour_int.ToString(); } else { TrafficstiReport["TAllowableHour"] = TrafficEntity.AllowableHour_int.ToString(); } HPS.BLL.ServicesBLL.BLLServices_TFactory servicesFactory = new HPS.BLL.ServicesBLL.BLLServices_TFactory(); HPS.BLL.ServicesBLL.BLLServices_TKeys ServicesKey = new HPS.BLL.ServicesBLL.BLLServices_TKeys(); ServicesKey.ServicesID_int = TrafficEntity.ServiceID_int; HPS.BLL.ServicesBLL.BLLServices_T ServicesEntity = new HPS.BLL.ServicesBLL.BLLServices_T(); ServicesEntity = servicesFactory.GetBy(ServicesKey); TrafficstiReport["system_nvc"] = " قبض مراجعه به : " + ServicesEntity.ServicesType_nvc; if (TrafficEntity.WithLade_bit == true) { TrafficstiReport["WithLade_nvc"] = "وضعیت : " + "با بار" + "(" + TrafficEntity.Comment_nvc + ") "; } else { TrafficstiReport["WithLade_nvc"] = "وضعیت : " + "بدون بار"; } if (TrafficEntity.TurnHour_int != null) { TrafficstiReport["TurnNumberAllert_nvc"] = " شماره نوبت شما رزرو می باشد لطفاً تا " + TrafficEntity.TurnHour_int.ToString() + " ساعت نسبت به تأیید آن اقدام نمایید"; } TrafficstiReport["InDate_vc"] = TrafficEntity.Date_nvc; TrafficstiReport["InTime_vc"] = TrafficEntity.Time_nvc; TrafficstiReport["Time_vc"] = PortPlaceFactory.ServerTime; TrafficstiReport["Date_vc"] = PortPlaceFactory.ServerJalaliDate; TrafficstiReport["username_nvc"] = HPS.Common.CurrentUser.user.UserName_nvc; HPS.BLL.LaderTypeBLL.BLLLaderType_TFactory laderTypeFactory = new HPS.BLL.LaderTypeBLL.BLLLaderType_TFactory(); string LaderTypecondition = "[LaderType_T].[LaderTypeID_int]='" + TrafficEntity.LaderTypeID_int + "'"; TrafficstiReport["@TrafficID_bint"] = TrafficEntity.TrafficID_bint; TrafficstiReport["@Condition"] = LaderTypecondition; TrafficstiReport.Render(); Properties.Settings s = new HPS.Properties.Settings(); System.Drawing.Printing.PrinterSettings PrinterSetting = new System.Drawing.Printing.PrinterSettings(); if (string.IsNullOrEmpty(s.PrinterName)) { TrafficstiReport.Print(true); } else { PrinterSetting.PrinterName = s.PrinterName; TrafficstiReport.Print(false, PrinterSetting); } this.Close(); } //سواری وغیره else if (_Traffic_bit == false && _Othercar_bit == true) { //HPS.BLL.TrafficBLL.BLLTraffic_T TrafficEntityrpt = new HPS.BLL.TrafficBLL.BLLTraffic_T(); OtherCarstiReport.Dictionary.Synchronize(); OtherCarstiReport.Dictionary.Databases.Clear(); OtherCarstiReport.Dictionary.Databases.Add(new Stimulsoft.Report.Dictionary.StiSqlDatabase("Connection", Hepsa.Core.Common.ConnectionString.ConnectionString)); OtherCarstiReport.Compile(); OtherCarstiReport["organ"] = new HPS.BLL.SettingsBLL.BLLSetting_TFactory().GetBy(new BLL.SettingsBLL.BLLSetting_TKeys() { SettingID_int = 1029 }).Value_nvc.ToString(); OtherCarstiReport["DateTextBox"] = TrafficEntity.Date_nvc; OtherCarstiReport["TimeTextBox"] = TrafficEntity.Time_nvc; OtherCarstiReport["TrafficNumbertxt"] = TrafficEntity.TrafficNumber_bint.ToString(); OtherCarstiReport["Servicestxt"] = " مراجعه به : " + TrafficEntity.Services_nvc; OtherCarstiReport["CarTypetxt"] = "نوع وسیله : " + TrafficEntity.System_nvc; HPS.BLL.PlateCityBLL.BLLPlateCity_TFactory PlateCityFactory = new HPS.BLL.PlateCityBLL.BLLPlateCity_TFactory(); HPS.BLL.PlateCityBLL.BLLPlateCity_T PlatecityEntity = new HPS.BLL.PlateCityBLL.BLLPlateCity_T(); HPS.BLL.PlateCityBLL.BLLPlateCity_TKeys PlateCityKey = new HPS.BLL.PlateCityBLL.BLLPlateCity_TKeys(); PlateCityKey.PlateCityID_int = TrafficEntity.PlateCityID_int; PlatecityEntity = PlateCityFactory.GetBy(PlateCityKey); OtherCarstiReport["NumberPlatetxt"] = "شماره پلاک : " + Hepsa.Core.Common.PersentationController.CorrectNumberPlate(TrafficEntity.NumberPlate_nvc) + " - " + PlatecityEntity.PlateCity_nvc + " " + TrafficEntity.SerialPlate_nvc; HPS.BLL.BillMessageBLL.BLLBillMessage_TFactory BillFactory = new HPS.BLL.BillMessageBLL.BLLBillMessage_TFactory(); if (TrafficEntity.BillMessageID_int == 0 || TrafficEntity.BillMessageID_int == null) { OtherCarstiReport["Messagetxt"] = ""; } else { string Billcondition = "[BillMessage_T].[BillMessageID_int]=" + TrafficEntity.BillMessageID_int; List <HPS.BLL.BillMessageBLL.BLLBillMessage_T> BillLst = BillFactory.GetAllByCondition(Billcondition); if (BillLst != null) { OtherCarstiReport["Messagetxt"] = BillLst[0].Message_nvc; } else { OtherCarstiReport["Messagetxt"] = ""; } } NumericTextBox txt = new NumericTextBox(); txt.DigitsInGroup = 3; if (TrafficEntity.Price_dec != null) { txt.Text = TrafficEntity.Price_dec.ToString(); OtherCarstiReport["Pricetxt"] = " مبلغ دریافتی هنگام ورود " + txt.Text + " ريال می باشد"; } OtherCarstiReport["AllowableHourtxt"] = TrafficEntity.AllowableHour_int.ToString(); OtherCarstiReport["ExtraHourtxt"] = TrafficEntity.ExtraHour_int.ToString(); txt.Text = TrafficEntity.Fee_dec.ToString(); OtherCarstiReport["Feetxt"] = txt.Text; txt.Text = TrafficEntity.ExtraHourFee_dec.ToString(); OtherCarstiReport["ExtraHourFeetxt"] = txt.Text; OtherCarstiReport["UserNametxt"] = TrafficEntity.UserName_nvc; OtherCarstiReport["TrafficNumberbarcode"] = TrafficEntity.TrafficNumber_bint.ToString(); if (TrafficEntity.Printed_bit == true) { OtherCarstiReport["txtPrintedAgain"] = "المثنی"; } else { OtherCarstiReport["txtPrintedAgain"] = ""; } //DriverName_nvc OtherCarstiReport["DriverName_nvc"] = "نام راننده : " + TrafficEntity.FirstName_nvc + " " + TrafficEntity.LastName_nvc; OtherCarstiReport["Fee_dec"] = TrafficEntity.Fee_dec.ToString(); OtherCarstiReport["PriceTax_dec"] = TrafficEntity.PriceTax_dec.ToString(); OtherCarstiReport.Render(); Properties.Settings s = new HPS.Properties.Settings(); System.Drawing.Printing.PrinterSettings PrinterSetting = new System.Drawing.Printing.PrinterSettings(); if (string.IsNullOrEmpty(s.PrinterName)) { OtherCarstiReport.Print(true); } else { PrinterSetting.PrinterName = s.PrinterName; OtherCarstiReport.Print(false, PrinterSetting); } this.Close(); } //خارجی else if (_Traffic_bit == true && _Othercar_bit == true) { //HPS.BLL.TrafficBLL.BLLTraffic_T TrafficEntityrpt = new HPS.BLL.TrafficBLL.BLLTraffic_T(); ForeignCarstiReport.Dictionary.Synchronize(); ForeignCarstiReport.Dictionary.Databases.Clear(); ForeignCarstiReport.Dictionary.Databases.Add(new Stimulsoft.Report.Dictionary.StiSqlDatabase("Connection", Hepsa.Core.Common.ConnectionString.ConnectionString)); ForeignCarstiReport.Compile(); ForeignCarstiReport["organ"] = new HPS.BLL.SettingsBLL.BLLSetting_TFactory().GetBy(new BLL.SettingsBLL.BLLSetting_TKeys() { SettingID_int = 1029 }).Value_nvc.ToString(); ForeignCarstiReport["DateTextBox"] = TrafficEntity.Date_nvc; ForeignCarstiReport["TimeTextBox"] = TrafficEntity.Time_nvc; ForeignCarstiReport["TrafficNumbertxt"] = TrafficEntity.TrafficNumber_bint.ToString(); ForeignCarstiReport["DriverNametxt"] = " نام راننده : " + TrafficEntity.FirstName_nvc + " " + TrafficEntity.LastName_nvc; HPS.BLL.LaderTypeBLL.BLLLaderType_TFactory laderTypeFactory = new HPS.BLL.LaderTypeBLL.BLLLaderType_TFactory(); string LaderTypecondition = "[LaderType_T].[LaderTypeID_int]='" + TrafficEntity.LaderTypeID_int + "'"; List <HPS.BLL.LaderTypeBLL.BLLLaderType_T> LaderTypeLst = laderTypeFactory.GetAllByCondition(LaderTypecondition); if (LaderTypeLst != null) { ForeignCarstiReport["CarTypetxt"] = "نوع وسيله : " + TrafficEntity.System_nvc + "- " + LaderTypeLst[0].LaderType_nvc; } if (!string.IsNullOrEmpty(TrafficEntity.SerialPlate_nvc)) { ForeignCarstiReport["NumberPlatetxt"] = "شماره پلاک : " + Hepsa.Core.Common.PersentationController.CorrectNumberPlate(TrafficEntity.NumberPlate_nvc) + " - " + TrafficEntity.SerialPlate_nvc; } else { ForeignCarstiReport["NumberPlatetxt"] = "شماره پلاک : " + Hepsa.Core.Common.PersentationController.CorrectNumberPlate(TrafficEntity.NumberPlate_nvc); } if (TrafficEntity.WithLade_bit == true) { ForeignCarstiReport["WithLadetxt"] = "وضعیت : " + "با بار" + "(" + TrafficEntity.Comment_nvc + ") "; } else { ForeignCarstiReport["WithLadetxt"] = "وضعیت : " + "بدون بار"; } NumericTextBox txt = new NumericTextBox(); txt.DigitsInGroup = 3; if (TrafficEntity.Price_dec != null) { txt.Text = TrafficEntity.Price_dec.ToString(); ForeignCarstiReport["Pricetxt"] = " مبلغ دریافتی هنگام ورود " + txt.Text + " ريال می باشد"; } ForeignCarstiReport["AllowableHourtxt"] = TrafficEntity.AllowableHour_int.ToString(); ForeignCarstiReport["ExtraHourtxt"] = TrafficEntity.ExtraHour_int.ToString(); txt.Text = TrafficEntity.Fee_dec.ToString(); ForeignCarstiReport["Feetxt"] = txt.Text; txt.Text = TrafficEntity.ExtraHourFee_dec.ToString(); ForeignCarstiReport["ExtraHourFeetxt"] = txt.Text; ForeignCarstiReport["UserNametxt"] = TrafficEntity.UserName_nvc; ForeignCarstiReport["TrafficNumberbarcode"] = TrafficEntity.TrafficNumber_bint.ToString(); if (TrafficEntity.Printed_bit == true) { ForeignCarstiReport["txtPrintedAgain"] = "المثنی"; } else { ForeignCarstiReport["txtPrintedAgain"] = ""; } ForeignCarstiReport["Fee_dec"] = TrafficEntity.Fee_dec.ToString(); ForeignCarstiReport["PriceTax_dec"] = TrafficEntity.PriceTax_dec.ToString(); ForeignCarstiReport.Render(); Properties.Settings s = new HPS.Properties.Settings(); System.Drawing.Printing.PrinterSettings PrinterSetting = new System.Drawing.Printing.PrinterSettings(); if (string.IsNullOrEmpty(s.PrinterName)) { ForeignCarstiReport.Print(true); } else { PrinterSetting.PrinterName = s.PrinterName; ForeignCarstiReport.Print(false, PrinterSetting); } this.Close(); } else if (_type == "dublicateTurns") { BLL.TrafficBLL.BLLTraffic_TFactory trafficFactory = new HPS.BLL.TrafficBLL.BLLTraffic_TFactory(); DataTable duplicateTurnDataTable = new DataTable(); trafficFactory.DuplicateTurnsReport(duplicateTurnDataTable); stiViewerControl1.Report = _sti; DuplicateTurnsReport.Dictionary.Synchronize(); DuplicateTurnsReport.Dictionary.Databases.Clear(); DuplicateTurnsReport.Dictionary.Databases.Add(new Stimulsoft.Report.Dictionary.StiSqlDatabase("Connection", Hepsa.Core.Common.ConnectionString.ConnectionString)); DuplicateTurnsReport.Compile(); DuplicateTurnsReport["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(); DuplicateTurnsReport["date_vc"] = PortPlaceFactory.ServerJalaliDate + " " + PortPlaceFactory.ServerTime;; DuplicateTurnsReport["userName_vc"] = HPS.Common.CurrentUser.user.UserName_nvc; DuplicateTurnsReport.Render(); DuplicateTurnsReport.Show(); } else if (_again == 1) { HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory LadBillCreditFactory = new HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory(); HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TKeys LadBillKey = new HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TKeys(); LadBillKey.LadBillCreditID_int = _LadBIillCreditID; DataTable LadBillLadeAssignmentDataTable = new DataTable(); LadBillCreditFactory.GetAllLadeAssignment(LadBillKey, ref LadBillLadeAssignmentDataTable); Stimulsoft.Report.StiReport LadBillReportstiReport = new Stimulsoft.Report.StiReport(); LadBillReportstiReport.Load(Application.StartupPath + "\\LadBillCredit.mrt"); LadBillReportstiReport.Dictionary.Synchronize(); LadBillReportstiReport.Dictionary.Databases.Clear(); LadBillReportstiReport.Dictionary.Databases.Add(new Stimulsoft.Report.Dictionary.StiSqlDatabase("Connection", Hepsa.Core.Common.ConnectionString.ConnectionString)); LadBillReportstiReport.Compile(); LadBillReportstiReport["organ"] = new HPS.BLL.SettingsBLL.BLLSetting_TFactory().GetBy(new BLL.SettingsBLL.BLLSetting_TKeys() { SettingID_int = 1029 }).Value_nvc.ToString(); if (!string.IsNullOrEmpty(LadBillLadeAssignmentDataTable.Rows[0]["DriverCardNumber_nvc"].ToString())) { LadBillReportstiReport["DriverCardNumber_vc"] = " کارت هوشمند راننده: " + LadBillLadeAssignmentDataTable.Rows[0]["DriverCardNumber_nvc"].ToString(); } else { LadBillReportstiReport["DriverCardNumber_vc"] = " کارت هوشمند راننده:فاقد كارت "; } if (!string.IsNullOrEmpty(LadBillLadeAssignmentDataTable.Rows[0]["CarCardNumber_nvc"].ToString())) { LadBillReportstiReport["CarCardNumber_vc"] = " کارت هوشمند کامیون : " + LadBillLadeAssignmentDataTable.Rows[0]["CarCardNumber_nvc"].ToString(); } else { LadBillReportstiReport["CarCardNumber_vc"] = " کارت هوشمند کامیون :فاقد كارت "; } LadBillReportstiReport["MobileNumber_vc"] = string.Format("موبایل راننده: {0}", LadBillLadeAssignmentDataTable.Rows[0]["DriverMobileNumber_nvc"].ToString()); LadBillReportstiReport["Company_nvc"] = LadBillLadeAssignmentDataTable.Rows[0]["CompanyID_intCompany_nvc"].ToString() + "(" + LadBillLadeAssignmentDataTable.Rows[0]["CompanyCode_nvc"].ToString() + ")" + "(" + LadBillLadeAssignmentDataTable.Rows[0]["Phone_nvc"].ToString() + ")"; //Cmp_nvc LadBillReportstiReport["LaderType_nvc"] = LadBillLadeAssignmentDataTable.Rows[0]["LaderTypeID_intLaderType_nvc"].ToString(); LadBillReportstiReport["Boxing_nvc"] = LadBillLadeAssignmentDataTable.Rows[0]["BoxingID_intBoxingType_nvc"].ToString(); //LaderType LadBillReportstiReport["PlateNumber_nvc"] = Hepsa.Core.Common.PersentationController.CorrectNumberPlate(LadBillLadeAssignmentDataTable.Rows[0]["NumberPlate_nvc"].ToString()) + " - " + LadBillLadeAssignmentDataTable.Rows[0]["PlateCity_nvc"].ToString() + LadBillLadeAssignmentDataTable.Rows[0]["SerialPlate_nvc"].ToString(); //Plaque LadBillReportstiReport["DriverName_nvc"] = LadBillLadeAssignmentDataTable.Rows[0]["DriverName"].ToString(); //Driver LadBillReportstiReport["LicenceNumber_bint"] = (LadBillLadeAssignmentDataTable.Rows[0]["licenceNumber_int"] != DBNull.Value?Convert.ToInt64(LadBillLadeAssignmentDataTable.Rows[0]["licenceNumber_int"]):0); //LicenceNumber LadBillReportstiReport["LicenceCity_nvc"] = LadBillLadeAssignmentDataTable.Rows[0]["LicenceCityID_intCity_nvc"].ToString(); //LicenceCity LadBillReportstiReport["Good_nvc"] = LadBillLadeAssignmentDataTable.Rows[0]["GoodID_intGood_nvc"].ToString(); //Good LadBillReportstiReport["Date_vc"] = LadBillLadeAssignmentDataTable.Rows[0]["LadingDate_nvc"].ToString(); // LadBillReportstiReport["Destination_nvc"] = LadBillLadeAssignmentDataTable.Rows[0]["CityID_intCity_nvc"].ToString() + "-" + LadBillLadeAssignmentDataTable.Rows[0]["Address_nvc"].ToString(); LadBillReportstiReport["PortajeFee_dec"] = LadBillLadeAssignmentDataTable.Rows[0]["PortageFee_dec"].ToString(); LadBillReportstiReport["AssignmentComment_nvc"] = LadBillLadeAssignmentDataTable.Rows[0]["AssignmentComment_nvc"].ToString(); LadBillReportstiReport["Date_vc"] = LadBillLadeAssignmentDataTable.Rows[0]["LadBillDate"].ToString(); LadBillReportstiReport["Time_vc"] = LadBillLadeAssignmentDataTable.Rows[0]["LadBillTime"].ToString(); LadBillReportstiReport["TurnNumber_bint"] = Convert.ToInt64(LadBillLadeAssignmentDataTable.Rows[0]["AcceptedTurnNumber_bint"]); LadBillReportstiReport["LadBillNumber_bint"] = Convert.ToInt64(LadBillLadeAssignmentDataTable.Rows[0]["LadBillCreditID_int"]); LadBillReportstiReport["UserName_nvc"] = LadBillLadeAssignmentDataTable.Rows[0]["LadBillUser"].ToString(); LadBillReportstiReport["PortPlace_nvc"] = LadBillLadeAssignmentDataTable.Rows[0]["PortPlaceID_intPortPlaces_nvc"].ToString(); LadBillReportstiReport["MinWeight_nvc"] = "از وزن: " + LadBillLadeAssignmentDataTable.Rows[0]["MinWeight_dec"]; LadBillReportstiReport["MaxWeight_nvc"] = "تا وزن: " + LadBillLadeAssignmentDataTable.Rows[0]["MaxWeight_dec"]; LadBillReportstiReport["TrafficNumber_bint"] = Convert.ToInt64(LadBillLadeAssignmentDataTable.Rows[0]["TrafficNumber_bint"]); LadBillReportstiReport["System_nvc"] = LadBillLadeAssignmentDataTable.Rows[0]["System_nvc"].ToString(); HPS.BLL.BillMessageBLL.BLLBillMessage_TFactory BillMessage_TFactory = new HPS.BLL.BillMessageBLL.BLLBillMessage_TFactory(); List <HPS.BLL.BillMessageBLL.BLLBillMessage_T> BillMessage_TList = new List <HPS.BLL.BillMessageBLL.BLLBillMessage_T>(); string Condition = string.Format("TrafficType_T.TrafficTypeID_int=9 AND [BillMessage_T].StartDate_nvc<='{0}' AND [BillMessage_T].[EndDate_nvc]>='{0}' ", BillMessage_TFactory.ServerJalaliDate); BillMessage_TList = BillMessage_TFactory.GetAllByCondition(Condition); if (BillMessage_TList != null && BillMessage_TList.Count > 0) { LadBillReportstiReport["BillMessage_nvc"] = BillMessage_TList[0].Message_nvc; } if (_again != 1) { if (LadBillLadeAssignmentDataTable.Rows[0]["LadeDate"].ToString().CompareTo(LadBillCreditFactory.ServerJalaliDate) < 0) { LadBillReportstiReport["Remained_bit"] = true; } else { LadBillReportstiReport["Remained_bit"] = false; } } if (_again == 1) { LadBillReportstiReport["Again_bit"] = true; LadBillReportstiReport["AgainPrintDate_vc"] = LadBillCreditFactory.ServerJalaliDate; LadBillReportstiReport["AgainPrintTime_vc"] = LadBillCreditFactory.ServerTime; LadBillReportstiReport["AgainPrintUser_vnc"] = HPS.Common.CurrentUser.user.UserName_nvc; } LadBillReportstiReport.Render(); Properties.Settings s = new HPS.Properties.Settings(); System.Drawing.Printing.PrinterSettings PrinterSetting = new System.Drawing.Printing.PrinterSettings(); if (string.IsNullOrEmpty(s.PrinterName)) { LadBillReportstiReport.PrinterSettings.Copies = 3; LadBillReportstiReport.Print(true); } else { LadBillReportstiReport.PrinterSettings.Copies = 3; PrinterSetting.PrinterName = s.PrinterName; LadBillReportstiReport.Print(false, PrinterSetting); } } else { stiViewerControl1.Report = _sti; } this.Close(); }
private void ShowButton_Click(object sender, EventArgs e) { 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.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); } 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); } object[] PortPlaceList = new object[100]; string PortPlaceList_nvc = string.Empty; int index = 0; PortPlaceList = portPlacecheckedComboBox.CheckedValues; if (PortPlaceList != null) { foreach (object obj in PortPlaceList) { PortPlaceList_nvc = string.Format("{0},{1}", PortPlaceList_nvc, PortPlaceList[index].ToString()); index += 1; } PortPlaceList_nvc = PortPlaceList_nvc.Substring(1, PortPlaceList_nvc.Length - 1); } PortPlacestiReport.Dictionary.Synchronize(); PortPlacestiReport.Dictionary.Databases.Clear(); PortPlacestiReport.Dictionary.Databases.Add(new Stimulsoft.Report.Dictionary.StiSqlDatabase("Connection", Hepsa.Core.Common.ConnectionString.ConnectionString)); PortPlacestiReport.Compile(); PortPlacestiReport["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(); PortPlacestiReport["fromdate_vc"] = FromDatefaDatePicker.Text; PortPlacestiReport["todate_vc"] = ToDatefaDatePicker.Text; PortPlacestiReport["fromtime_nvc"] = FromTimeTextBox.Text; PortPlacestiReport["totime_nvc"] = ToTimeTextBox.Text; PortPlacestiReport["date_vc"] = PortPlaceFactory.ServerJalaliDate; PortPlacestiReport["UserName_vc"] = HPS.Common.CurrentUser.user.UserName_nvc; PortPlacestiReport["@fromdate_nvc"] = FromDatefaDatePicker.Text; PortPlacestiReport["@fromtime_nvc"] = FromTimeTextBox.Text; PortPlacestiReport["@todate_nvc"] = ToDatefaDatePicker.Text; PortPlacestiReport["@totime_nvc"] = ToTimeTextBox.Text; if (PortPlaceList_nvc == string.Empty) { PortPlacestiReport["@PortPlaceList"] = DBNull.Value; } else { PortPlacestiReport["@PortPlaceList"] = PortPlaceList_nvc; } PortPlacestiReport.Render(); stiViewerControl1.Report = PortPlacestiReport; } catch (Exception ex) { Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message); } }
private void ShowButton_Click(object sender, EventArgs e) { try { ExistsLaderTypeGridView.Visible = false; 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.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); } 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); } object[] LaderTypeList = new object[100]; string LaderTypeList_nvc = string.Empty; int index = 0; LaderTypeList = LaderTypecheckedComboBox.CheckedValues; if (LaderTypeList != null) { foreach (object obj in LaderTypeList) { LaderTypeList_nvc = string.Format("{0},{1}", LaderTypeList_nvc, LaderTypeList[index].ToString()); index += 1; } LaderTypeList_nvc = LaderTypeList_nvc.Substring(1, LaderTypeList_nvc.Length - 1); } //HPS.Reports.ReportDoc.LaderTypeCountReport rpt = new HPS.Reports.ReportDoc.LaderTypeCountReport(FromDatefaDatePicker.Text, FromTimeTextBox.Text, ToDatefaDatePicker.Text, ToTimeTextBox.Text, LaderTypeList_nvc); //rpt.Document.Printer.PrinterName = string.Empty; //viewer1.Document = rpt.Document; //rpt.Run(); //پر کردن دیتا تیبل //HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TFactory LadeAssignmentFactory = new HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TFactory(); //DataTable LaderTypeReportTable = new DataTable(); //DataSet LaderTypeDataSet = new DataSet(); //LadeAssignmentFactory.SelectLaderTypeCountReport(FromDatefaDatePicker.Text, FromTimeTextBox.Text, ToDatefaDatePicker.Text, ToTimeTextBox .Text, LaderTypeList_nvc, ref LaderTypeReportTable); ////اضافه کردن ستون جدید به جدول //if (LaderTypeReportTable != null && LaderTypeReportTable.Rows.Count > 0) //{ // LaderTypeReportTable.Columns.Add("RemainedPercent"); // foreach (DataRow row in LaderTypeReportTable.Rows) // { // double RemainedPercent = (Convert.ToDouble(row["RemainderCar_int"]) * 100) / Convert.ToDouble(row["CarCount_int"]); // row["RemainedPercent"] = RemainedPercent.ToString("0.##"); // } //} //Int64? AllLadeAssignmentcount = (from row in LaderTypeReportTable.AsEnumerable() select (Int32)row["CarCount_int"]).Sum(); //Int64? AllLadBillcountRecords = (from row in LaderTypeReportTable.AsEnumerable() select (Int32)row["LadBill"]).Sum(); //Int64? allcanceledByCompany = (from row in LaderTypeReportTable.AsEnumerable() select (Int32)row["CanceledByCompany"]).Sum(); //Int64? allcanceledByLadBillCanceled = (from row in LaderTypeReportTable.AsEnumerable() select (Int32)row["CanceledByLadBillCanceled"]).Sum(); ////AllRemainderCounttxt.Text = (Convert.ToInt64(AllLadeAssignmentcount) - Convert.ToInt64(AllLadBillcountRecords) - Convert.ToInt64(allcanceledByCompany) - Convert.ToInt64(allcanceledByLadBillCanceled)).ToString(); //Allremaindercount.HasValue ? Allremaindercount.ToString() : "0"; //AllRemainedPercenttxt.Text = ((Convert.ToDouble(AllRemainderCounttxt.Text)) * 100 / (Convert.ToDouble(AllLadeAssignmentCountxt.Text))).ToString("0.##"); //اضافه کردن دیتاتیبل به دیتا ست //LaderTypeDataSet.Tables.Add(LaderTypeReportTable.Copy()); //کدهای استیمیول LederTypeCountReportstiReport.Dictionary.Synchronize(); LederTypeCountReportstiReport.Dictionary.Databases.Clear(); LederTypeCountReportstiReport.Dictionary.Databases.Add(new Stimulsoft.Report.Dictionary.StiSqlDatabase("Connection", Hepsa.Core.Common.ConnectionString.ConnectionString)); LederTypeCountReportstiReport.Compile(); LederTypeCountReportstiReport["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(); //مقدار دهی متغیرها LederTypeCountReportstiReport["fromDate_nvc"] = FromDatefaDatePicker.Text; LederTypeCountReportstiReport["fromTime_nvc"] = FromTimeTextBox.Text; LederTypeCountReportstiReport["toTime_nvc"] = ToTimeTextBox.Text; LederTypeCountReportstiReport["toDate_nvc"] = ToDatefaDatePicker.Text; LederTypeCountReportstiReport["date_vc"] = PortPlaceFactory.ServerJalaliDate + " " + PortPlaceFactory.ServerTime;; LederTypeCountReportstiReport["userName_nvc"] = HPS.Common.CurrentUser.user.UserName_nvc; LederTypeCountReportstiReport["@fromdate_nvc"] = FromDatefaDatePicker.Text; LederTypeCountReportstiReport["@fromtime_nvc"] = FromTimeTextBox.Text; LederTypeCountReportstiReport["@totime_nvc"] = ToTimeTextBox.Text; LederTypeCountReportstiReport["@todate_nvc"] = ToDatefaDatePicker.Text; if (!(LaderTypeList_nvc == "")) { LederTypeCountReportstiReport["@LaderTypeList"] = LaderTypeList_nvc; } //LederTypeCountReportstiReport["@CompanyID_int"] = FromDatefaDatePicker.Text; //LederTypeCountReportstiReport["@GoodIDList_nvc"] = FromTimeTextBox.Text; //LederTypeCountReportstiReport["@DestinationCityIDList_nvc"] = ToTimeTextBox.Text; //LederTypeCountReportstiReport["@PortPlaceIDList_nvc"] = ToDatefaDatePicker.Text; //LederTypeCountReportstiReport["@OrderColumns_nvc"] = LaderTypeList_nvc; LederTypeCountReportstiReport.Render(); //LederTypeCountReportstiReport.Show(); stiViewerControl1.Report = LederTypeCountReportstiReport; } catch (Exception ex) { Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message); } }
private void ShowButton_Click(object sender, EventArgs e) { try { HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory LadBillFactory = new HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory(); DataTable LadBillCreditDataTable = new DataTable(); if (FromDatefaDatePicker.IsNull) { throw new ApplicationException("از تاریخ خالی است"); } else if (ToDatefaDatePicker.IsNull) { throw new ApplicationException("تا تاریخ خالی است"); } Hepsa.Core.Validation.DateRule <string> FromDateValidator = new Hepsa.Core.Validation.DateRule <string>("FromDate", "از تاریخ", null, null); if (FromDateValidator.Validate(Hepsa.Core.Common.PersentationController.GetEntityValue(FromDatefaDatePicker.Text, TypeCode.String).ToString()) == false) { throw new ApplicationException(FromDateValidator.Description); } Hepsa.Core.Validation.DateRule <string> ToDateValidator = new Hepsa.Core.Validation.DateRule <string>("ToDate", "تا تاریخ", null, null); if (ToDateValidator.Validate(Hepsa.Core.Common.PersentationController.GetEntityValue(ToDatefaDatePicker.Text, TypeCode.String).ToString()) == false) { throw new ApplicationException(ToDateValidator.Description); } ///Select Company and LaderType object[] CompanyList = new object[300]; string CompanyList_nvc = string.Empty; int index = 0; CompanyList = CompanyID_intcheckedComboBox.CheckedValues; if (CompanyList != null) { foreach (object obj in CompanyList) { CompanyList_nvc = string.Format("{0},{1}", CompanyList_nvc, CompanyList[index].ToString()); index += 1; } CompanyList_nvc = CompanyList_nvc.Substring(1, CompanyList_nvc.Length - 1); } object[] LaderTypeList = new object[300]; string LaderTypeList_nvc = string.Empty; index = 0; LaderTypeList = LaderTypecheckedComboBox.CheckedValues; if (LaderTypeList != null) { foreach (object obj in LaderTypeList) { LaderTypeList_nvc = string.Format("{0},{1}", LaderTypeList_nvc, LaderTypeList[index].ToString()); index += 1; } LaderTypeList_nvc = LaderTypeList_nvc.Substring(1, LaderTypeList_nvc.Length - 1); } string OrderColumns_nvc = string.Empty; if (Order1ComboBox.SelectedIndex != 0) { OrderColumns_nvc = ((DataRowView)Order1ComboBox.SelectedItem)["ColumnName"].ToString(); } if (Order2ComboBox.SelectedIndex != 0) { OrderColumns_nvc += " , " + ((DataRowView)Order2ComboBox.SelectedItem)["ColumnName"].ToString(); } if (Order3ComboBox.SelectedIndex != 0) { OrderColumns_nvc += " , " + ((DataRowView)Order3ComboBox.SelectedItem)["ColumnName"].ToString(); } if (Order4ComboBox.SelectedIndex != 0) { OrderColumns_nvc += " , " + ((DataRowView)Order4ComboBox.SelectedItem)["ColumnName"].ToString(); } if (Order5ComboBox.SelectedIndex != 0) { OrderColumns_nvc += " , " + ((DataRowView)Order5ComboBox.SelectedItem)["ColumnName"].ToString(); } if (OrderColumns_nvc.EndsWith(" , ")) { OrderColumns_nvc = OrderColumns_nvc.Remove(OrderColumns_nvc.Length - 2, 2); } ///Call Report //HPS.Reports.ReportDoc.LadBillCreditReport rpt = new HPS.Reports.ReportDoc.LadBillCreditReport(this.FromDatefaDatePicker.Text, this.ToDatefaDatePicker.Text, CompanyList_nvc, LaderTypeList_nvc, OrderColumns_nvc, this.NumberPlate_nvcTextBox.Text, this.SerialPlate_nvcTextBox.Text, this.CarCardNumber_nvcTextBox.Text, this.DriverCardNumber_nvcTextBox.Text); //viewer1.Document = rpt.Document; //rpt.Document.Printer.PrinterName = string.Empty; //rpt.Run(); string condition = string.Empty; condition = "LadBillCredit_T.Date_nvc>='" + FromDatefaDatePicker.Text + "' AND LadBillCredit_T.Date_nvc<='" + ToDatefaDatePicker.Text + "' AND Canceled_bit=0 "; if (!string.IsNullOrEmpty(CompanyList_nvc)) { condition += " AND LadeAssignment_T.CompanyID_int IN ( " + CompanyList_nvc + " ) "; } if (!string.IsNullOrEmpty(LaderTypeList_nvc)) { condition += " AND Traffic_T.LaderTypeID_int IN ( " + LaderTypeList_nvc + " ) "; } if (!string.IsNullOrEmpty(NumberPlate_nvcTextBox.Text) && (!string.IsNullOrEmpty(SerialPlate_nvcTextBox.Text))) { condition += " AND Traffic_T.NumberPlate_nvc = '" + NumberPlate_nvcTextBox.Text + "' AND Traffic_T.SerialPlate_nvc =" + SerialPlate_nvcTextBox.Text; } if (!string.IsNullOrEmpty(CarCardNumber_nvcTextBox.Text)) { condition += " AND Traffic_T.CarCardNumber_nvc = " + CarCardNumber_nvcTextBox.Text; } if (!string.IsNullOrEmpty(DriverCardNumber_nvcTextBox.Text)) { condition += " AND Traffic_T.DriverCardNumber_nvc = " + DriverCardNumber_nvcTextBox.Text; } if (!string.IsNullOrEmpty(Days_intTextBox.Text)) { // تعداد روز هایی که راندگان در صف مانده اند // روز های انتظار condition += " AND datediff(day,dbo.ShamsiToMiladi(Traffic_T.Date_nvc),dbo.ShamsiToMiladi(LadBillCredit_T.Date_nvc)) <= " + Days_intTextBox.Text; } if (!string.IsNullOrEmpty(OrderColumns_nvc)) { condition += " ORDER BY " + OrderColumns_nvc; } else { condition += " ORDER BY LadBillCreditID_int "; } LadBillCreditReportstiReport.Dictionary.Synchronize(); LadBillCreditReportstiReport.Dictionary.Databases.Clear(); LadBillCreditReportstiReport.Dictionary.Databases.Add(new Stimulsoft.Report.Dictionary.StiSqlDatabase("Connection", Hepsa.Core.Common.ConnectionString.ConnectionString)); LadBillCreditReportstiReport.Compile(); LadBillCreditReportstiReport["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(); LadBillCreditReportstiReport["FromDate_vc"] = FromDatefaDatePicker.Text; LadBillCreditReportstiReport["ToDate_vc"] = ToDatefaDatePicker.Text; LadBillCreditReportstiReport["FromTime_vc"] = FromDatefaDatePicker.Text; LadBillCreditReportstiReport["ToTime_vc"] = ToDatefaDatePicker.Text; LadBillCreditReportstiReport["Date_vc"] = PortPlaceFactory.ServerJalaliDate + " " + PortPlaceFactory.ServerTime;; LadBillCreditReportstiReport["UserName_vc"] = HPS.Common.CurrentUser.user.UserName_nvc; LadBillCreditReportstiReport["@fromdate_nvc"] = FromDatefaDatePicker.Text; LadBillCreditReportstiReport["@todate_nvc"] = ToDatefaDatePicker.Text; LadBillCreditReportstiReport["@fromtime_nvc"] = FromDatefaDatePicker.Text; LadBillCreditReportstiReport["@totime_nvc"] = ToDatefaDatePicker.Text; LadBillCreditReportstiReport["@Condition"] = condition; LadBillCreditReportstiReport.Render(); stiViewerControl1.Report = LadBillCreditReportstiReport; } catch (Exception ex) { Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message); } }
private void PrintStripButton_Click(object sender, EventArgs e) { //try //{ // if (FromDatefaDatePicker.IsNull) // { // throw new ApplicationException("از تاریخ خالی است"); // } // else if (ToDatefaDatePicker.IsNull) // { // throw new ApplicationException("تا تاریخ خالی است"); // } // 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); // HPS.Reports.ReportDoc.AllAcceptedTurnReport rpt=null; // if (WithProductionYear == true) // { // rpt = new HPS.Reports.ReportDoc.AllAcceptedTurnReport(FromDatefaDatePicker.Text, ToDatefaDatePicker.Text,true); // rpt.Document.Printer.PrinterName = string.Empty; // rpt.Run(); // } // else // { // rpt = new HPS.Reports.ReportDoc.AllAcceptedTurnReport(FromDatefaDatePicker.Text, ToDatefaDatePicker.Text, false); // rpt.Document.Printer.PrinterName = string.Empty; // rpt.Run(); // } // Properties.Settings s = new HPS.Properties.Settings(); // if (string.IsNullOrEmpty(s.PrinterName)) // { // rpt.Document.Print(true, true, true); // } // else // { // rpt.Document.Printer.PrinterName = s.PrinterName; // rpt.Document.Print(false, true, true); // } //} //catch (Exception ex) //{ // Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message); //} try { if (FromDatefaDatePicker.IsNull) { throw new ApplicationException("از تاریخ خالی است"); } else if (ToDatefaDatePicker.IsNull) { throw new ApplicationException("تا تاریخ خالی است"); } 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); } HPS.BLL.TrafficBLL.BLLTraffic_TFactory TrafficFactory = new HPS.BLL.TrafficBLL.BLLTraffic_TFactory(); string Condition = string.Empty; if (WithProductionYear == true) { Condition = " [T1].[TurnAccepted_bit]='true' AND [T1].[TrafficTypeID_int]=1 AND (T1.TurnDate_nvc>='" + FromDatefaDatePicker.Text + "') AND (T1.TurnDate_nvc<='" + ToDatefaDatePicker.Text + "') AND T1.ProductionYear_int IS NOT NULL"; } else { Condition = " [T1].[TurnAccepted_bit]='true' AND [T1].[TrafficTypeID_int]=1 AND (T1.TurnDate_nvc>='" + FromDatefaDatePicker.Text + "') AND (T1.TurnDate_nvc<='" + ToDatefaDatePicker.Text + "')"; } AllAcceptedTurnstiReport.Dictionary.Synchronize(); AllAcceptedTurnstiReport.Dictionary.Databases.Clear(); AllAcceptedTurnstiReport.Dictionary.Databases.Add(new Stimulsoft.Report.Dictionary.StiSqlDatabase("Connection", Hepsa.Core.Common.ConnectionString.ConnectionString)); AllAcceptedTurnstiReport.Compile(); AllAcceptedTurnstiReport["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(); AllAcceptedTurnstiReport["fromdate_vc"] = FromDatefaDatePicker.Text; AllAcceptedTurnstiReport["todate_vc"] = ToDatefaDatePicker.Text; AllAcceptedTurnstiReport["date_vc"] = PortPlaceFactory.ServerJalaliDate + " " + PortPlaceFactory.ServerTime;; AllAcceptedTurnstiReport["UserName_vc"] = HPS.Common.CurrentUser.user.UserName_nvc; AllAcceptedTurnstiReport["fromTrafficNumber"] = TrafficNumber_binttextBox.Text; AllAcceptedTurnstiReport["@condition_nvc"] = Condition; AllAcceptedTurnstiReport.Render(); stiViewerControl1.Report = AllAcceptedTurnstiReport; stiViewerControl1.Visible = true; TrafficGridView.Visible = false; } catch (Exception ex) { Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message); } }
private void PrintstripButton_Click(object sender, EventArgs e) { try { LadeAssignmentInfoGridView.Visible = false; SumPanel.Visible = false; if (FromDatefaDatePicker.IsNull) { throw new ApplicationException("از تاریخ خالی است"); } else if (ToDatefaDatePicker.IsNull) { throw new ApplicationException("تا تاریخ خالی است"); } string CompanyCodeList_nvc = string.Empty; foreach (Janus.Windows.GridEX.GridEXRow itm in companyGrid.GetCheckedRows()) { CompanyCodeList_nvc += itm.Cells["CompanyCode_nvc"].Value.ToString() + ","; } if (CompanyCodeList_nvc.EndsWith(",")) { CompanyCodeList_nvc = CompanyCodeList_nvc.Remove(CompanyCodeList_nvc.Length - 1); } string LaderTypeCodeList_nvc = string.Empty; foreach (Janus.Windows.GridEX.GridEXRow itm in laderTypeGrid.GetCheckedRows()) { LaderTypeCodeList_nvc += itm.Cells["LaderTypeCode_nvc"].Value.ToString() + ","; } if (LaderTypeCodeList_nvc.EndsWith(",")) { LaderTypeCodeList_nvc = LaderTypeCodeList_nvc.Remove(LaderTypeCodeList_nvc.Length - 1); } //HPS.Reports.ReportDoc.UseLadBillVSLadeCountReport rpt = new HPS.Reports.ReportDoc.UseLadBillVSLadeCountReport(FromDatefaDatePicker.Text, ToDatefaDatePicker.Text, CompanyCodeList_nvc, LaderTypeCodeList_nvc, ((DataTable)LadeAssignmentInfoGridView.DataSource).DefaultView); //rpt.Document.Printer.PrinterName = string.Empty; //viewer1.Document = rpt.Document; //rpt.Run(); UseLadBillVSLadeCountReportstiReport.Dictionary.Synchronize(); UseLadBillVSLadeCountReportstiReport.Dictionary.Databases.Clear(); UseLadBillVSLadeCountReportstiReport.Dictionary.Databases.Add(new Stimulsoft.Report.Dictionary.StiSqlDatabase("Connection", Hepsa.Core.Common.ConnectionString.ConnectionString)); UseLadBillVSLadeCountReportstiReport.Compile(); UseLadBillVSLadeCountReportstiReport["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(); //مقدار دهی متغیرها UseLadBillVSLadeCountReportstiReport["fromDate_nvc"] = FromDatefaDatePicker.Text; UseLadBillVSLadeCountReportstiReport["toDate_nvc"] = ToDatefaDatePicker.Text; UseLadBillVSLadeCountReportstiReport["date_vc"] = PortPlaceFactory.ServerJalaliDate + " " + PortPlaceFactory.ServerTime;; UseLadBillVSLadeCountReportstiReport["userName_nvc"] = HPS.Common.CurrentUser.user.UserName_nvc; UseLadBillVSLadeCountReportstiReport.Render(); UseLadBillVSLadeCountReportstiReport.Show(); } catch (Exception ex) { } }
private void FillGrid() { HPS.BLL.LaderTypeBLL.BLLLaderType_TFactory LaderTypeID_intFactory = new HPS.BLL.LaderTypeBLL.BLLLaderType_TFactory(); DataTable LaderTypeID_intDataTable = new DataTable(); string laderCondition = "[LaderType_T].[Active_bit]='true'"; LaderTypeID_intFactory.GetAllByCondition(laderCondition, ref LaderTypeID_intDataTable); laderTypeGrid.SetDataBinding(LaderTypeID_intDataTable, "LaderTypeID_intDataTable"); HPS.BLL.CompanyBLL.BLLCompany_TFactory CompanyID_intFactory = new HPS.BLL.CompanyBLL.BLLCompany_TFactory(); string CompanyCondition = "[Company_T].[Active_bit]='true'"; CompanyID_intFactory.GetAllByCondition(CompanyCondition, ref CompanyID_intDataTable); companyGrid.SetDataBinding(CompanyID_intDataTable, "CompanyID_intDataTable"); HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory LadBillCreditFactory = new HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory(); DataTable LadbillOrder1Table = new DataTable(); LadBillCreditFactory.SelectCompanyRemainedLadBillReportOrderColumns(LadbillOrder1Table); DataRow emptyRow1 = LadbillOrder1Table.NewRow(); LadbillOrder1Table.Rows.InsertAt(emptyRow1, 0); this.Order1ComboBox.DisplayMember = "PropertyValue"; this.Order1ComboBox.ValueMember = "ColumnName"; this.Order1ComboBox.DataSource = LadbillOrder1Table; this.Order1ComboBox.SelectedIndex = 0; DataTable LadbillOrder2Table = new DataTable(); LadBillCreditFactory.SelectCompanyRemainedLadBillReportOrderColumns(LadbillOrder2Table); DataRow emptyRow2 = LadbillOrder2Table.NewRow(); LadbillOrder2Table.Rows.InsertAt(emptyRow2, 0); this.Order2ComboBox.DisplayMember = "PropertyValue"; this.Order2ComboBox.ValueMember = "ColumnName"; this.Order2ComboBox.DataSource = LadbillOrder2Table; this.Order2ComboBox.SelectedIndex = 0; DataTable LadbillOrder3Table = new DataTable(); LadBillCreditFactory.SelectCompanyRemainedLadBillReportOrderColumns(LadbillOrder3Table); DataRow emptyRow3 = LadbillOrder3Table.NewRow(); LadbillOrder3Table.Rows.InsertAt(emptyRow3, 0); this.Order3ComboBox.DisplayMember = "PropertyValue"; this.Order3ComboBox.ValueMember = "ColumnName"; this.Order3ComboBox.DataSource = LadbillOrder3Table; this.Order3ComboBox.SelectedIndex = 0; DataTable LadbillOrder4Table = new DataTable(); LadBillCreditFactory.SelectCompanyRemainedLadBillReportOrderColumns(LadbillOrder4Table); DataRow emptyRow4 = LadbillOrder4Table.NewRow(); LadbillOrder4Table.Rows.InsertAt(emptyRow4, 0); this.Order4ComboBox.DisplayMember = "PropertyValue"; this.Order4ComboBox.ValueMember = "ColumnName"; this.Order4ComboBox.DataSource = LadbillOrder4Table; this.Order4ComboBox.SelectedIndex = 0; DataTable LadbillOrder5Table = new DataTable(); LadBillCreditFactory.SelectCompanyRemainedLadBillReportOrderColumns(LadbillOrder5Table); DataRow emptyRow5 = LadbillOrder5Table.NewRow(); LadbillOrder5Table.Rows.InsertAt(emptyRow5, 0); this.Order5ComboBox.DisplayMember = "PropertyValue"; this.Order5ComboBox.ValueMember = "ColumnName"; this.Order5ComboBox.DataSource = LadbillOrder5Table; this.Order5ComboBox.SelectedIndex = 0; HPS.BLL.GoodBLL.BLLGood_TFactory GoodFactory = new HPS.BLL.GoodBLL.BLLGood_TFactory(); DataTable GoodID_intDataTable = new DataTable(); GoodFactory.GetAll(ref GoodID_intDataTable); goodGrid.SetDataBinding(GoodID_intDataTable, "GoodID_intDataTable"); HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory PortPlaceFactory = new HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory(); DataTable PortPlaceID_intDataTable = new DataTable(); string PortPlacesCondition = "[PortPlaces_T].[Active_bit]='true'"; PortPlaceFactory.GetAllByCondition(PortPlacesCondition, ref PortPlaceID_intDataTable); portPlaceGrid.SetDataBinding(PortPlaceID_intDataTable, "PortPlaceID_intDataTable"); HPS.BLL.CityBLL.BLLCity_TFactory CityFactory = new HPS.BLL.CityBLL.BLLCity_TFactory(); DataTable DestinationCityID_intDataTable = new DataTable(); string CityCondition = "[City_T].[Active_bit]='true'"; CityFactory.GetAllByCondition(CityCondition, ref DestinationCityID_intDataTable); destinationCityGrid.SetDataBinding(DestinationCityID_intDataTable, "DestinationCityID_intDataTable"); this.FromDatefaDatePicker.SelectedDateTime = FarsiLibrary.Utils.PersianDateConverter.ToGregorianDateTime(CompanyID_intFactory.ServerJalaliDate); this.ToDatefaDatePicker.SelectedDateTime = FarsiLibrary.Utils.PersianDateConverter.ToGregorianDateTime(CompanyID_intFactory.ServerJalaliDate); //FromTimeTextBox.Text = "08:00:00"; // ToTimeTextBox.Text = CompanyID_intFactory.ServerTime; }
private void ShowButton_Click(object sender, EventArgs e) { HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory PortPlaceFactory = new HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory(); if (_TrafficType == 1) { //IranianOutTrafiicstiReport string Turn = string.Empty; ////////////// //HPS.Reports.ReportDoc.IranianOutTrafficReport rpt = new HPS.Reports.ReportDoc.IranianOutTrafficReport(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(); IranianOutTrafiicstiReport.Dictionary.Synchronize(); IranianOutTrafiicstiReport.Dictionary.Databases.Clear(); IranianOutTrafiicstiReport.Dictionary.Databases.Add(new Stimulsoft.Report.Dictionary.StiSqlDatabase("Connection", Hepsa.Core.Common.ConnectionString.ConnectionString)); IranianOutTrafiicstiReport.Compile(); IranianOutTrafiicstiReport["organ"] = new HPS.BLL.SettingsBLL.BLLSetting_TFactory().GetBy(new BLL.SettingsBLL.BLLSetting_TKeys() { SettingID_int = 1029 }).Value_nvc.ToString(); IranianOutTrafiicstiReport["fromdate_vc"] = FromDatefaDatePicker.Text; IranianOutTrafiicstiReport["todate_vc"] = ToDatefaDatePicker.Text; IranianOutTrafiicstiReport["date_vc"] = PortPlaceFactory.ServerJalaliDate + " " + PortPlaceFactory.ServerTime;; IranianOutTrafiicstiReport["UserName_vc"] = HPS.Common.CurrentUser.user.UserName_nvc; IranianOutTrafiicstiReport["fromTrafficNumber"] = FromTrafficNumbertxt.Text; IranianOutTrafiicstiReport["toTrafficNumber"] = ToTrafficNumbertxt.Text; IranianOutTrafiicstiReport["FromTime_vc"] = FromTimeTextBox.Text; IranianOutTrafiicstiReport["ToTime_vc"] = ToTimeTextBox.Text; if (string.IsNullOrEmpty(FromDatefaDatePicker.Text)) { IranianOutTrafiicstiReport["@FromDateTime_nvc"] = DBNull.Value; } else { IranianOutTrafiicstiReport["@FromDateTime_nvc"] = FromDatefaDatePicker.Text + ' ' + FromTimeTextBox.Text; } if (string.IsNullOrEmpty(ToDatefaDatePicker.Text)) { IranianOutTrafiicstiReport["@ToDateTime_nvc"] = DBNull.Value; } else { IranianOutTrafiicstiReport["@ToDateTime_nvc"] = ToDatefaDatePicker.Text + ' ' + ToTimeTextBox.Text; } if (string.IsNullOrEmpty(FromTrafficNumbertxt.Text)) { IranianOutTrafiicstiReport["@FromTrafficNumber_nvc"] = DBNull.Value; } else { IranianOutTrafiicstiReport["@FromTrafficNumber_nvc"] = FromTrafficNumbertxt.Text; } if (string.IsNullOrEmpty(ToTrafficNumbertxt.Text)) { IranianOutTrafiicstiReport["@ToTrafficNumber_nvc"] = DBNull.Value; } else { IranianOutTrafiicstiReport["@ToTrafficNumber_nvc"] = ToTrafficNumbertxt.Text; } if (LaderPivotGroupID_intComboBox.SelectedValue == null) { IranianOutTrafiicstiReport["@LaderPivotGroupID_nvc"] = DBNull.Value; } else { IranianOutTrafiicstiReport["@LaderPivotGroupID_nvc"] = LaderPivotGroupID_intComboBox.SelectedValue; } if (LaderTypeID_intComboBox.SelectedValue == null) { IranianOutTrafiicstiReport["@LaderTypeID_nvc"] = DBNull.Value; } else { IranianOutTrafiicstiReport["@LaderTypeID_nvc"] = LaderTypeID_intComboBox.SelectedValue; } if (ServicescomboBox.SelectedValue == null) { IranianOutTrafiicstiReport["@ServiceID_nvc"] = DBNull.Value; } else { IranianOutTrafiicstiReport["@ServiceID_nvc"] = ServicescomboBox.SelectedValue; } IranianOutTrafiicstiReport["@TrafficTypeID_nvc"] = 1; IranianOutTrafiicstiReport["@TrafficInbit_nvc"] = DBNull.Value; IranianOutTrafiicstiReport["@TrafficOutbit_nvc"] = 1; IranianOutTrafiicstiReport["@TurnAccepted_nvc"] = Turn; if (LaderPivotGroupID_intComboBox.SelectedValue != null) { if (Convert.ToInt32(LaderPivotGroupID_intComboBox.SelectedValue) == 1) { IranianOutTrafiicstiReport["LaderTypeHeadertxt"] = "(دو محور)"; } else if (Convert.ToInt32(LaderPivotGroupID_intComboBox.SelectedValue) == 2) { IranianOutTrafiicstiReport["LaderTypeHeadertxt"] = "(سه محور به بالا)"; } } else { IranianOutTrafiicstiReport["LaderTypeHeadertxt"] = "(تمامی کامیون ها)"; } if (LaderTypeID_intComboBox.SelectedValue != null) { IranianOutTrafiicstiReport["LaderTypeHeadertxt"] = (string)Hepsa.Core.Common.PersentationController.GetComboBoxDisplayMember(this.LaderTypeID_intComboBox); } IranianOutTrafiicstiReport.Render(); this.stiViewerControl1.Report = IranianOutTrafiicstiReport; } if (_TrafficType == 2) { //HPS.Reports.ReportDoc.ForeignOutTrafficReport rpt = new HPS.Reports.ReportDoc.ForeignOutTrafficReport(FromDatefaDatePicker.Text, ToDatefaDatePicker.Text, FromTimeTextBox.Text, ToTimeTextBox.Text, FromTrafficNumbertxt.Text, ToTrafficNumbertxt.Text); //rpt.Document.Printer.PrinterName = string.Empty; //viewer1.Document = rpt.Document; //rpt.Run(); 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(FromTrafficNumbertxt.Text) && string.IsNullOrEmpty(ToTrafficNumbertxt.Text)) && (string.IsNullOrEmpty(FromTimeTextBox.Text) && string.IsNullOrEmpty(ToTime))) { Condition = "(T.In_bit='False') 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='False') 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='False') 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='False') 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 + "')"; } ForeignOutTrafficstiReport.Dictionary.Synchronize(); ForeignOutTrafficstiReport.Dictionary.Databases.Clear(); ForeignOutTrafficstiReport.Dictionary.Databases.Add(new Stimulsoft.Report.Dictionary.StiSqlDatabase("Connection", Hepsa.Core.Common.ConnectionString.ConnectionString)); ForeignOutTrafficstiReport.Compile(); ForeignOutTrafficstiReport["organ"] = new HPS.BLL.SettingsBLL.BLLSetting_TFactory().GetBy(new BLL.SettingsBLL.BLLSetting_TKeys() { SettingID_int = 1029 }).Value_nvc.ToString(); ForeignOutTrafficstiReport["fromdate_vc"] = FromDatefaDatePicker.Text; ForeignOutTrafficstiReport["todate_vc"] = ToDatefaDatePicker.Text; ForeignOutTrafficstiReport["date_vc"] = PortPlaceFactory.ServerJalaliDate + " " + PortPlaceFactory.ServerTime;; ForeignOutTrafficstiReport["UserName_vc"] = HPS.Common.CurrentUser.user.UserName_nvc; ForeignOutTrafficstiReport["fromTrafficNumber"] = FromTrafficNumbertxt.Text; ForeignOutTrafficstiReport["toTrafficNumber"] = ToTrafficNumbertxt.Text; ForeignOutTrafficstiReport["FromTime_vc"] = FromTimeTextBox.Text; ForeignOutTrafficstiReport["ToTime_vc"] = ToTimeTextBox.Text; ForeignOutTrafficstiReport["@Condition"] = Condition; ForeignOutTrafficstiReport.Render(); this.stiViewerControl1.Report = ForeignOutTrafficstiReport; } if (_TrafficType == 0) { // HPS.Reports.ReportDoc.OtherOutReport rpt = new HPS.Reports.ReportDoc.OtherOutReport(FromDatefaDatePicker.Text, ToDatefaDatePicker.Text, FromTimeTextBox.Text, ToTimeTextBox.Text, FromTrafficNumbertxt.Text, ToTrafficNumbertxt.Text); // rpt.Document.Printer.PrinterName = string.Empty; // viewer1.Document = rpt.Document; // rpt.Run(); 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='False') AND (T.TrafficTypeID_int<>'1') 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='False') AND (T.TrafficTypeID_int<>'1') 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='False') AND (T.TrafficTypeID_int<>'1') 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='False') AND (T.TrafficTypeID_int<>'1') 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 + "')"; //} if (!(string.IsNullOrEmpty(FromTrafficNumber) && string.IsNullOrEmpty(ToTrafficNumber)) && (string.IsNullOrEmpty(FromTime) && string.IsNullOrEmpty(ToTime))) { Condition = "(T.In_bit='False') AND (T.TrafficTypeID_int<>'1') 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='False') AND (T.TrafficTypeID_int<>'1') 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='False') AND (T.TrafficTypeID_int<>'1') 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='False') AND (T.TrafficTypeID_int<>'1') 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 + "')"; } OtherOutTrafficStiReport.Dictionary.Synchronize(); OtherOutTrafficStiReport.Dictionary.Databases.Clear(); OtherOutTrafficStiReport.Dictionary.Databases.Add(new Stimulsoft.Report.Dictionary.StiSqlDatabase("Connection", Hepsa.Core.Common.ConnectionString.ConnectionString)); OtherOutTrafficStiReport.Compile(); OtherOutTrafficStiReport["organ"] = new HPS.BLL.SettingsBLL.BLLSetting_TFactory().GetBy(new BLL.SettingsBLL.BLLSetting_TKeys() { SettingID_int = 1029 }).Value_nvc.ToString(); OtherOutTrafficStiReport["fromdate_vc"] = FromDatefaDatePicker.Text; OtherOutTrafficStiReport["todate_vc"] = ToDatefaDatePicker.Text; OtherOutTrafficStiReport["date_vc"] = PortPlaceFactory.ServerJalaliDate + " " + PortPlaceFactory.ServerTime;; OtherOutTrafficStiReport["UserName_vc"] = HPS.Common.CurrentUser.user.UserName_nvc; OtherOutTrafficStiReport["fromTrafficNumber"] = FromTrafficNumbertxt.Text; OtherOutTrafficStiReport["toTrafficNumber"] = ToTrafficNumbertxt.Text; OtherOutTrafficStiReport["FromTime_vc"] = FromTimeTextBox.Text; OtherOutTrafficStiReport["ToTime_vc"] = ToTimeTextBox.Text; OtherOutTrafficStiReport["@Condition"] = Condition; OtherOutTrafficStiReport.Render(); this.stiViewerControl1.Report = OtherOutTrafficStiReport; } }