private void LaderTypeRemainedWithDateStripButton_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); } } catch (Exception ex) { Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message); } }
private void LoadSMSLog() { try { HPS.BLL.BLLSmsInfo_TFactory SmsFactory = new HPS.BLL.BLLSmsInfo_TFactory(); DataTable smsLogDataTable = new DataTable(); Hepsa.Core.Validation.DateRule <string> FromDateValidator = new Hepsa.Core.Validation.DateRule <string>("FromDate", "از تاریخ", null, null); if (FromDateValidator.Validate(FromDatetextBox.Text) == false) { throw new ApplicationException(FromDateValidator.Description); } Hepsa.Core.Validation.DateRule <string> ToDateValidator = new Hepsa.Core.Validation.DateRule <string>("FromDate", "از تاریخ", null, null); if (ToDateValidator.Validate(TodatetextBox.Text) == false) { throw new ApplicationException(ToDateValidator.Description); } SmsFactory.SelectSmsLog(FromDatetextBox.Text, TodatetextBox.Text, smsLogDataTable); this.SMSGridView.DataSource = smsLogDataTable; } 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("تا تاریخ خالی است"); } 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); } string Condition = string.Empty; if (WithProductionYear == true) { Condition = "T1.TurnDate_nvc>='" + FromDatefaDatePicker + "' AND T1.TurnDate_nvc<='" + ToDatefaDatePicker.Text + "' And T1.Area_bit=1 AND T1.ProductionYear_int IS NOT NULL"; } else { Condition = "T1.TurnDate_nvc>='" + FromDatefaDatePicker.Text + "' AND T1.TurnDate_nvc<='" + ToDatefaDatePicker.Text + " And T1.Area_bit=1'"; } if (!string.IsNullOrEmpty(AcceptedTurnNumber_binttextBox.Text)) { Condition = string.Format(" T1.AcceptedTurnNumber_bint={0} And T1.Area_bit=1 ", AcceptedTurnNumber_binttextBox.Text); } if (!string.IsNullOrEmpty(TrafficNumber_binttextBox.Text)) { Condition = string.Format(" T1.TrafficNumber_bint={0} And T1.Area_bit=1", TrafficNumber_binttextBox.Text); } if (!string.IsNullOrEmpty(NumberPlate_nvctextBox.Text) && !string.IsNullOrEmpty(SerialPlate_nvctextBox.Text)) { Condition = string.Format(" T1.NumberPlate_nvc ='{0}' AND T1.SerialPlate_nvc='{1}' And T1.Area_bit=1", NumberPlate_nvctextBox.Text, SerialPlate_nvctextBox.Text); } if (!string.IsNullOrEmpty(LastName_nvctextBox.Text)) { Condition = string.Format(" LastName_nvc LIKE '%{0}%' And T1.Area_bit=1", LastName_nvctextBox.Text); } HPS.BLL.TrafficBLL.BLLTraffic_TFactory TrafficFactory = new HPS.BLL.TrafficBLL.BLLTraffic_TFactory(); DataTable TrafficDataTable = new DataTable(); TrafficFactory.SelectAcceptedTurns(TrafficDataTable, Condition); this.TrafficGridView.DataSource = TrafficDataTable; } catch (Exception ex) { Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message); } }
private void TurnPrintstripButton_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); } //TrafficGridView.Visible = false; //ShowwithConditionbutton.Visible = false; //HPS.Reports.ReportDoc.AcceptedTurnNumberRemainedByLaderTypeCountReport report = new HPS.Reports.ReportDoc.AcceptedTurnNumberRemainedByLaderTypeCountReport(FromDateTextBox.Text, ToDateTextBox.Text); //report.Document.Printer.PrinterName = string.Empty; //viewer1.Document = report.Document; //report.Run(); // AcceptedTurnNumberRemainedByLaderTypeCountWithDateReportstiReport.Dictionary.Synchronize(); // AcceptedTurnNumberRemainedByLaderTypeCountWithDateReportstiReport.Dictionary.Databases.Clone(); // AcceptedTurnNumberRemainedByLaderTypeCountWithDateReportstiReport.Dictionary.Databases.Add(new Stimulsoft.Report.Dictionary.StiSqlDatabase("Connection", Hepsa.Core.Common.ConnectionString.ConnectionString)); // AcceptedTurnNumberRemainedByLaderTypeCountWithDateReportstiReport.Compile(); // HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory PortPlaceFactory = new HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory(); // //مقدار دهی متغیرها // AcceptedTurnNumberRemainedByLaderTypeCountWithDateReportstiReport["fromDate_nvc"] = FromDatefaDatePicker.Text; //// AcceptedTurnNumberRemainedByLaderTypeCountWithDateReportstiReport["fromTime_nvc"] = FromTimeTextBox.Text; //// AcceptedTurnNumberRemainedByLaderTypeCountWithDateReportstiReport["toTime_nvc"] = ToTimeTextBox.Text; // AcceptedTurnNumberRemainedByLaderTypeCountWithDateReportstiReport["toDate_nvc"] = ToDatefaDatePicker.Text; // AcceptedTurnNumberRemainedByLaderTypeCountWithDateReportstiReport["date_vc"] = PortPlaceFactory.ServerJalaliDate + " " + PortPlaceFactory.ServerTime; ; // AcceptedTurnNumberRemainedByLaderTypeCountWithDateReportstiReport["userName_nvc"] = HPS.Common.CurrentUser.user.UserName_nvc; // AcceptedTurnNumberRemainedByLaderTypeCountWithDateReportstiReport["@FromDate_nvc"] = FromDatefaDatePicker.Text; //// AcceptedTurnNumberRemainedByLaderTypeCountWithDateReportstiReport["@FromTime_nvc"] = FromTimeTextBox.Text; //// AcceptedTurnNumberRemainedByLaderTypeCountWithDateReportstiReport["@ToTime_nvc"] = ToTimeTextBox.Text; // AcceptedTurnNumberRemainedByLaderTypeCountWithDateReportstiReport["@ToDate_nvc"] = ToDatefaDatePicker.Text; // AcceptedTurnNumberRemainedByLaderTypeCountWithDateReportstiReport.Render(); // AcceptedTurnNumberRemainedByLaderTypeCountWithDateReportstiReport.Show(); } 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); } DataTable CanceledTurnsTable = new DataTable(); HPS.BLL.TrafficBLL.BLLTraffic_TFactory TrafficFactory = new BLL.TrafficBLL.BLLTraffic_TFactory(); TrafficFactory.SelectCanceledTurns(FromDatefaDatePicker.Text, ToDatefaDatePicker.Text, FromTimeTextBox.Text, ToTimeTextBox.Text, CanceledTurnsTable); CanceledTurnsGridView.DataSource = CanceledTurnsTable; //AllCanceledTurnstiReport.Show(); } 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.ServicesCountPriceReprt rpt = new HPS.Reports.ReportDoc.ServicesCountPriceReprt(FromDatefaDatePicker.Text, FromTimeTextBox.Text, ToDatefaDatePicker.Text, ToTimeTextBox.Text); //rpt.Document.Printer.PrinterName = string.Empty; //viewer1.Document = rpt.Document; //rpt.Run(); } 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.BLL.TrafficBLL.BLLTraffic_TFactory plateNumberFatory = new BLL.TrafficBLL.BLLTraffic_TFactory(); DataTable trafficPicturesTable = new DataTable(); plateNumberFatory.SelectTypeandLasteIn(FromDatefaDatePicker.Text, ToDatefaDatePicker.Text, FromTimeTextBox.Text, ToTimeTextBox.Text, trafficPicturesTable); TypeandLastInGrid.DataSource = trafficPicturesTable; } 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("تا تاریخ خالی است"); } 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 CancelButton_Click(object sender, EventArgs e) { if (Hepsa.Core.Common.MessageBox.ConfirmDeleteMessage() == true) { try { if (string.IsNullOrEmpty(Hepsa.Core.Common.PersentationController.GetMaskedTextBoxValue(FromDateTextBox))) { throw new ApplicationException("از تاریخ خالی است"); } if (string.IsNullOrEmpty(Hepsa.Core.Common.PersentationController.GetMaskedTextBoxValue(FromDateTextBox)) == false) { Hepsa.Core.Validation.DateRule <string> FromDateValidator = new Hepsa.Core.Validation.DateRule <string>("FromDate", "از تاریخ", null, null); if (FromDateValidator.Validate(Hepsa.Core.Common.PersentationController.GetEntityValue(FromDateTextBox.Text, TypeCode.String).ToString()) == false) { throw new ApplicationException(FromDateValidator.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("نوع بارگیر انتخاب نشده است"); } int ExecuteCount = -1; ExecuteCount = CancelTimeExpiredTurns(Hepsa.Core.Common.PersentationController.GetMaskedTextBoxValue(FromDateTextBox), LaderTypeList_nvc); if (ExecuteCount >= 0) { Hepsa.Core.Common.MessageBox.InformationMessage(string.Format("تعداد {0} نوبت باطل شد", ExecuteCount.ToString())); } } catch (Exception ex) { Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message); } } }
private void ToDatefaDatePicker_KeyDown(object sender, KeyEventArgs e) { try { if (e.KeyCode == Keys.Enter) { 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(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); } string condition = string.Empty; condition = string.Format(" LadBillCredit_T.Date_nvc>='{0}' And LadBillCredit_T.Date_nvc<='{1}'", FromDatefaDatePicker.Text, ToDatefaDatePicker.Text); if (WithProductionYear == true) { condition += " And ProductionYear_int IS NOT NULL AND Canceled_bit=0"; } LadBillFactory.GetAllWithTrafficLadBillCreditByConditon(condition, ref LadBillCreditDataTable); LadBillWithTrafficGridView.DataSource = null; LadBillWithTrafficGridView.DataSource = LadBillCreditDataTable; } } catch (Exception ex) { throw; } }
private void ToDate_nvcTextBox_KeyDown(object sender, KeyEventArgs e) { try { if (e.KeyCode == Keys.Enter) { if (string.IsNullOrEmpty(Hepsa.Core.Common.PersentationController.GetMaskedTextBoxValue(FromDate_nvcTextBox))) { throw new ApplicationException("از تاریخ خالی است"); } else if (string.IsNullOrEmpty(Hepsa.Core.Common.PersentationController.GetMaskedTextBoxValue(ToDate_nvcTextBox))) { throw new ApplicationException("تا تاریخ خالی است"); } Hepsa.Core.Validation.DateRule <string> FromDateRule = new Hepsa.Core.Validation.DateRule <string>("FromDate", "از تاریخ", null, null); if (FromDateRule.Validate(Hepsa.Core.Common.PersentationController.GetMaskedTextBoxValue(FromDate_nvcTextBox)) == false) { throw new ApplicationException("از تاریخ صحیح نیست"); } Hepsa.Core.Validation.DateRule <string> ToDateRule = new Hepsa.Core.Validation.DateRule <string>("ToDate", "تا تاریخ", null, null); if (ToDateRule.Validate(Hepsa.Core.Common.PersentationController.GetMaskedTextBoxValue(ToDate_nvcTextBox)) == false) { throw new ApplicationException("تا تاریخ صحیح نیست"); } TrafficNumberTextBox.Text = string.Empty; TurnNumberTextBox.Text = string.Empty; NumberPlate_nvcTextBox.Text = string.Empty; SerialPlate_nvcTextBox.Text = string.Empty; Search(); } } 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 DriverControlbutton_Click(object sender, EventArgs e) { try { List <string> DateEroorList = new List <string>(); Hepsa.Core.Validation.TodayDateRule lisenceEndDateRule = new Hepsa.Core.Validation.TodayDateRule("LicenceEnd_nvc", "تاريخ اتمام گواهینامه"); if (lisenceEndDateRule.Validate(Hepsa.Core.Common.PersentationController.GetMaskedTextBoxValue(LicenceEnd_nvcTextBox)) == false) { DateEroorList.Add(lisenceEndDateRule.Description + "\n"); } Hepsa.Core.Validation.TodayDateRule DriverCardSharjeStartTodayDateRule = new Hepsa.Core.Validation.TodayDateRule("DriverCardSharjeStartDate_nvc", "تاريخ اتمام شارژ كارت هوشمند"); if (DriverCardSharjeStartTodayDateRule.Validate(Hepsa.Core.Common.PersentationController.GetMaskedTextBoxValue(DriverCardSharjeEndDate_nvcTextBox)) == false) { DateEroorList.Add(DriverCardSharjeStartTodayDateRule.Description + "\n"); } Hepsa.Core.Validation.TodayDateRule HealthCardEndTodayDateRule = new Hepsa.Core.Validation.TodayDateRule("HealthCardEndDate_nvc", "تاريخ اتمام اعتبار کارت سلامت"); if (HealthCardEndTodayDateRule.Validate(Hepsa.Core.Common.PersentationController.GetMaskedTextBoxValue(HealthCardEndDate_nvcTextBox)) == false) { DateEroorList.Add(HealthCardEndTodayDateRule.Description + "\n"); } ////////////add not null rule Hepsa.Core.Validation.NotNullRule lisenceEndDateNotNullRule = new Hepsa.Core.Validation.NotNullRule("LicenceEnd_nvc", "تاريخ اتمام گواهینامه"); if (lisenceEndDateNotNullRule.Validate(Hepsa.Core.Common.PersentationController.GetMaskedTextBoxValue(LicenceEnd_nvcTextBox)) == false) { DateEroorList.Add(lisenceEndDateNotNullRule.Description + "\n"); } Hepsa.Core.Validation.NotNullRule DriverCardSharjeStartDateNotNullRule = new Hepsa.Core.Validation.NotNullRule("DriverCardSharjeStartDate_nvc", "تاريخ اتمام شارژ كارت هوشمند"); if (DriverCardSharjeStartDateNotNullRule.Validate(Hepsa.Core.Common.PersentationController.GetMaskedTextBoxValue(DriverCardSharjeEndDate_nvcTextBox)) == false) { DateEroorList.Add(DriverCardSharjeStartDateNotNullRule.Description + "\n"); } Hepsa.Core.Validation.NotNullRule HealthCardEndDateNotNullRule = new Hepsa.Core.Validation.NotNullRule("HealthCardEndDate_nvc", "تاريخ اتمام اعتبار کارت سلامت"); if (HealthCardEndDateNotNullRule.Validate(Hepsa.Core.Common.PersentationController.GetMaskedTextBoxValue(HealthCardEndDate_nvcTextBox)) == false) { DateEroorList.Add(HealthCardEndDateNotNullRule.Description + "\n"); } Hepsa.Core.Validation.NotNullRule licenceNumberNotNullRule = new Hepsa.Core.Validation.NotNullRule("licenceNumber_int", "شماره گواهینامه"); if (licenceNumberNotNullRule.Validate(licenceNumber_nvcTextBox.NumericText) == false) { DateEroorList.Add(licenceNumberNotNullRule.Description + "\n"); } ////////////add date rule Hepsa.Core.Validation.DateRule <string> LicenceEndDateRule = new Hepsa.Core.Validation.DateRule <string>("LicenceEnd_nvc", "تاريخ اتمام گواهینامه", null, null); if (LicenceEndDateRule.Validate(Hepsa.Core.Common.PersentationController.GetMaskedTextBoxValue(LicenceEnd_nvcTextBox)) == false) { DateEroorList.Add(LicenceEndDateRule.Description + "\n"); } Hepsa.Core.Validation.DateRule <string> DriverCardSharjeStartDateRule = new Hepsa.Core.Validation.DateRule <string>("DriverCardSharjeStartDate_nvc", "تاريخ اتمام شارژ كارت هوشمند", null, null); if (DriverCardSharjeStartDateRule.Validate(Hepsa.Core.Common.PersentationController.GetMaskedTextBoxValue(DriverCardSharjeEndDate_nvcTextBox)) == false) { DateEroorList.Add(DriverCardSharjeStartDateRule.Description + "\n"); } Hepsa.Core.Validation.DateRule <string> HealthCardEndDateRule = new Hepsa.Core.Validation.DateRule <string>("HealthCardEndDate_nvc", "تاريخ اتمام اعتبار کارت سلامت", null, null); if (HealthCardEndDateRule.Validate(Hepsa.Core.Common.PersentationController.GetMaskedTextBoxValue(HealthCardEndDate_nvcTextBox)) == false) { DateEroorList.Add(HealthCardEndDateRule.Description + "\n"); } if (DateEroorList != null && DateEroorList.Count > 0) { throw new ApplicationException(DateEroorList.Aggregate((i, j) => i + j)); } DriverInformationSave(); } 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 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 { 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 CarControlButton_Click(object sender, EventArgs e) { try { if (!string.IsNullOrEmpty(_CarCardNumber)) { //HPS.Present.DriverSpecification.DriverSpecificationEntityForm frm = new HPS.Present.DriverSpecification.DriverSpecificationEntityForm(CarCardNumber_nvcTextBox.Text,false); //frm.ShowDialog(); List <string> DateEroorList = new List <string>(); Hepsa.Core.Validation.TodayDateRule InsuranceEndDate_nvcRule = new Hepsa.Core.Validation.TodayDateRule("InsuranceEndDate_nvc", "تاريخ اتمام بيمه"); if (InsuranceEndDate_nvcRule.Validate(Hepsa.Core.Common.PersentationController.GetMaskedTextBoxValue(InsuranceEndDate_nvcTextBox)) == false) { DateEroorList.Add(InsuranceEndDate_nvcRule.Description + "\n"); } Hepsa.Core.Validation.TodayDateRule CarExaminationEndTodayDateRule = new Hepsa.Core.Validation.TodayDateRule("CarExaminationEndDate_nvc", "تاريخ اتمام معاينه"); if (CarExaminationEndTodayDateRule.Validate(Hepsa.Core.Common.PersentationController.GetMaskedTextBoxValue(CarExaminationEndDate_nvcTextBox)) == false) { DateEroorList.Add(CarExaminationEndTodayDateRule.Description + "\n"); } ////////////add not null rule Hepsa.Core.Validation.NotNullRule InsuranceEndDateNotNullRule = new Hepsa.Core.Validation.NotNullRule("InsuranceEndDate_nvc", "تاريخ اتمام بيمه"); if (InsuranceEndDateNotNullRule.Validate(Hepsa.Core.Common.PersentationController.GetMaskedTextBoxValue(InsuranceEndDate_nvcTextBox)) == false) { DateEroorList.Add(InsuranceEndDateNotNullRule.Description + "\n"); } Hepsa.Core.Validation.NotNullRule CarExaminationEndDateNotNullRule = new Hepsa.Core.Validation.NotNullRule("CarExaminationEndDate_nvc", "تاريخ اتمام معاينه"); if (CarExaminationEndDateNotNullRule.Validate(Hepsa.Core.Common.PersentationController.GetMaskedTextBoxValue(CarExaminationEndDate_nvcTextBox)) == false) { DateEroorList.Add(CarExaminationEndDateNotNullRule.Description + "\n"); } ////////////add date rule Hepsa.Core.Validation.DateRule <string> InsuranceEndDateaDateRule = new Hepsa.Core.Validation.DateRule <string>("InsuranceEndDate_nvc", "تاريخ اتمام بيمه", null, null); if (InsuranceEndDateaDateRule.Validate(Hepsa.Core.Common.PersentationController.GetMaskedTextBoxValue(InsuranceEndDate_nvcTextBox)) == false) { DateEroorList.Add(InsuranceEndDateaDateRule.Description + "\n"); } Hepsa.Core.Validation.DateRule <string> CarExaminationEndDateRule = new Hepsa.Core.Validation.DateRule <string>("CarExaminationEndDate_nvc", "تاريخ اتمام معاينه", null, null); if (CarExaminationEndDateRule.Validate(Hepsa.Core.Common.PersentationController.GetMaskedTextBoxValue(CarExaminationEndDate_nvcTextBox)) == false) { DateEroorList.Add(CarExaminationEndDateRule.Description + "\n"); } if (DateEroorList != null && DateEroorList.Count > 0) { throw new ApplicationException(DateEroorList.Aggregate((i, j) => i + j)); } HPS.BLL.DriverSpecificationBLL.BLLDriverSpecification_TFactory DriverSpecificationFactory = new HPS.BLL.DriverSpecificationBLL.BLLDriverSpecification_TFactory(); try { HPS.BLL.DriverSpecificationBLL.BLLDriverSpecification_T DriverSpecificationEntity = new HPS.BLL.DriverSpecificationBLL.BLLDriverSpecification_T(); DriverSpecificationEntity.CarExamination_bit = false; DriverSpecificationEntity.Insurance_bit = false; DriverSpecificationEntity.HealthCard_bit = false; DriverSpecificationEntity.DriverCardSharje_bit = false; DriverSpecificationEntity.StatisticCard_bit = false; DriverSpecificationEntity.CarCardNumber_nvc = _CarCardNumber; DriverSpecificationEntity.CarExaminationEndDate_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(CarExaminationEndDate_nvcTextBox.Text, TypeCode.String).ToString(); DriverSpecificationEntity.InsuranceEndDate_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(InsuranceEndDate_nvcTextBox.Text, TypeCode.String).ToString(); HPS.BLL.DriverSpecificationBLL.BLLDriverSpecification_TKeys driverSpecificationkey = new BLL.DriverSpecificationBLL.BLLDriverSpecification_TKeys(); if (_DriverSpecificationID != 0) { driverSpecificationkey.DriverSpecificationID_int = _DriverSpecificationID; DriverSpecificationFactory.BeginProc(); DriverSpecificationFactory.Update(DriverSpecificationEntity, driverSpecificationkey); DriverSpecificationFactory.CommitProc(); Hepsa.Core.Common.MessageBox.InformationMessage("اطلاعات ثبت شد"); } else { DriverSpecificationFactory.BeginProc(); DriverSpecificationFactory.Insert(DriverSpecificationEntity); DriverSpecificationFactory.CommitProc(); Hepsa.Core.Common.MessageBox.InformationMessage("اطلاعات ثبت شد"); } } catch (Exception ex) { DriverSpecificationFactory.RollBackProc(); Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message); } //DriverInformationSave(); } else { throw new ApplicationException("اطلاعات ناوگان خالی است"); } } catch (Exception ex) { Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message); } }
private void ShowButton_Click(object sender, EventArgs e) { Hepsa.Core.BLL.BLLAction_TFactory ActionFactory = new Hepsa.Core.BLL.BLLAction_TFactory(); 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); } InCountstiReport.Dictionary.Synchronize(); InCountstiReport.Dictionary.Databases.Clear(); InCountstiReport.Dictionary.Databases.Add(new Stimulsoft.Report.Dictionary.StiSqlDatabase("Connection", Hepsa.Core.Common.ConnectionString.ConnectionString)); InCountstiReport.Compile(); InCountstiReport["organ"] = new HPS.BLL.SettingsBLL.BLLSetting_TFactory().GetBy(new BLL.SettingsBLL.BLLSetting_TKeys() { SettingID_int = 1029 }).Value_nvc.ToString(); InCountstiReport["fromdate"] = FromDatefaDatePicker.Text; InCountstiReport["todate"] = ToDatefaDatePicker.Text; InCountstiReport["fromtime_nvc"] = FromTimeTextBox.Text; InCountstiReport["totime_nvc"] = ToTimeTextBox.Text; InCountstiReport["date"] = ActionFactory.ServerJalaliDate; InCountstiReport["UserName"] = HPS.Common.CurrentUser.user.UserName_nvc; InCountstiReport["@FromDate_nvc"] = FromDatefaDatePicker.Text; InCountstiReport["@ToDate_nvc"] = ToDatefaDatePicker.Text; InCountstiReport["@fromtime_nvc"] = FromTimeTextBox.Text; InCountstiReport["@totime_nvc"] = ToTimeTextBox.Text; InCountstiReport.Render(); InCountstiViewerControl.Report = InCountstiReport; } 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 ShowButton_Click(object sender, EventArgs e) { try { string Condition = string.Empty; Properties.Settings Setting = new HPS.Properties.Settings(); Int32?SaloonID_int = null; if (Setting.SaloonID_int != 0) { SaloonID_int = Setting.SaloonID_int; } HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TFactory LadeAssignmentFactory = new HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TFactory(); DataTable LadeAssignmentDataTable = new DataTable(); if (string.IsNullOrEmpty(LadeAssingmentID_binttextBox.Text)) { if (!FromDatefaDatePicker.IsNull) { 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); } else { Condition = string.Format("Date_nvc >= '{0}'", FromDatefaDatePicker.Text); } } if (!ToDatefaDatePicker.IsNull) { 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); } else { Condition = string.Format(" {0} And Date_nvc <='{1}'", Condition, ToDatefaDatePicker.Text); } } if (this.CompanyID_intComboBox.SelectedIndex != -1) { Condition = string.Format("{0} And CompanyID_int = {1}", Condition, CompanyID_intComboBox.SelectedValue.ToString()); } if (this.LaderTypeID_intComboBox.SelectedIndex != -1) { Condition = string.Format("{0} And LaderTypeID = {1}", Condition, LaderTypeID_intComboBox.SelectedValue.ToString()); } if (GoodID_intcomboBox.SelectedIndex != -1) { Condition = string.Format("{0} And GoodID_int = {1}", Condition, GoodID_intcomboBox.SelectedValue.ToString()); } if (PortPlaceID_intcomboBox.SelectedIndex != -1) { Condition = string.Format("{0} And PortPlaceID_int = {1}", Condition, PortPlaceID_intcomboBox.SelectedValue.ToString()); } if (DestinationCityID_intcomboBox.SelectedIndex != -1) { Condition = string.Format("{0} And CityID_int = {1} ", Condition, DestinationCityID_intcomboBox.SelectedValue.ToString()); } if (Condition.Length > 0) { if (Condition.Substring(0, 4) == " And") { Condition = Condition.Substring(4, Condition.Length - 4); } } } else { DestinationCityID_intcomboBox.SelectedIndex = -1; PortPlaceID_intcomboBox.SelectedIndex = -1; GoodID_intcomboBox.SelectedIndex = -1; LaderTypeID_intComboBox.SelectedIndex = -1; CompanyID_intComboBox.SelectedIndex = -1; this.FromDatefaDatePicker.IsNull = true; //.SelectedDateTime = FarsiLibrary.Utils.PersianDateConverter.ToGregorianDateTime(LadeAssignmentFactory.ServerJalaliDate); this.ToDatefaDatePicker.IsNull = true; //SelectedDateTime = FarsiLibrary.Utils.PersianDateConverter.ToGregorianDateTime(LadeAssignmentFactory.ServerJalaliDate); Condition = string.Format(" LadeAssignmentID_bint = {0} ", LadeAssingmentID_binttextBox.Text); } LadeAssignmentFactory.GetAllByCondition(Condition, SaloonID_int, ref LadeAssignmentDataTable); this.LadeAssignmentGridView.AutoGenerateColumns = false; this.LadeAssignmentGridView.DataSource = LadeAssignmentDataTable; } 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); } 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 { 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 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 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) { try { string Condition = string.Empty; Properties.Settings Setting = new HPS.Properties.Settings(); Int32?SaloonID_int = null; if (Setting.SaloonID_int != 0) { SaloonID_int = Setting.SaloonID_int; } HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TFactory LadeAssignmentFactory = new HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TFactory(); DataTable LadeAssignmentDataTable = new DataTable(); if (string.IsNullOrEmpty(LadeAssingmentID_binttextBox.Text)) { if (!FromDatefaDatePicker.IsNull) { 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); } else { DateTime MiladiCurrentDate = LadeAssignmentFactory.ServerDate.AddDays(-30); Hepsa.Core.Common.MyDateTime OneMonthBeforeCurrentDate = new Hepsa.Core.Common.MyDateTime(MiladiCurrentDate); if (FromDatefaDatePicker.Text.CompareTo(OneMonthBeforeCurrentDate.ConvertToPersianShortDate()) < 0) { throw new ApplicationException("تاریخ شروع نمی تواند کمتر از یک ماه اخیر باشد"); } Condition = string.Format("Date_nvc >= '{0}'", FromDatefaDatePicker.Text); } } if (!ToDatefaDatePicker.IsNull) { 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); } else { Condition = string.Format(" {0} And Date_nvc <='{1}'", Condition, ToDatefaDatePicker.Text); } } if (HPS.Common.CurrentUser.user.CompanyID_int != null) { Condition = string.Format("{0} And CompanyID_int = {1}", Condition, HPS.Common.CurrentUser.user.CompanyID_int); } if (this.LaderTypeID_intComboBox.SelectedIndex != -1) { Condition = string.Format("{0} And LaderTypeID = {1}", Condition, LaderTypeID_intComboBox.SelectedValue.ToString()); } if (GoodID_intcomboBox.SelectedIndex != -1) { Condition = string.Format("{0} And GoodID_int = {1}", Condition, GoodID_intcomboBox.SelectedValue.ToString()); } if (PortPlaceID_intcomboBox.SelectedIndex != -1) { Condition = string.Format("{0} And PortPlaceID_int = {1}", Condition, PortPlaceID_intcomboBox.SelectedValue.ToString()); } if (DestinationCityID_intcomboBox.SelectedIndex != -1) { Condition = string.Format("{0} And CityID_int = {1} ", Condition, DestinationCityID_intcomboBox.SelectedValue.ToString()); } if (Condition.Length > 0) { if (Condition.Substring(0, 4) == " And") { Condition = Condition.Substring(4, Condition.Length - 4); } } } else { DestinationCityID_intcomboBox.SelectedIndex = -1; PortPlaceID_intcomboBox.SelectedIndex = -1; GoodID_intcomboBox.SelectedIndex = -1; LaderTypeID_intComboBox.SelectedIndex = -1; this.FromDatefaDatePicker.IsNull = true; this.ToDatefaDatePicker.IsNull = true; if (HPS.Common.CurrentUser.user.CompanyID_int != null) { Condition = string.Format("CompanyID_int = {0} and ", HPS.Common.CurrentUser.user.CompanyID_int); } Condition += string.Format(" LadeAssignmentID_bint = {0} ", LadeAssingmentID_binttextBox.Text); } LadeAssignmentFactory.GetAllByCondition(Condition, SaloonID_int, ref LadeAssignmentDataTable); this.LadeAssignmentGridView.AutoGenerateColumns = false; this.LadeAssignmentGridView.DataSource = LadeAssignmentDataTable; } 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); } }