示例#1
0
        private void LoadTurnManagement()
        {
            try
            {
                if (_TurnStatus == 1) //return
                {
                    HPS.BLL.SettingsBLL.BLLSetting_TFactory SettingFactory = new HPS.BLL.SettingsBLL.BLLSetting_TFactory();
                    HPS.BLL.SettingsBLL.BLLSetting_T        SettingEntity  = new HPS.BLL.SettingsBLL.BLLSetting_T();
                    HPS.BLL.SettingsBLL.BLLSetting_TKeys    SettingKey     = new HPS.BLL.SettingsBLL.BLLSetting_TKeys();
                    DateTime NowDate        = DateTime.Parse((new Hepsa.Core.Common.MyDateTime(SettingFactory.ServerJalaliDate)).MyDate.ToString("yyyy/MM/dd") + " " + SettingFactory.ServerTime);
                    DateTime SubtractedTime = NowDate.Subtract(new TimeSpan(Convert.ToInt32(SettingEntity.Value_nvc), 0, 0));

                    SettingKey.SettingID_int = 1001;
                    SettingEntity            = SettingFactory.GetBy(SettingKey);
                    HPS.BLL.TurnManagementBLL.BLLTurnManagement_TFactory TurnManagementFactory = new HPS.BLL.TurnManagementBLL.BLLTurnManagement_TFactory();
                    DataTable TurnManagementDataTable = new DataTable();
                    TurnManagementFactory.GetAllWithTrafficForReturnTurn(SettingFactory.ServerJalaliDate, SubtractedTime.ToString("HH:mm"), null, null, string.Empty, string.Empty, string.Empty, string.Empty, ref TurnManagementDataTable);
                    this.TurnManagementGridView.DataSource = TurnManagementDataTable;
                }
                else //cancel
                {
                    CanceledTurnFromLadbilltoolStripButton.Visible = false;

                    HPS.BLL.TurnManagementBLL.BLLTurnManagement_TFactory TurnManagementFactory = new HPS.BLL.TurnManagementBLL.BLLTurnManagement_TFactory();
                    DataTable TurnManagementDataTable = new DataTable();
                    TurnManagementFactory.GetAllWithTrafficForCancelTurn(null, null, string.Empty, string.Empty, string.Empty, string.Empty, ref TurnManagementDataTable);
                    this.TurnManagementGridView.DataSource = TurnManagementDataTable;
                }
            }
            catch (System.Exception ex)
            {
                throw ex;
            }
        }
示例#2
0
        private void Search()
        {
            try
            {
                TurnManagementGridView.DataSource = null;

                DataTable TrafficDataTable = new DataTable();
                HPS.BLL.TrafficBLL.BLLTraffic_TFactory TrafficFactory = new HPS.BLL.TrafficBLL.BLLTraffic_TFactory();
                string Condition = string.Empty;

                if (_TurnStatus == 1)//return
                {
                    HPS.BLL.SettingsBLL.BLLSetting_TFactory SettingFactory = new HPS.BLL.SettingsBLL.BLLSetting_TFactory();
                    HPS.BLL.SettingsBLL.BLLSetting_T        SettingEntity  = new HPS.BLL.SettingsBLL.BLLSetting_T();
                    HPS.BLL.SettingsBLL.BLLSetting_TKeys    SettingKey     = new HPS.BLL.SettingsBLL.BLLSetting_TKeys();
                    SettingKey.SettingID_int = 1001;
                    SettingEntity            = SettingFactory.GetBy(SettingKey);

                    DateTime NowDate        = DateTime.Parse((new Hepsa.Core.Common.MyDateTime(SettingFactory.ServerJalaliDate)).MyDate.ToString("yyyy/MM/dd") + " " + SettingFactory.ServerTime);
                    DateTime SubtractedTime = NowDate.Subtract(new TimeSpan(Convert.ToInt32(SettingEntity.Value_nvc), 0, 0));



                    HPS.BLL.TurnManagementBLL.BLLTurnManagement_TFactory TurnManagementFactory = new HPS.BLL.TurnManagementBLL.BLLTurnManagement_TFactory();
                    DataTable TurnManagementDataTable = new DataTable();
                    if (!string.IsNullOrEmpty(TrafficNumberTextBox.Text))
                    {
                        TurnManagementFactory.GetAllWithTrafficForReturnTurn(SettingFactory.ServerJalaliDate, SubtractedTime.ToString("HH:mm"), Int64.Parse(TrafficNumberTextBox.Text), null, string.Empty, string.Empty, string.Empty, string.Empty, ref TurnManagementDataTable);
                    }
                    else if (!string.IsNullOrEmpty(AcceptedTurnNumberTextBox.Text))
                    {
                        TurnManagementFactory.GetAllWithTrafficForReturnTurn(SettingFactory.ServerJalaliDate, SubtractedTime.ToString("HH:mm"), null, Int64.Parse(AcceptedTurnNumberTextBox.Text), string.Empty, string.Empty, string.Empty, string.Empty, ref TurnManagementDataTable);
                    }
                    else if (!string.IsNullOrEmpty(NumberPlate_nvcTextBox.Text) && !string.IsNullOrEmpty(SerialPlate_nvcTextBox.Text))
                    {
                        TurnManagementFactory.GetAllWithTrafficForReturnTurn(SettingFactory.ServerJalaliDate, SubtractedTime.ToString("HH:mm"), null, null, NumberPlate_nvcTextBox.Text, SerialPlate_nvcTextBox.Text, string.Empty, string.Empty, ref TurnManagementDataTable);
                    }
                    else if (!string.IsNullOrEmpty(FromDate_nvcTextBox.Text) && !string.IsNullOrEmpty(ToDate_nvcTextBox.Text))
                    {
                        TurnManagementFactory.GetAllWithTrafficForReturnTurn(SettingFactory.ServerJalaliDate, SubtractedTime.ToString("HH:mm"), null, null, string.Empty, string.Empty, FromDate_nvcTextBox.Text, ToDate_nvcTextBox.Text, ref TurnManagementDataTable);
                    }
                    this.TurnManagementGridView.DataSource = TurnManagementDataTable;
                }
                else//cancel
                {
                    CanceledTurnFromLadbilltoolStripButton.Visible = false;
                    this.Text = "لیست نوبت ها برای ابطال";
                    HPS.BLL.TurnManagementBLL.BLLTurnManagement_TFactory TurnManagementFactory = new HPS.BLL.TurnManagementBLL.BLLTurnManagement_TFactory();
                    DataTable TurnManagementDataTable = new DataTable();
                    if (!string.IsNullOrEmpty(TrafficNumberTextBox.Text))
                    {
                        TurnManagementFactory.GetAllWithTrafficForCancelTurn(Int64.Parse(TrafficNumberTextBox.Text), null, string.Empty, string.Empty, string.Empty, string.Empty, ref TurnManagementDataTable);
                    }
                    else if (!string.IsNullOrEmpty(AcceptedTurnNumberTextBox.Text))
                    {
                        TurnManagementFactory.GetAllWithTrafficForCancelTurn(null, Int64.Parse(AcceptedTurnNumberTextBox.Text), string.Empty, string.Empty, string.Empty, string.Empty, ref TurnManagementDataTable);
                    }
                    else if (!string.IsNullOrEmpty(NumberPlate_nvcTextBox.Text) && !string.IsNullOrEmpty(SerialPlate_nvcTextBox.Text))
                    {
                        TurnManagementFactory.GetAllWithTrafficForCancelTurn(null, null, NumberPlate_nvcTextBox.Text, SerialPlate_nvcTextBox.Text, string.Empty, string.Empty, ref TurnManagementDataTable);
                    }
                    else if (!string.IsNullOrEmpty(FromDate_nvcTextBox.Text) && !string.IsNullOrEmpty(ToDate_nvcTextBox.Text))
                    {
                        TurnManagementFactory.GetAllWithTrafficForCancelTurn(null, null, string.Empty, string.Empty, FromDate_nvcTextBox.Text, ToDate_nvcTextBox.Text, ref TurnManagementDataTable);
                    }
                    this.TurnManagementGridView.DataSource = TurnManagementDataTable;
                }
            }
            catch (System.Exception ex)
            {
                Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message);
            }
        }