Exemple #1
0
        private void TurnPrintStripButton_Click(object sender, EventArgs e)
        {
            try
            {
                HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory LadBillCreditFactory = new HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory();
                string condition = "LadBillCredit_T.TrafficID_bint='" + Hepsa.Core.Common.PersentationController.GetEntityValue(this.TrafficGridView.CurrentRow.Cells[colTrafficID_bint.Name].Value, TypeCode.Int64) + "' or (LadBillCredit_T.LadBillCreditID_int is not null and LadBillCredit_T.Canceled_bit=0 AND LadBillCredit_T.Turn_bit is not NULL)";
                List <HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_T> LadBillCreditList = LadBillCreditFactory.GetAllByCondition(condition);

                if (LadBillCreditList != null && LadBillCreditList.Count > 0)
                {
                    bool?ladturn = LadBillCreditList[LadBillCreditList.Count - 1].Turn_bit;
                    if (LadBillCreditList[LadBillCreditList.Count - 1].Canceled_bit == false || (LadBillCreditList[LadBillCreditList.Count - 1].Canceled_bit == true && ladturn == false))
                    {
                        throw new ApplicationException("نوبت مورد نظر مجوز گرفته است");
                    }
                }
                HPS.BLL.TurnManagementBLL.BLLTurnManagement_TFactory TurnManagementFactory = new HPS.BLL.TurnManagementBLL.BLLTurnManagement_TFactory();
                string    conditionTurnManagement = string.Format("TurnManagement_T.TrafficID_bint='{0}' ", Hepsa.Core.Common.PersentationController.GetEntityValue(this.TrafficGridView.CurrentRow.Cells[colTrafficID_bint.Name].Value, TypeCode.Int64));
                DataTable TurnManagementTable     = new DataTable();
                TurnManagementFactory.GetAllByCondition(conditionTurnManagement, ref TurnManagementTable);
                if (TurnManagementTable != null && TurnManagementTable.Rows.Count > 0)
                {
                    if (TurnManagementTable.Rows[TurnManagementTable.Rows.Count - 1]["Return_bit"].ToString() == "False")
                    {
                        throw new ApplicationException("نوبت مورد نظر باطل شده است");
                    }
                }

                //HPS.Reports.ReportDoc.AcceptedTurnReport rpt = new HPS.Reports.ReportDoc.AcceptedTurnReport((Int64)Hepsa.Core.Common.PersentationController.GetEntityValue(this.TrafficGridView.CurrentRow.Cells[colTrafficID_bint.Name].Value, TypeCode.Int64));
                //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);
                //}
                ///


                HPS.BLL.TrafficBLL.BLLTraffic_TFactory TrafficFactory   = new HPS.BLL.TrafficBLL.BLLTraffic_TFactory();
                HPS.BLL.TrafficBLL.BLLTraffic_TKeys    TrafficKey       = new HPS.BLL.TrafficBLL.BLLTraffic_TKeys();
                HPS.BLL.TrafficBLL.BLLTraffic_T        TrafficEntityrpt = new HPS.BLL.TrafficBLL.BLLTraffic_T();
                TrafficKey.TrafficID_bint = (Int64)Hepsa.Core.Common.PersentationController.GetEntityValue(this.TrafficGridView.CurrentRow.Cells[colTrafficID_bint.Name].Value, TypeCode.Int64);
                TrafficEntityrpt          = TrafficFactory.GetBy(TrafficKey);

                HPS.Reports.Forms.StimulViewer frm = new Reports.Forms.StimulViewer(TrafficEntityrpt, false, false);
                frm.ShowDialog();
                //
            }
            catch (Exception ex)
            {
                Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message);
            }
        }
Exemple #2
0
 public CancelLadBillCreditCommentForm(DataTable dataTable, HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TKeys Key, HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TKeys LaKey, HPS.BLL.TrafficBLL.BLLTraffic_TKeys TrafficKey)
 {
     InitializeComponent();
     this._Key        = Key;
     this._dataTable  = dataTable;
     this._LaKey      = LaKey;
     this._TrafficKey = TrafficKey;
 }
Exemple #3
0
 public TurnManagementEntityForm(Hepsa.Core.PL.BaseEntityParentForm.enmState State, DataTable DataTable, HPS.BLL.TrafficBLL.BLLTraffic_TKeys Key, Int32 TurnStatus, Int32?LadBillCreditID_int)
     : base(State, DataTable, null)
 {
     InitializeComponent();
     this._TurnStatus     = TurnStatus;
     this._TrafficKey     = Key;
     _LadBillCreditID_int = LadBillCreditID_int;
     LoadForm();
 }
Exemple #4
0
        protected override void Edit()
        {
            try
            {
                if (TrafficGridView.CurrentRow != null && (Int64)TrafficGridView.CurrentRow.Cells[colTrafficID_bint.Name].Value != 0)
                {
                    HPS.BLL.TrafficBLL.BLLTraffic_TFactory TrafficFactory = new HPS.BLL.TrafficBLL.BLLTraffic_TFactory();
                    DataTable OutDataTable = new DataTable();
                    string    outcondition = "";
                    TrafficFactory.GetAllByConditionOut("", ref OutDataTable);
                    if ((Int64)TrafficGridView.CurrentRow.Cells[colTrafficID_bint.Name].Value != (Int64)TrafficGridView.CurrentRow.Cells[colMaxTrafficID_bint.Name].Value)
                    {
                        Hepsa.Core.Common.MessageBox.ErrorMessage("امکان احیای این خروج وجود ندارد ، این ناوگان ورود داشته است");
                        return;
                    }
                    if (Hepsa.Core.Common.MessageBox.ConfirmMessage("آیا از احیای این خروج اطمینان دارید؟") == true)
                    {
                        HPS.BLL.TrafficBLL.BLLTraffic_TFactory trafficFactory = new HPS.BLL.TrafficBLL.BLLTraffic_TFactory();
                        HPS.BLL.TrafficBLL.BLLTraffic_TKeys    trafficKey     = new HPS.BLL.TrafficBLL.BLLTraffic_TKeys();
                        trafficKey.TrafficID_bint = (Int64)TrafficGridView.CurrentRow.Cells[colTrafficID_bint.Name].Value;
                        string _LogBody = "<table border=\"1\">";
                        foreach (DataGridViewColumn col in TrafficGridView.Columns)
                        {
                            if (col.Visible)
                            {
                                _LogBody += string.Format("<tr><td>{0}</td><td>{1}</td></tr>", col.HeaderText, TrafficGridView.CurrentRow.Cells[col.Name].Value);
                            }
                        }
                        _LogBody += "</table>";

                        trafficFactory.BeginProc();
                        trafficFactory.Delete(trafficKey);
                        /********Start Logging********/
                        Hepsa.Core.BLL.BLLLog_TFactory LogFactory = new Hepsa.Core.BLL.BLLLog_TFactory();
                        Hepsa.Core.BLL.BLLLog_T        LogEntity  = new Hepsa.Core.BLL.BLLLog_T();
                        LogEntity.Date_nvc       = LogFactory.ServerJalaliDate;
                        LogEntity.Time_nvc       = LogFactory.ServerTime;
                        LogEntity.IPAddress_nvc  = Hepsa.Core.Common.ApplicationInfo.IpAddress;
                        LogEntity.MacAddress_nvc = Hepsa.Core.Common.ApplicationInfo.MacAddress;
                        LogEntity.UserName_nvc   = Hepsa.Core.Common.CurrentUser.User.UserName_nvc;
                        LogEntity.FormText_nvc   = String.IsNullOrEmpty(this.Text) ? this.Name : this.Text;
                        LogEntity.ActionID_int   = Convert.ToInt32(Hepsa.Core.BLL.BLLAction_T.Actions.Delete);
                        LogEntity.Body_nvc       = _LogBody;
                        LogFactory.Insert(LogEntity);
                        /********End Logging********/
                        trafficFactory.CommitProc();
                        this.LoadGrid();
                    }
                }
            }
            catch (Exception ex)
            {
                Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message);
            }
        }
Exemple #5
0
 public void GetBy(HPS.BLL.TrafficBLL.BLLTraffic_TKeys keys, ref System.Data.DataSet dataSet, String srcTable)
 {
     try
     {
         _dataObject.SelectByPrimaryKey(keys, ref dataSet, srcTable);
     }
     catch (System.Exception ex)
     {
         throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this);
     }
 }
Exemple #6
0
 public HPS.BLL.TrafficBLL.BLLTraffic_T GetBy(HPS.BLL.TrafficBLL.BLLTraffic_TKeys keys)
 {
     try
     {
         return(_dataObject.SelectByPrimaryKey(keys));
     }
     catch (System.Exception ex)
     {
         throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this);
     }
 }
Exemple #7
0
 public void Delete(HPS.BLL.TrafficBLL.BLLTraffic_TKeys keys)
 {
     try
     {
         _dataObject.Delete(keys);
     }
     catch (System.Exception ex)
     {
         throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this);
     }
 }
Exemple #8
0
 private void CancelButton_Click(object sender, EventArgs e)
 {
     try
     {
         //ابطال نوبت
         HPS.BLL.TurnManagementBLL.BLLTurnManagement_TFactory TurnManagementFactory = new HPS.BLL.TurnManagementBLL.BLLTurnManagement_TFactory();
         if (TurnManagementGridView.Rows.Count != 0)
         {
             Int64?s = (Int64?)Hepsa.Core.Common.PersentationController.GetEntityValue(this.TurnManagementGridView.CurrentRow.Cells["colTurnManagementID_int"].Value, TypeCode.Int64);
             if (s.HasValue)
             {
                 string    condition = "([TurnManagement_T].[TurnManagementID_int]=" + s.ToString() + ")";
                 DataTable dt        = new DataTable();
                 TurnManagementFactory.GetAllByConditionWithTraffic(condition, ref dt);
                 if (Convert.ToBoolean(dt.Rows[0]["Return_bit"].ToString()) == false && !string.IsNullOrEmpty(Convert.ToString(dt.Rows[0]["TurnCancelCommantID_int"])))
                 {
                     Hepsa.Core.Common.MessageBox.InformationMessage("این نوبت باطل شده است");
                 }
             }
             HPS.BLL.TrafficBLL.BLLTraffic_TKeys TrafficKey = new HPS.BLL.TrafficBLL.BLLTraffic_TKeys();
             TrafficKey.TrafficID_bint = (Int64)Hepsa.Core.Common.PersentationController.GetEntityValue(this.TurnManagementGridView.CurrentRow.Cells[this.colTurnManagementTrafficID_bint.Name].Value, TypeCode.Int64);
             //if (_TurnStatus == 1)
             //{
             TurnManagementEntityForm TurnManagement = new TurnManagementEntityForm(BaseEntityForm1.enmState.Edit, (DataTable)this.TurnManagementGridView.DataSource, TrafficKey, 0, 0);
             TurnManagement.ShowDialog();
             //}
             //else
             //{
             //    TurnManagementEntityForm TurnManagement = new TurnManagementEntityForm(BaseEntityForm1.enmState.Edit, (DataTable)this.TurnManagementGridView.DataSource, TrafficKey, 0, null);
             //    TurnManagement.ShowDialog();
             //}
         }
         //HPS.BLL.TurnManagementBLL.BLLTurnManagement_TFactory TurnManagementFactory = new HPS.BLL.TurnManagementBLL.BLLTurnManagement_TFactory();
         //    HPS.BLL.TurnManagementBLL.BLLTurnManagement_T TurnManagementEntity = new HPS.BLL.TurnManagementBLL.BLLTurnManagement_T();
         //TurnManagementEntity.TurnCancelCommantID_int =38;
         //TurnManagementEntity.TurnCancelCommment_nvc = "به دستور مديريت نوبت باطل گرديد";
         //TurnManagementEntity.Return_bit = false;
         //TurnManagementEntity.Date_nvc = TurnManagementFactory.ServerJalaliDate;
         //TurnManagementEntity.Time_nvc = TurnManagementFactory.ServerTime;
         //TurnManagementEntity.UserName_nvc = HPS.Common.CurrentUser.user.UserName_nvc;
         //TurnManagementEntity.TrafficID_bint = (Int64?)TurnManagementGridView.CurrentRow.Cells["TrafficID_bint"].Value;
         //TurnManagementFactory.Insert(TurnManagementEntity);
     }
     catch (Exception ex)
     {
         Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message);
     }
 }
Exemple #9
0
        private void CancelationButton_Click(object sender, EventArgs e)
        {
            Int64?    TrafficID_bint = (Int64?)Hepsa.Core.Common.PersentationController.GetEntityValue(LadBillWithTrafficGridView.CurrentRow.Cells["colTrafficID_bint"].Value, TypeCode.Int64);
            DataTable OutDatatable   = new DataTable();

            HPS.BLL.TrafficBLL.BLLTraffic_TFactory TrafficFactory = new HPS.BLL.TrafficBLL.BLLTraffic_TFactory();
            try
            {
                if (LadBillWithTrafficGridView.CurrentRow != null)
                {
                    bool?Canceled_bit = (bool?)Hepsa.Core.Common.PersentationController.GetEntityValue(LadBillWithTrafficGridView.CurrentRow.Cells["colCanceled_bit"].Value, TypeCode.Boolean);
                    if (Canceled_bit.HasValue && Canceled_bit == true)
                    {
                        throw new ApplicationException("این مجوز باطل شده است");
                    }
                    else
                    {
                        //TrafficFactory.GetAllByCondition(string.Format("[Traffic_T].Out_bit=1 and [Traffic_T].TrafficNumber_bint={0}", LadBillWithTrafficGridView.CurrentRow.Cells["TrafficNumber_bint"].Value), ref OutDatatable);
                        //if (OutDatatable.Rows.Count == 0)
                        //{
                        //    //throw new ApplicationException("این خودرو خارج نشده است");
                        //    Hepsa.Core.Common.MessageBox.ErrorMessage("این خودرو خارج نشده است");
                        //}
                        this.LastRowIndex = LadBillWithTrafficGridView.CurrentRow.Index;
                        int?LadBillCreditID_int = (int?)Hepsa.Core.Common.PersentationController.GetEntityValue(LadBillWithTrafficGridView.CurrentRow.Cells["LadBillCreditID_int"].Value, TypeCode.Int32);
                        if (LadBillCreditID_int.HasValue)
                        {
                            HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TKeys key = new HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TKeys();
                            key.LadBillCreditID_int = LadBillCreditID_int.Value;
                            HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TKeys LaKey = new BLL.LadeAssignmentBLL.BLLLadeAssignment_TKeys();
                            HPS.BLL.TrafficBLL.BLLTraffic_TKeys TrafficKey          = new HPS.BLL.TrafficBLL.BLLTraffic_TKeys();
                            TrafficKey.TrafficID_bint   = Convert.ToInt64(this.LadBillWithTrafficGridView.CurrentRow.Cells[colTrafficID_bint.Name].Value);
                            LaKey.LadeAssignmentID_bint = Convert.ToInt64(this.LadBillWithTrafficGridView.CurrentRow.Cells["LadeAssignmentID_bint"].Value);
                            HPS.Present.CancelLadBillCreditComment.CancelLadBillCreditCommentForm CancelLadBillCreditCommentForm = new HPS.Present.CancelLadBillCreditComment.CancelLadBillCreditCommentForm((DataTable)this.LadBillWithTrafficGridView.DataSource, key, LaKey, TrafficKey);
                            CancelLadBillCreditCommentForm.ShowDialog();
                        }
                    }
                }
                LadBillCreditTextBox.Focus();
            }
            catch (Exception ex)
            {
                Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message);
            }
        }
Exemple #10
0
 private void NewButton_Click(object sender, EventArgs e)
 {
     try
     {
         HPS.BLL.TurnManagementBLL.BLLTurnManagement_TFactory TurnManagementFactory = new HPS.BLL.TurnManagementBLL.BLLTurnManagement_TFactory();
         if (TurnManagementGridView.Rows.Count != 0)
         {
             Int64?s = (Int64?)Hepsa.Core.Common.PersentationController.GetEntityValue(this.TurnManagementGridView.CurrentRow.Cells["colTurnManagementID_int"].Value, TypeCode.Int64);
             if (s.HasValue)
             {
                 string    condition = "([TurnManagement_T].[TurnManagementID_int]=" + s.ToString() + ")";
                 DataTable dt        = new DataTable();
                 TurnManagementFactory.GetAllByConditionWithTraffic(condition, ref dt);
                 if (Convert.ToBoolean(dt.Rows[0]["Return_bit"].ToString()) == false && !string.IsNullOrEmpty(Convert.ToString(dt.Rows[0]["TurnCancelCommantID_int"])))
                 {
                     Hepsa.Core.Common.MessageBox.InformationMessage("این نوبت باطل شده است");
                 }
             }
             HPS.BLL.TrafficBLL.BLLTraffic_TKeys TrafficKey = new HPS.BLL.TrafficBLL.BLLTraffic_TKeys();
             TrafficKey.TrafficID_bint = (Int64)Hepsa.Core.Common.PersentationController.GetEntityValue(this.TurnManagementGridView.CurrentRow.Cells[this.colTurnManagementTrafficID_bint.Name].Value, TypeCode.Int64);
             if (_TurnStatus == 1)
             {
                 TurnManagementEntityForm TurnManagement = new TurnManagementEntityForm(BaseEntityForm1.enmState.Edit, (DataTable)this.TurnManagementGridView.DataSource, TrafficKey, 1, Convert.ToInt32(TurnManagementGridView.CurrentRow.Cells[this.colLadBillCreditID_int.Name].Value));
                 TurnManagement.ShowDialog();
             }
             else
             {
                 TurnManagementEntityForm TurnManagement = new TurnManagementEntityForm(BaseEntityForm1.enmState.Edit, (DataTable)this.TurnManagementGridView.DataSource, TrafficKey, 0, null);
                 TurnManagement.ShowDialog();
             }
         }
     }
     catch (Exception ex)
     {
         Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message);
     }
 }
Exemple #11
0
        public void Update(HPS.BLL.TrafficBLL.BLLTraffic_T businessObject, HPS.BLL.TrafficBLL.BLLTraffic_TKeys businessObjectKey)
        {
            try
            {
                List <string> ExceptList = new List <string>();
                ExceptList.AddRange(new string[] { "UniqueTrafficID_bint", "DriverInfractionRule" });
                ExceptList.AddRange(new string[] { "UniqueDriverMobileNumber_nvc", "UniqueNationalCode_int", "InsertDriverDuplicateNumberRule" });
                ExceptList.AddRange(new string[] { "DuplicateTurnNumberInUpdateRule", "DuplicateTurnNumberInUpdateRule" });
                HPS.BLL.TrafficBLL.BLLTraffic_T trafficEntity = new BLLTraffic_T();

                if (businessObject.TrafficTypeID_int == 3)
                {
                    ExceptList.Add("System_nvc");
                }
                if (businessObject.TrafficID_bint == businessObjectKey.TrafficID_bint)
                {
                    if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, ExceptList.ToArray()) == false)
                    {
                        throw new Hepsa.Core.Validation.InvalidBusinessObjectException(businessObject.BrokenRulesList().ToString());
                    }
                }
                else
                {
                    if (businessObject.IsValid() == false)
                    {
                        throw new Hepsa.Core.Validation.InvalidBusinessObjectException(businessObject.BrokenRulesList().ToString());
                    }
                }

                _dataObject.Update(businessObject, businessObjectKey);
            }
            catch (System.Exception ex)
            {
                throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this);
            }
        }
Exemple #12
0
        public IranianTrafficEditReport(HPS.BLL.TrafficBLL.BLLTraffic_TKeys TrafficKey)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();
            HPS.BLL.TrafficBLL.BLLTraffic_TFactory TrafficFactory   = new HPS.BLL.TrafficBLL.BLLTraffic_TFactory();
            HPS.BLL.TrafficBLL.BLLTraffic_T        TrafficEntityrpt = TrafficFactory.GetBy(TrafficKey);
            DateTextBox.Text      = TrafficEntityrpt.Date_nvc;
            TimeTextBox.Text      = TrafficEntityrpt.Time_nvc;
            TrafficNumbertxt.Text = TrafficEntityrpt.TrafficNumber_bint.ToString();
            TurnNumbertxt.Text    = TrafficEntityrpt.TurnNumber_bint.ToString();
            HPS.BLL.ServicesBLL.BLLServices_TFactory servicesFactory = new HPS.BLL.ServicesBLL.BLLServices_TFactory();
            HPS.BLL.ServicesBLL.BLLServices_TKeys    ServicesKey     = new HPS.BLL.ServicesBLL.BLLServices_TKeys();
            ServicesKey.ServicesID_int = TrafficEntityrpt.ServiceID_int;
            HPS.BLL.ServicesBLL.BLLServices_T ServicesEntity = new HPS.BLL.ServicesBLL.BLLServices_T();
            ServicesEntity     = servicesFactory.GetBy(ServicesKey);
            Servicestxt.Text   = " مراجعه به : " + ServicesEntity.ServicesType_nvc;
            DriverNametxt.Text = " نام راننده : " + TrafficEntityrpt.FirstName_nvc + " " + TrafficEntityrpt.LastName_nvc;
            HPS.BLL.LaderTypeBLL.BLLLaderType_TFactory laderTypeFactory = new HPS.BLL.LaderTypeBLL.BLLLaderType_TFactory();
            string LaderTypecondition = "[LaderType_T].[LaderTypeID_int]='" + TrafficEntityrpt.LaderTypeID_int + "'";
            List <HPS.BLL.LaderTypeBLL.BLLLaderType_T> LaderTypeLst = laderTypeFactory.GetAllByCondition(LaderTypecondition);

            if (LaderTypeLst != null)
            {
                CarTypetxt.Text = "نوع وسیله : " + TrafficEntityrpt.System_nvc + "-  " + LaderTypeLst[0].LaderType_nvc;
            }
            HPS.BLL.PlateCityBLL.BLLPlateCity_TFactory PlatecityFactory = new HPS.BLL.PlateCityBLL.BLLPlateCity_TFactory();
            HPS.BLL.PlateCityBLL.BLLPlateCity_TKeys    Platecitykey     = new HPS.BLL.PlateCityBLL.BLLPlateCity_TKeys();
            Platecitykey.PlateCityID_int = TrafficEntityrpt.PlateCityID_int;
            HPS.BLL.PlateCityBLL.BLLPlateCity_T PlateCityEntity = new HPS.BLL.PlateCityBLL.BLLPlateCity_T();
            PlateCityEntity = PlatecityFactory.GetBy(Platecitykey);
            if (PlateCityEntity != null)
            {
                NumberPlatetxt.Text = "شماره پلاک : " + Hepsa.Core.Common.PersentationController.CorrectNumberPlate(TrafficEntityrpt.NumberPlate_nvc) + " - " + PlateCityEntity.PlateCity_nvc + " " + TrafficEntityrpt.SerialPlate_nvc;
            }
            else
            {
                NumberPlatetxt.Text = "شماره پلاک : " + Hepsa.Core.Common.PersentationController.CorrectNumberPlate(TrafficEntityrpt.NumberPlate_nvc) + " - " + TrafficEntityrpt.SerialPlate_nvc;
            }
            if (TrafficEntityrpt.WithLade_bit == true)
            {
                WithLadetxt.Text = "وضعیت : " + "با بار" + "(" + TrafficEntityrpt.Comment_nvc + ") ";
            }
            else
            {
                WithLadetxt.Text = "وضعیت : " + "بدون بار";
            }
            HPS.BLL.BillMessageBLL.BLLBillMessage_TFactory BillFactory = new HPS.BLL.BillMessageBLL.BLLBillMessage_TFactory();
            if (TrafficEntityrpt.BillMessageID_int == 0 || TrafficEntityrpt.BillMessageID_int == null)
            {
            }
            else
            {
                string Billcondition = "[BillMessage_T].[BillMessageID_int]=" + TrafficEntityrpt.BillMessageID_int;
                List <HPS.BLL.BillMessageBLL.BLLBillMessage_T> BillLst = BillFactory.GetAllByCondition(Billcondition);
                if (BillLst != null)
                {
                    Messagetxt.Text = BillLst[0].Message_nvc;
                }
            }
            HamrahanSystem.TextBox.NumericTextBox txt = new HamrahanSystem.TextBox.NumericTextBox();
            txt.DigitsInGroup = 3;
            if (TrafficEntityrpt.Price_dec != null)
            {
                txt.Text      = TrafficEntityrpt.Price_dec.ToString();
                Pricetxt.Text = " مبلغ دریافتی هنگام ورود " + txt.Text + "  ريال می باشد";
            }
            //AllowableHourtxt.Text = TrafficEntityrpt.AllowableHour_int.ToString();
            //txt.Text = TrafficEntityrpt.Fee_dec.ToString();
            //Feetxt.Text = txt.Text;
            //ExtraHourtxt.Text = TrafficEntityrpt.ExtraHour_int.ToString();

            // txt.Text = TrafficEntityrpt.ExtraHourFee_dec.ToString();
            //ExtraHourFeetxt.Text = txt.Text;
            UserNametxt.Text          = TrafficEntityrpt.UserName_nvc;
            TrafficNumberbarcode.Text = TrafficEntityrpt.TrafficNumber_bint.ToString();
            if (TrafficEntityrpt.TurnAccepted_bit == false && TrafficEntityrpt.TurnHour_int != null)
            {
                TurnNumberAllerttxt.Text = " شماره نوبت شما رزرو می باشد لطفاً تا " + TrafficEntityrpt.TurnHour_int.ToString() + " ساعت نسبت به تأیید آن اقدام نمایید";
            }
        }
Exemple #13
0
        public ForeignCarsReport(HPS.BLL.TrafficBLL.BLLTraffic_T TrafficEntity)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();
            this.TrafficEntityrpt = TrafficEntity;

            DateTextBox.Text      = TrafficEntityrpt.Date_nvc;
            TimeTextBox.Text      = TrafficEntityrpt.Time_nvc;
            TrafficNumbertxt.Text = TrafficEntityrpt.TrafficNumber_bint.ToString();
            DriverNametxt.Text    = " نام راننده : " + TrafficEntityrpt.FirstName_nvc + " " + TrafficEntityrpt.LastName_nvc;
            HPS.BLL.LaderTypeBLL.BLLLaderType_TFactory laderTypeFactory = new HPS.BLL.LaderTypeBLL.BLLLaderType_TFactory();
            string LaderTypecondition = "[LaderType_T].[LaderTypeID_int]='" + TrafficEntityrpt.LaderTypeID_int + "'";
            List <HPS.BLL.LaderTypeBLL.BLLLaderType_T> LaderTypeLst = laderTypeFactory.GetAllByCondition(LaderTypecondition);

            if (LaderTypeLst != null)
            {
                CarTypetxt.Text = "نوع وسيله : " + TrafficEntityrpt.System_nvc + "-  " + LaderTypeLst[0].LaderType_nvc;
            }
            if (!string.IsNullOrEmpty(TrafficEntityrpt.SerialPlate_nvc))
            {
                NumberPlatetxt.Text = "شماره پلاک : " + Hepsa.Core.Common.PersentationController.CorrectNumberPlate(TrafficEntityrpt.NumberPlate_nvc) + " - " + TrafficEntityrpt.SerialPlate_nvc;
            }
            else
            {
                NumberPlatetxt.Text = "شماره پلاک : " + Hepsa.Core.Common.PersentationController.CorrectNumberPlate(TrafficEntityrpt.NumberPlate_nvc);
            }

            if (TrafficEntityrpt.WithLade_bit == true)
            {
                WithLadetxt.Text = "وضعیت : " + "با بار" + "(" + TrafficEntityrpt.Comment_nvc + ") ";
            }
            else
            {
                WithLadetxt.Text = "وضعیت : " + "بدون بار";
            }
            HamrahanSystem.TextBox.NumericTextBox txt = new HamrahanSystem.TextBox.NumericTextBox();
            txt.DigitsInGroup = 3;
            if (TrafficEntityrpt.Price_dec != null)
            {
                txt.Text      = TrafficEntityrpt.Price_dec.ToString();
                Pricetxt.Text = " مبلغ دریافتی هنگام ورود " + txt.Text + "  ريال می باشد";
            }
            AllowableHourtxt.Text = TrafficEntityrpt.AllowableHour_int.ToString();
            ExtraHourtxt.Text     = TrafficEntityrpt.ExtraHour_int.ToString();
            txt.Text                  = TrafficEntityrpt.Fee_dec.ToString();
            Feetxt.Text               = txt.Text;
            txt.Text                  = TrafficEntityrpt.ExtraHourFee_dec.ToString();
            ExtraHourFeetxt.Text      = txt.Text;
            UserNametxt.Text          = TrafficEntityrpt.UserName_nvc;
            TrafficNumberbarcode.Text = TrafficEntityrpt.TrafficNumber_bint.ToString();

            if (TrafficEntityrpt.Printed_bit == true)
            {
                this.txtPrintedAgain.Visible = true;
            }
            else
            {
                this.txtPrintedAgain.Visible = false;
                HPS.BLL.TrafficBLL.BLLTraffic_TFactory TrafficFactory = new HPS.BLL.TrafficBLL.BLLTraffic_TFactory();
                try
                {
                    HPS.BLL.TrafficBLL.BLLTraffic_TKeys TrafficKey = new HPS.BLL.TrafficBLL.BLLTraffic_TKeys();
                    TrafficKey.TrafficID_bint    = TrafficEntityrpt.TrafficID_bint;
                    TrafficEntityrpt.Printed_bit = true;
                    TrafficFactory.BeginProc();
                    TrafficFactory.Update(TrafficEntityrpt, TrafficKey);
                    TrafficFactory.CommitProc();
                }
                catch (Exception ex)
                {
                    TrafficFactory.RollBackProc();
                    throw ex;
                }
            }
        }
Exemple #14
0
        public AcceptedTurnReport(HPS.BLL.TrafficBLL.BLLTraffic_T TrafficEntityrpt)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            HPS.BLL.TrafficBLL.BLLTraffic_TFactory TrafficFactory = new HPS.BLL.TrafficBLL.BLLTraffic_TFactory();
            HPS.BLL.TrafficBLL.BLLTraffic_TKeys    TrafficKey     = new HPS.BLL.TrafficBLL.BLLTraffic_TKeys();
            //HPS.BLL.TrafficBLL.BLLTraffic_T TrafficEntityrpt = new HPS.BLL.TrafficBLL.BLLTraffic_T();
            //TrafficKey.TrafficID_bint = TrafficID_bint;
            //TrafficEntityrpt = TrafficFactory.GetBy(TrafficKey);

            AcceptedDateTextBox.Text = TrafficEntityrpt.TurnDate_nvc;

            AcceptedTimeTextBox.Text = TrafficEntityrpt.TurnTime_nvc;

            InDateTextBox.Text = TrafficEntityrpt.Date_nvc;
            InTimeTextBox.Text = TrafficEntityrpt.Time_nvc;

            InDatetext2Box.Text = TrafficEntityrpt.Date_nvc;
            InTimetext2Box.Text = TrafficEntityrpt.Time_nvc;

            DateTextBox.Text = TrafficFactory.ServerJalaliDate;
            TimeTextBox.Text = TrafficFactory.ServerTime;

            if (TrafficEntityrpt.AcceptedTurnNumber_bint.HasValue)
            {
                TurnNumber2txt.Text = "شماره نوبت : " + TrafficEntityrpt.AcceptedTurnNumber_bint.ToString();
                TurnNumbertxt.Text  = "شماره نوبت : " + TrafficEntityrpt.AcceptedTurnNumber_bint.ToString();
            }
            else
            {
                TurnNumber2txt.Text = "شماره نوبت رزرو : " + TrafficEntityrpt.TurnNumber_bint.ToString();
                TurnNumbertxt.Text  = "شماره نوبت رزرو : " + TrafficEntityrpt.TurnNumber_bint.ToString();
            }


            TrafficNumbertxt.Text  = "شماره قبض : " + TrafficEntityrpt.TrafficNumber_bint.ToString();
            TrafficNumber2txt.Text = "شماره قبض : " + TrafficEntityrpt.TrafficNumber_bint.ToString();

            DriverNametxt.Text  = " نام راننده : " + TrafficEntityrpt.FirstName_nvc + " " + TrafficEntityrpt.LastName_nvc;
            DriverName2txt.Text = " نام راننده : " + TrafficEntityrpt.FirstName_nvc + " " + TrafficEntityrpt.LastName_nvc;

            HPS.BLL.LaderTypeBLL.BLLLaderType_TFactory laderTypeFactory = new HPS.BLL.LaderTypeBLL.BLLLaderType_TFactory();
            string LaderTypecondition = "[LaderType_T].[LaderTypeID_int]='" + TrafficEntityrpt.LaderTypeID_int + "'";
            List <HPS.BLL.LaderTypeBLL.BLLLaderType_T> LaderTypeLst = laderTypeFactory.GetAllByCondition(LaderTypecondition);

            if (LaderTypeLst != null)
            {
                CarTypetxt.Text  = "نوع وسیله : " + TrafficEntityrpt.System_nvc + "-  " + LaderTypeLst[0].LaderType_nvc; //+ "- کد:" + LaderTypeLst[0].LaderTypeID_int.ToString() ;
                CarType2txt.Text = "نوع وسیله : " + TrafficEntityrpt.System_nvc + "-  " + LaderTypeLst[0].LaderType_nvc;
            }
            HPS.BLL.PlateCityBLL.BLLPlateCity_TFactory PlatecityFactory = new HPS.BLL.PlateCityBLL.BLLPlateCity_TFactory();
            HPS.BLL.PlateCityBLL.BLLPlateCity_TKeys    Platecitykey     = new HPS.BLL.PlateCityBLL.BLLPlateCity_TKeys();
            Platecitykey.PlateCityID_int = TrafficEntityrpt.PlateCityID_int;
            HPS.BLL.PlateCityBLL.BLLPlateCity_T PlateCityEntity = new HPS.BLL.PlateCityBLL.BLLPlateCity_T();
            PlateCityEntity = PlatecityFactory.GetBy(Platecitykey);

            if (PlateCityEntity != null)
            {
                NumberPlatetxt.Text  = "شماره پلاک : " + Hepsa.Core.Common.PersentationController.CorrectNumberPlate(TrafficEntityrpt.NumberPlate_nvc) + " - " + PlateCityEntity.PlateCity_nvc + " " + TrafficEntityrpt.SerialPlate_nvc;
                NumberPlate2txt.Text = "شماره پلاک : " + Hepsa.Core.Common.PersentationController.CorrectNumberPlate(TrafficEntityrpt.NumberPlate_nvc) + " - " + PlateCityEntity.PlateCity_nvc + " " + TrafficEntityrpt.SerialPlate_nvc;
            }
            else
            {
                NumberPlatetxt.Text  = "شماره پلاک : " + Hepsa.Core.Common.PersentationController.CorrectNumberPlate(TrafficEntityrpt.NumberPlate_nvc) + " - " + TrafficEntityrpt.SerialPlate_nvc;
                NumberPlate2txt.Text = "شماره پلاک : " + Hepsa.Core.Common.PersentationController.CorrectNumberPlate(TrafficEntityrpt.NumberPlate_nvc) + " - " + TrafficEntityrpt.SerialPlate_nvc;
            }


            DriverCardNumbertxt.Text = "شماره كارت راننده :" + TrafficEntityrpt.DriverCardNumber_nvc;

            CarCardNumbertxt.Text = "شماره كارت كاميون :" + TrafficEntityrpt.CarCardNumber_nvc;

            HPS.BLL.BillMessageBLL.BLLBillMessage_TFactory BillFactory = new HPS.BLL.BillMessageBLL.BLLBillMessage_TFactory();
            if (TrafficEntityrpt.BillMessageID_int == 0 || TrafficEntityrpt.BillMessageID_int == null)
            {
            }
            else
            {
                string Billcondition = "[BillMessage_T].[BillMessageID_int]=" + TrafficEntityrpt.BillMessageID_int;
                List <HPS.BLL.BillMessageBLL.BLLBillMessage_T> BillLst = BillFactory.GetAllByCondition(Billcondition);
                if (BillLst != null)
                {
                    Messagetxt.Text = BillLst[0].Message_nvc;
                }
            }
            HamrahanSystem.TextBox.NumericTextBox txt = new HamrahanSystem.TextBox.NumericTextBox();
            txt.DigitsInGroup = 3;
            if (TrafficEntityrpt.Price_dec != null)
            {
                txt.Text      = TrafficEntityrpt.Price_dec.ToString();
                Pricetxt.Text = " مبلغ دریافت شده هنگام ورود " + txt.Text + "  ريال می باشد";
            }
            UserNametxt.Text = HPS.Common.CurrentUser.user.UserName_nvc;
            if (!string.IsNullOrEmpty(TrafficEntityrpt.AcceptedTurnComment_nvc))
            {
                if (TrafficEntityrpt.Area_bit)
                {
                    Commenttxt.Text = "توضيحات : " + TrafficEntityrpt.AcceptedTurnComment_nvc + " حومه";
                }
                else
                {
                    Commenttxt.Text = "توضيحات : " + TrafficEntityrpt.AcceptedTurnComment_nvc;
                }
            }
            else
            {
                if (TrafficEntityrpt.Area_bit)
                {
                    Commenttxt.Text = "حومه";
                }
            }
            TrafficNumberbarcode.Text     = TrafficEntityrpt.TrafficNumber_bint.ToString();
            TrafficNumber_intbarcode.Text = TrafficEntityrpt.TrafficNumber_bint.ToString();
            //if (!TrafficEntityrpt.DriverOffline_bit)
            //{
            //    OfflineReadtxt.Text = "آنلاین";
            //}
            //else
            //{
            //    OfflineReadtxt.Text = "آفلاین";
            //}
            //////////////
            HPS.BLL.SettingsBLL.BLLSetting_TFactory settingsFactory = new HPS.BLL.SettingsBLL.BLLSetting_TFactory();
            HPS.BLL.SettingsBLL.BLLSetting_T        SettingEntity   = new HPS.BLL.SettingsBLL.BLLSetting_T();
            HPS.BLL.SettingsBLL.BLLSetting_TKeys    SettingKey      = new HPS.BLL.SettingsBLL.BLLSetting_TKeys();
            SettingKey.SettingID_int = 1002;
            SettingEntity            = settingsFactory.GetBy(SettingKey);
            AllowableHourtxt.Text    = SettingEntity.Value_nvc; //TrafficEntityrpt.AllowableHour_int.ToString();
            Feetxt.Text       = txt.Text;
            ExtraHourtxt.Text = TrafficEntityrpt.ExtraHour_int.ToString();

            //if (TrafficEntityrpt.WithFlat_bit==true)
            //{
            //txt.Text = TrafficEntityrpt.ExtraHourFee_dec.ToString();
            //}
            ExtraHourFeetxt.Text = TrafficEntityrpt.ExtraHourFee_dec.ToString();
            //////////////
            if (TrafficEntityrpt.TurnPrinted_bit == true)
            {
                this.txtPrintedAgain.Visible = true;
                UserNametxt.Text             = Hepsa.Core.Common.CurrentUser.User.UserName_nvc;
            }
            else
            {
                this.txtPrintedAgain.Visible = false;
                try
                {
                    TrafficKey.TrafficID_bint        = TrafficEntityrpt.TrafficID_bint;
                    TrafficEntityrpt.TurnPrinted_bit = true;
                    TrafficFactory.BeginProc();
                    TrafficFactory.Update(TrafficEntityrpt, TrafficKey);
                    TrafficFactory.CommitProc();
                }
                catch (Exception ex)
                {
                    TrafficFactory.RollBackProc();
                    throw ex;
                }
            }
        }
Exemple #15
0
        public TrafficReport(HPS.BLL.TrafficBLL.BLLTraffic_T TrafficEntity)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();


            this.TrafficEntityrpt = TrafficEntity;

            InDateTextBox.Text = TrafficEntityrpt.Date_nvc;
            InTimeTextBox.Text = TrafficEntityrpt.Time_nvc;

            //InDatetext2Box.Text = TrafficEntityrpt.Date_nvc;
            //InTimetext2Box.Text = TrafficEntityrpt.Time_nvc;

            TrafficNumbertxt.Text = "شماره قبض :   " + TrafficEntityrpt.TrafficNumber_bint.ToString();
            //TrafficNumber2txt.Text = TrafficEntityrpt.TrafficNumber_bint.ToString();
            //DriverName2txt.Text = " نام راننده : " + TrafficEntityrpt.FirstName_nvc + " " + TrafficEntityrpt.LastName_nvc;

            if (TrafficEntityrpt.ServiceID_int == 2)
            {
                if (TrafficEntityrpt.TurnAccepted_bit == true)
                {
                    //نوبت تأیید شده داره
                    TurnNumbertxt.Text = "شماره نوبت :   " + Convert.ToString(TrafficEntityrpt.AcceptedTurnNumber_bint);
                    //AcceptedDate2TextBox.Text = TrafficEntityrpt.TurnDate_nvc;
                    //AcceptedTime2TextBox.Text = TrafficEntityrpt.TurnTime_nvc;
                    //TurnNumber2txt.Text = TrafficEntityrpt.AcceptedTurnNumber_bint.ToString();
                }
                else
                {
                    //نوبت تأیید شده ندارد
                    TurnNumbertxt.Text = "شماره نوبت رزرو :   " + Convert.ToString(TrafficEntityrpt.TurnNumber_bint);
                }
            }
            else
            {
                // (عدم نمایش نوبت (مراجعه به غیر از نوبت

                TurnNumbertxt.Visible       = false;
                TurnNumberAllerttxt.Visible = false;
            }

            //DriverCardNumber2txt.Text = "شماره كارت راننده :" + TrafficEntityrpt.DriverCardNumber_nvc;
            //CarCardNumber2txt.Text = "شماره كارت كاميون :" + TrafficEntityrpt.CarCardNumber_nvc;


            HPS.BLL.ServicesBLL.BLLServices_TFactory servicesFactory = new HPS.BLL.ServicesBLL.BLLServices_TFactory();
            HPS.BLL.ServicesBLL.BLLServices_TKeys    ServicesKey     = new HPS.BLL.ServicesBLL.BLLServices_TKeys();
            ServicesKey.ServicesID_int = TrafficEntity.ServiceID_int;
            DateTextBox.Text           = servicesFactory.ServerJalaliDate;
            TimeTextBox.Text           = servicesFactory.ServerTime;
            HPS.BLL.ServicesBLL.BLLServices_T ServicesEntity = new HPS.BLL.ServicesBLL.BLLServices_T();
            ServicesEntity     = servicesFactory.GetBy(ServicesKey);
            Servicestxt.Text   = " قبض مراجعه به : " + ServicesEntity.ServicesType_nvc;
            DriverNametxt.Text = " نام راننده : " + TrafficEntityrpt.FirstName_nvc + " " + TrafficEntityrpt.LastName_nvc;
            HPS.BLL.LaderTypeBLL.BLLLaderType_TFactory laderTypeFactory = new HPS.BLL.LaderTypeBLL.BLLLaderType_TFactory();
            string LaderTypecondition = "[LaderType_T].[LaderTypeID_int]='" + TrafficEntityrpt.LaderTypeID_int + "'";
            List <HPS.BLL.LaderTypeBLL.BLLLaderType_T> LaderTypeLst = laderTypeFactory.GetAllByCondition(LaderTypecondition);

            if (LaderTypeLst != null)
            {
                CarTypetxt.Text = "نوع وسیله : " + TrafficEntityrpt.System_nvc + "-  " + LaderTypeLst[0].LaderType_nvc;
                //CarType2txt.Text = "نوع وسیله : " + TrafficEntityrpt.System_nvc + "-  " + LaderTypeLst[0].LaderType_nvc; //+ "- کد:" + LaderTypeLst[0].LaderTypeID_int.ToString() ;
            }
            HPS.BLL.PlateCityBLL.BLLPlateCity_TFactory PlatecityFactory = new HPS.BLL.PlateCityBLL.BLLPlateCity_TFactory();
            HPS.BLL.PlateCityBLL.BLLPlateCity_TKeys    Platecitykey     = new HPS.BLL.PlateCityBLL.BLLPlateCity_TKeys();
            Platecitykey.PlateCityID_int = TrafficEntityrpt.PlateCityID_int;
            HPS.BLL.PlateCityBLL.BLLPlateCity_T PlateCityEntity = new HPS.BLL.PlateCityBLL.BLLPlateCity_T();
            PlateCityEntity = PlatecityFactory.GetBy(Platecitykey);
            if (PlateCityEntity != null)
            {
                NumberPlatetxt.Text = "شماره پلاک : " + Hepsa.Core.Common.PersentationController.CorrectNumberPlate(TrafficEntityrpt.NumberPlate_nvc) + " - " + PlateCityEntity.PlateCity_nvc + " " + TrafficEntityrpt.SerialPlate_nvc;
                //NumberPlate2txt.Text = "شماره پلاک : " + Hepsa.Core.Common.PersentationController.CorrectNumberPlate(TrafficEntityrpt.NumberPlate_nvc) + " - " + PlateCityEntity.PlateCity_nvc + " " + TrafficEntityrpt.SerialPlate_nvc;
            }
            else
            {
                NumberPlatetxt.Text = "شماره پلاک : " + Hepsa.Core.Common.PersentationController.CorrectNumberPlate(TrafficEntityrpt.NumberPlate_nvc) + " - " + TrafficEntityrpt.SerialPlate_nvc;
                //NumberPlate2txt.Text = "شماره پلاک : " + Hepsa.Core.Common.PersentationController.CorrectNumberPlate(TrafficEntityrpt.NumberPlate_nvc) + " - " + TrafficEntityrpt.SerialPlate_nvc;
            }
            if (TrafficEntityrpt.WithLade_bit == true)
            {
                WithLadetxt.Text = "وضعیت : " + "با بار" + "(" + TrafficEntityrpt.Comment_nvc + ") ";
            }
            else
            {
                WithLadetxt.Text = "وضعیت : " + "بدون بار";
            }
            HPS.BLL.BillMessageBLL.BLLBillMessage_TFactory BillFactory = new HPS.BLL.BillMessageBLL.BLLBillMessage_TFactory();
            if (TrafficEntityrpt.BillMessageID_int == 0 || TrafficEntityrpt.BillMessageID_int == null)
            {
            }
            else
            {
                string Billcondition = "[BillMessage_T].[BillMessageID_int]=" + TrafficEntityrpt.BillMessageID_int;
                List <HPS.BLL.BillMessageBLL.BLLBillMessage_T> BillLst = BillFactory.GetAllByCondition(Billcondition);
                if (BillLst != null)
                {
                    Messagetxt.Text = BillLst[0].Message_nvc;
                }
            }
            HamrahanSystem.TextBox.NumericTextBox txt = new HamrahanSystem.TextBox.NumericTextBox();
            txt.DigitsInGroup = 3;
            if (TrafficEntityrpt.Price_dec != null)
            {
                txt.Text      = TrafficEntityrpt.Price_dec.ToString();
                Pricetxt.Text = " مبلغ دریافتی هنگام ورود " + txt.Text + "  ريا ل می باشد";
            }

            HPS.BLL.SettingsBLL.BLLSetting_TFactory settingsFactory = new HPS.BLL.SettingsBLL.BLLSetting_TFactory();
            HPS.BLL.SettingsBLL.BLLSetting_T        SettingEntity   = new HPS.BLL.SettingsBLL.BLLSetting_T();
            HPS.BLL.SettingsBLL.BLLSetting_TKeys    SettingKey      = new HPS.BLL.SettingsBLL.BLLSetting_TKeys();
            SettingKey.SettingID_int = 1002;
            SettingEntity            = settingsFactory.GetBy(SettingKey);
            if (TrafficEntityrpt.ServiceID_int == 2)
            {
                AllowableHourtxt.Text = SettingEntity.Value_nvc; //TrafficEntityrpt.AllowableHour_int.ToString();
            }
            else
            {
                AllowableHourtxt.Text = TrafficEntityrpt.AllowableHour_int.ToString();
            }
            txt.Text          = TrafficEntityrpt.Fee_dec.ToString();
            Feetxt.Text       = txt.Text;
            ExtraHourtxt.Text = TrafficEntityrpt.ExtraHour_int.ToString();
            //if (TrafficEntityrpt.WithFlat_bit==true)
            //{
            //txt.Text = TrafficEntityrpt.ExtraHourFee_dec.ToString();
            //}
            txt.Text                  = TrafficEntityrpt.ExtraHourFee_dec.ToString();
            ExtraHourFeetxt.Text      = txt.Text;
            UserNametxt.Text          = TrafficEntityrpt.UserName_nvc;
            TrafficNumberbarcode.Text = TrafficEntityrpt.TrafficNumber_bint.ToString();
            if (TrafficEntityrpt.TurnHour_int != null)
            {
                TurnNumberAllerttxt.Text = " شماره نوبت شما رزرو می باشد لطفاً تا " + TrafficEntityrpt.TurnHour_int.ToString() + " ساعت نسبت به تأیید آن اقدام نمایید";
            }
            if (TrafficEntityrpt.Printed_bit == true)
            {
                this.txtPrintedAgain.Visible = true;
            }
            else
            {
                this.txtPrintedAgain.Visible = false;
                HPS.BLL.TrafficBLL.BLLTraffic_TFactory TrafficFactory = new HPS.BLL.TrafficBLL.BLLTraffic_TFactory();
                try
                {
                    HPS.BLL.TrafficBLL.BLLTraffic_TKeys TrafficKey = new HPS.BLL.TrafficBLL.BLLTraffic_TKeys();
                    TrafficKey.TrafficID_bint    = TrafficEntityrpt.TrafficID_bint;
                    TrafficEntityrpt.Printed_bit = true;
                    TrafficFactory.BeginProc();
                    TrafficFactory.Update(TrafficEntityrpt, TrafficKey);
                    TrafficFactory.CommitProc();
                }
                catch (Exception ex)
                {
                    TrafficFactory.RollBackProc();
                    throw ex;
                }
            }
        }
Exemple #16
0
        public OtherCarReport(HPS.BLL.TrafficBLL.BLLTraffic_T TrafficEntityrpt)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();


            DateTextBox.Text      = TrafficEntityrpt.Date_nvc;
            TimeTextBox.Text      = TrafficEntityrpt.Time_nvc;
            TrafficNumbertxt.Text = TrafficEntityrpt.TrafficNumber_bint.ToString();
            Servicestxt.Text      = " مراجعه به : " + TrafficEntityrpt.Services_nvc;
            CarTypetxt.Text       = "نوع وسیله : " + TrafficEntityrpt.System_nvc;
            HPS.BLL.PlateCityBLL.BLLPlateCity_TFactory PlateCityFactory = new HPS.BLL.PlateCityBLL.BLLPlateCity_TFactory();
            HPS.BLL.PlateCityBLL.BLLPlateCity_T        PlatecityEntity  = new HPS.BLL.PlateCityBLL.BLLPlateCity_T();
            HPS.BLL.PlateCityBLL.BLLPlateCity_TKeys    PlateCityKey     = new HPS.BLL.PlateCityBLL.BLLPlateCity_TKeys();
            PlateCityKey.PlateCityID_int = TrafficEntityrpt.PlateCityID_int;
            PlatecityEntity     = PlateCityFactory.GetBy(PlateCityKey);
            NumberPlatetxt.Text = "شماره پلاک : " + Hepsa.Core.Common.PersentationController.CorrectNumberPlate(TrafficEntityrpt.NumberPlate_nvc) + " - " + PlatecityEntity.PlateCity_nvc + " " + TrafficEntityrpt.SerialPlate_nvc;
            HPS.BLL.BillMessageBLL.BLLBillMessage_TFactory BillFactory = new HPS.BLL.BillMessageBLL.BLLBillMessage_TFactory();
            if (TrafficEntityrpt.BillMessageID_int == 0 || TrafficEntityrpt.BillMessageID_int == null)
            {
            }
            else
            {
                string Billcondition = "[BillMessage_T].[BillMessageID_int]=" + TrafficEntityrpt.BillMessageID_int;
                List <HPS.BLL.BillMessageBLL.BLLBillMessage_T> BillLst = BillFactory.GetAllByCondition(Billcondition);
                if (BillLst != null)
                {
                    Messagetxt.Text = BillLst[0].Message_nvc;
                }
            }
            HamrahanSystem.TextBox.NumericTextBox txt = new HamrahanSystem.TextBox.NumericTextBox();
            txt.DigitsInGroup = 3;
            if (TrafficEntityrpt.Price_dec != null)
            {
                txt.Text      = TrafficEntityrpt.Price_dec.ToString();
                Pricetxt.Text = " مبلغ دریافتی هنگام ورود " + txt.Text + "  ريال می باشد";
            }
            AllowableHourtxt.Text = TrafficEntityrpt.AllowableHour_int.ToString();
            ExtraHourtxt.Text     = TrafficEntityrpt.ExtraHour_int.ToString();
            txt.Text                  = TrafficEntityrpt.Fee_dec.ToString();
            Feetxt.Text               = txt.Text;
            txt.Text                  = TrafficEntityrpt.ExtraHourFee_dec.ToString();
            ExtraHourFeetxt.Text      = txt.Text;
            UserNametxt.Text          = TrafficEntityrpt.UserName_nvc;
            TrafficNumberbarcode.Text = TrafficEntityrpt.TrafficNumber_bint.ToString();

            if (TrafficEntityrpt.Printed_bit == true)
            {
                this.txtPrintedAgain.Visible = true;
            }
            else
            {
                this.txtPrintedAgain.Visible = false;
                HPS.BLL.TrafficBLL.BLLTraffic_TFactory TrafficFactory = new HPS.BLL.TrafficBLL.BLLTraffic_TFactory();
                try
                {
                    HPS.BLL.TrafficBLL.BLLTraffic_TKeys TrafficKey = new HPS.BLL.TrafficBLL.BLLTraffic_TKeys();
                    TrafficKey.TrafficID_bint    = TrafficEntityrpt.TrafficID_bint;
                    TrafficEntityrpt.Printed_bit = true;
                    TrafficFactory.BeginProc();
                    TrafficFactory.Update(TrafficEntityrpt, TrafficKey);
                    TrafficFactory.CommitProc();
                }
                catch (Exception ex)
                {
                    TrafficFactory.RollBackProc();
                    throw ex;
                }
            }
        }
Exemple #17
0
        public override bool Validate(params object[] value)
        {
            try
            {
                this.Description = string.Empty;
                if (value.Length != Field.Length)
                {
                    this.Description = Hepsa.Core.My.Resources.ValidationMessage.IncorrectDataType;
                    return(false);
                }

                Int32? ServiceID_int      = (Int32?)value[0];
                string NumberPlate_nvc    = Convert.ToString(value[1]);
                string SerialPlate_nvc    = Convert.ToString(value[2]);
                Int64? TrafficID_bint     = (Int64?)value[3];
                Int64? TrafficNumber_bint = (Int64?)value[5];
                string CarCardNumber_nvc  = string.Empty;
                HPS.BLL.TrafficBLL.BLLTraffic_TFactory TrafficFactory = new HPS.BLL.TrafficBLL.BLLTraffic_TFactory();
                HPS.BLL.TrafficBLL.BLLTraffic_T        TrafficEntity  = new HPS.BLL.TrafficBLL.BLLTraffic_T();
                if (string.IsNullOrEmpty(NumberPlate_nvc) && string.IsNullOrEmpty(SerialPlate_nvc))
                {
                    HPS.BLL.TrafficBLL.BLLTraffic_TKeys TrafficKey = new HPS.BLL.TrafficBLL.BLLTraffic_TKeys();
                    TrafficKey.TrafficID_bint = TrafficID_bint.Value;

                    TrafficEntity = TrafficFactory.GetBy(TrafficKey);
                    if (TrafficEntity != null)
                    {
                        ServiceID_int   = TrafficEntity.ServiceID_int;
                        NumberPlate_nvc = TrafficEntity.NumberPlate_nvc;
                        SerialPlate_nvc = TrafficEntity.SerialPlate_nvc;
                    }
                }

                /////////////////////////////////////
                #region AcceptTurn Conditions

                DataTable TrafficStatusDataTable = new DataTable();
                TrafficFactory.GetLastStatus(NumberPlate_nvc, SerialPlate_nvc, CarCardNumber_nvc, TrafficStatusDataTable);



                if (ServiceID_int.HasValue && ServiceID_int.Value == 2)
                {
                    if (TrafficStatusDataTable != null && TrafficStatusDataTable.Rows.Count > 0)
                    {
                        Int64 LastTrafficID_bint = 0;
                        if (Hepsa.Core.Common.PersentationController.GetEntityValue(TrafficStatusDataTable.Rows[0]["TrafficID_bint"], TypeCode.Int64) != null)
                        {
                            LastTrafficID_bint = (Int64)Hepsa.Core.Common.PersentationController.GetEntityValue(TrafficStatusDataTable.Rows[0]["TrafficID_bint"], TypeCode.Int64);
                        }
                        bool? HasTurn_bit             = (bool?)Hepsa.Core.Common.PersentationController.GetEntityValue(TrafficStatusDataTable.Rows[0]["HasTurn_bit"], TypeCode.Boolean);
                        bool? TurnReturn_bit          = (bool?)Hepsa.Core.Common.PersentationController.GetEntityValue(TrafficStatusDataTable.Rows[0]["TurnReturn_bit"], TypeCode.Boolean);
                        bool? TurnCanceled_bit        = (bool?)Hepsa.Core.Common.PersentationController.GetEntityValue(TrafficStatusDataTable.Rows[0]["TurnCanceled_bit"], TypeCode.Boolean);
                        bool? HasLadBillCredit_bit    = (bool?)Hepsa.Core.Common.PersentationController.GetEntityValue(TrafficStatusDataTable.Rows[0]["HasLadBillCredit_bit"], TypeCode.Boolean);
                        bool? LadBillCreditCancel_bit = (bool?)Hepsa.Core.Common.PersentationController.GetEntityValue(TrafficStatusDataTable.Rows[0]["LadBillCreditCancel_bit"], TypeCode.Boolean);
                        bool? LadBillCreditTurn_bit   = (bool?)Hepsa.Core.Common.PersentationController.GetEntityValue(TrafficStatusDataTable.Rows[0]["LadBillCreditTurn_bit"], TypeCode.Boolean);
                        bool? TurnAccepted_bit        = (bool?)Hepsa.Core.Common.PersentationController.GetEntityValue(TrafficStatusDataTable.Rows[0]["TurnAccepted_bit"], TypeCode.Boolean);
                        Int64?AcceptedTurnNumber_bint = (Int64?)Hepsa.Core.Common.PersentationController.GetEntityValue(TrafficStatusDataTable.Rows[0]["AcceptedTurnNumber_bint"], TypeCode.Int64);
                        if (HasTurn_bit.HasValue == false || HasTurn_bit == false)
                        {
                            /////////TurnAcception(TrafficEntityUpdate, TrafficDate, _TurnHour, TrafficKey);
                        }
                        else
                        {
                            if (TurnAccepted_bit.HasValue && TurnAccepted_bit == true)
                            {
                                if (TurnCanceled_bit.HasValue && TurnCanceled_bit == true)
                                {
                                    DataTable TurnStatusDataTable = new DataTable();
                                    TrafficFactory.GetTurnStatus((string)Hepsa.Core.Common.PersentationController.GetEntityValue(NumberPlate_nvc, TypeCode.String), (string)Hepsa.Core.Common.PersentationController.GetEntityValue(SerialPlate_nvc, TypeCode.String), TurnStatusDataTable);
                                    if (TurnStatusDataTable != null && TurnStatusDataTable.Rows.Count > 0)
                                    {
                                        Description = (string.Format("ناوگان دارای شماره نوبت تأییدی < {0} >می باشد", TurnStatusDataTable.Rows[TurnStatusDataTable.Rows.Count - 1]["AcceptedTurnNumber_bint"]));
                                        return(false);
                                    }
                                }

                                else
                                {
                                    if (HasLadBillCredit_bit.HasValue && HasLadBillCredit_bit == true)
                                    {
                                        if (LadBillCreditCancel_bit.HasValue && LadBillCreditCancel_bit == true)
                                        {
                                            if (LadBillCreditTurn_bit.HasValue && LadBillCreditTurn_bit == true)
                                            {
                                                //محاسبه مدت مجاز سفر
                                                DateTime  NowDate          = DateTime.Parse((new Hepsa.Core.Common.MyDateTime(TrafficFactory.ServerJalaliDate)).MyDate.ToString("yyyy/MM/dd") + " " + TrafficFactory.ServerTime);
                                                DataTable TrafficDataTable = new DataTable();
                                                string    Condition        = string.Format("Traffic_T.TrafficID_bint='{0}'", TrafficID_bint);
                                                TrafficFactory.GetAllByConditionWithLadBill(Condition, ref TrafficDataTable);
                                                if (TrafficDataTable != null && TrafficDataTable.Rows.Count > 0)
                                                {
                                                    // حذف چک کردن این مورد در زمانی که مجوز گرفته و ابطال با حفظ نوبت شده شده است در تاریخ 93/11/25 انجام شد که بتوان اطلاعات تردد را ویرایش نمود

                                                    //Int32 _CityTravelHour = 0;
                                                    //if (!string.IsNullOrEmpty(TrafficDataTable.Rows[0]["TravelTime_int"].ToString()))
                                                    //{
                                                    //    _CityTravelHour = Convert.ToInt32(TrafficDataTable.Rows[0]["TravelTime_int"].ToString());
                                                    //}
                                                    /////////////////
                                                    //string _OutDate = TrafficDataTable.Rows[0]["Date_nvc"].ToString();
                                                    //string _OutTime = TrafficDataTable.Rows[0]["Time_nvc"].ToString();
                                                    //DateTime OutDate = DateTime.Parse((new Hepsa.Core.Common.MyDateTime(_OutDate)).MyDate.ToString("yyyy/MM/dd") + " " + _OutTime);

                                                    //if (TrafficDataTable.Rows[0]["Out_bit"].ToString() == "False")
                                                    //{
                                                    //    TimeSpan date = NowDate - OutDate;
                                                    //    double remaindedHour = _CityTravelHour - date.TotalHours;
                                                    //    if (OutDate.AddHours(_CityTravelHour).CompareTo(NowDate) > 0)//date.TotalHours > _CityTravelHour)
                                                    //    {
                                                    //        Description = (string.Format("مدت سفراین ناوگان به مجوز< {0} >تمام نشده و مدت < {1} > مانده است ", TrafficDataTable.Rows[0]["LadBillCreditID_int"], TimeSpan.FromDays(remaindedHour)));
                                                    //        return false;
                                                    //    }
                                                    //}
                                                }
                                                else
                                                {
                                                    DataTable TurnStatusDataTable = new DataTable();
                                                    TrafficFactory.GetTurnStatus((string)Hepsa.Core.Common.PersentationController.GetEntityValue(NumberPlate_nvc, TypeCode.String), (string)Hepsa.Core.Common.PersentationController.GetEntityValue(SerialPlate_nvc, TypeCode.String), TurnStatusDataTable);
                                                    if (TurnStatusDataTable != null && TurnStatusDataTable.Rows.Count > 0)
                                                    {
                                                        Description = (string.Format("ناوگان دارای شماره نوبت تأییدی < {0} >می باشد", TurnStatusDataTable.Rows[TurnStatusDataTable.Rows.Count - 1]["AcceptedTurnNumber_bint"]));
                                                        return(false);
                                                    }
                                                }
                                            }
                                        }
                                        else
                                        {
                                            //محاسبه مدت مجاز سفر
                                            DateTime  NowDate          = DateTime.Parse((new Hepsa.Core.Common.MyDateTime(TrafficFactory.ServerJalaliDate)).MyDate.ToString("yyyy/MM/dd") + " " + TrafficFactory.ServerTime);
                                            DataTable TrafficDataTable = new DataTable();
                                            string    Condition        = string.Format("Traffic_T.TrafficID_bint='{0}'", LastTrafficID_bint);
                                            TrafficFactory.GetAllByConditionWithLadBill(Condition, ref TrafficDataTable);
                                            if (TrafficDataTable != null && TrafficDataTable.Rows.Count > 0)
                                            {
                                                Int32 _CityTravelHour = 0;
                                                if (!string.IsNullOrEmpty(TrafficDataTable.Rows[0]["TravelTime_int"].ToString()))
                                                {
                                                    _CityTravelHour = Convert.ToInt32(TrafficDataTable.Rows[0]["TravelTime_int"].ToString());
                                                }
                                                ///////////////
                                                string   _OutDate = TrafficDataTable.Rows[0]["Date_nvc"].ToString();
                                                string   _OutTime = TrafficDataTable.Rows[0]["Time_nvc"].ToString();
                                                DateTime OutDate  = DateTime.Parse((new Hepsa.Core.Common.MyDateTime(_OutDate)).MyDate.ToString("yyyy/MM/dd") + " " + _OutTime);

                                                if (TrafficDataTable.Rows[0]["Out_bit"].ToString() == "False")
                                                {
                                                    TimeSpan date          = NowDate - OutDate;
                                                    double   remaindedHour = _CityTravelHour - date.TotalHours;
                                                    if (OutDate.AddHours(_CityTravelHour).CompareTo(NowDate) > 0)//date.TotalHours > _CityTravelHour)
                                                    {
                                                        Description = (string.Format("مدت سفراین ناوگان به مجوز< {0} >تمام نشده و مدت < {1} > مانده است ", TrafficDataTable.Rows[0]["LadBillCreditID_int"], TimeSpan.FromDays(remaindedHour)));
                                                        return(false);
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                DataTable TurnStatusDataTable = new DataTable();
                                                TrafficFactory.GetTurnStatus((string)Hepsa.Core.Common.PersentationController.GetEntityValue(NumberPlate_nvc, TypeCode.String), (string)Hepsa.Core.Common.PersentationController.GetEntityValue(SerialPlate_nvc, TypeCode.String), TurnStatusDataTable);
                                                if (TurnStatusDataTable != null && TurnStatusDataTable.Rows.Count > 0)
                                                {
                                                    Description = (string.Format("ناوگان دارای شماره نوبت تأییدی < {0} >می باشد", TurnStatusDataTable.Rows[TurnStatusDataTable.Rows.Count - 1]["AcceptedTurnNumber_bint"]));
                                                    return(false);
                                                }
                                            }
                                        }
                                    }
                                    else
                                    {
                                        DataTable TurnStatusDataTable = new DataTable();
                                        TrafficFactory.GetTurnStatus((string)Hepsa.Core.Common.PersentationController.GetEntityValue(NumberPlate_nvc, TypeCode.String), (string)Hepsa.Core.Common.PersentationController.GetEntityValue(SerialPlate_nvc, TypeCode.String), TurnStatusDataTable);

                                        if (TrafficID_bint != LastTrafficID_bint)
                                        {
                                            Description = (string.Format("این ناوگان دارای شماره نوبت تأیید شده {0} می باشد", TurnStatusDataTable.Rows[TurnStatusDataTable.Rows.Count - 1]["AcceptedTurnNumber_bint"]));
                                            return(false);
                                        }
                                    }
                                }
                            }
                            else if (TurnAccepted_bit.HasValue && TurnReturn_bit == true)
                            {
                                DataTable TurnStatusDataTable = new DataTable();
                                TrafficFactory.GetTurnStatus((string)Hepsa.Core.Common.PersentationController.GetEntityValue(NumberPlate_nvc, TypeCode.String), (string)Hepsa.Core.Common.PersentationController.GetEntityValue(SerialPlate_nvc, TypeCode.String), TurnStatusDataTable);
                                if (TurnStatusDataTable != null && TurnStatusDataTable.Rows.Count > 0)
                                {
                                    Description = (string.Format("ناوگان دارای شماره نوبت تأییدی < {0} >می باشد", TurnStatusDataTable.Rows[TurnStatusDataTable.Rows.Count - 1]["AcceptedTurnNumber_bint"]));
                                    return(false);
                                }
                            }
                            else
                            {
                                //محاسبه مدت مجاز سفر
                                DataTable LadBillDataTable = new DataTable();
                                TrafficFactory.GetTurnStatus(NumberPlate_nvc, SerialPlate_nvc, LadBillDataTable);
                                if (LadBillDataTable != null && LadBillDataTable.Rows.Count > 0)
                                {
                                    bool? PreviousTurnAccepted_bit        = (bool?)Hepsa.Core.Common.PersentationController.GetEntityValue(LadBillDataTable.Rows[LadBillDataTable.Rows.Count - 1]["TurnAccepted_bit"], TypeCode.Boolean);
                                    Int32?PreviousTurnCancelCommandID_bit = (Int32?)Hepsa.Core.Common.PersentationController.GetEntityValue(LadBillDataTable.Rows[LadBillDataTable.Rows.Count - 1]["TurnCancelCommantID_int"], TypeCode.Int32);
                                    bool? PreviousTurnReturn_bit          = (bool?)Hepsa.Core.Common.PersentationController.GetEntityValue(LadBillDataTable.Rows[LadBillDataTable.Rows.Count - 1]["Return_bit"], TypeCode.Boolean);
                                    if (PreviousTurnAccepted_bit.HasValue && PreviousTurnAccepted_bit == true)
                                    {
                                        if (PreviousTurnCancelCommandID_bit.HasValue)
                                        {
                                            if (PreviousTurnReturn_bit.HasValue && PreviousTurnReturn_bit == true)
                                            {
                                                //باطل شده و احیا شده
                                                Description = (string.Format("ناوگان دارای شماره نوبت تأییدی< {0} >می باشد", LadBillDataTable.Rows[LadBillDataTable.Rows.Count - 1]["AcceptedTurnnumber_bint"]));
                                                return(false);
                                            }
                                        }
                                        else
                                        {
                                            //تأیید شده و باطل نشده

                                            DateTime  NowDate          = DateTime.Parse((new Hepsa.Core.Common.MyDateTime(TrafficFactory.ServerJalaliDate)).MyDate.ToString("yyyy/MM/dd") + " " + TrafficFactory.ServerTime);
                                            DataTable TrafficDataTable = new DataTable();
                                            string    Condition        = string.Format("Traffic_T.NumberPlate_nvc='{0}' and SerialPlate_nvc='{1}'", NumberPlate_nvc, SerialPlate_nvc);
                                            TrafficFactory.GetAllByConditionWithLadBill(Condition, ref TrafficDataTable);

                                            if (TrafficDataTable != null && TrafficDataTable.Rows.Count > 0)
                                            {
                                                string    filter = "LadeAssignmentId_bint=Max(LadeAssignmentId_bint)";
                                                DataRow[] dr     = TrafficDataTable.Select(filter);
                                                if (dr != null && dr.Length > 0)
                                                {
                                                    Int32 _CityTravelHour = 0;
                                                    if (!string.IsNullOrEmpty(dr[dr.Length - 1]["TravelTime_int"].ToString()))
                                                    {
                                                        _CityTravelHour = Convert.ToInt32(dr[dr.Length - 1]["TravelTime_int"].ToString());
                                                    }

                                                    string    _OutDate = dr[dr.Length - 1]["LadBillDate"].ToString();
                                                    string    _OutTime = dr[dr.Length - 1]["LadBillTime"].ToString();
                                                    DateTime  OutDate  = DateTime.Parse((new Hepsa.Core.Common.MyDateTime(_OutDate)).MyDate.ToString("yyyy/MM/dd") + " " + _OutTime);
                                                    DataTable TrafficStatusForAcceptTurnDataTable = new DataTable();
                                                    TrafficFactory.GetLastStatusForAcceptTurn((Int64)Hepsa.Core.Common.PersentationController.GetEntityValue(dr[dr.Length - 1]["TrafficID_bint"], TypeCode.Int64), TrafficStatusForAcceptTurnDataTable);
                                                    if (TrafficStatusForAcceptTurnDataTable != null && TrafficStatusForAcceptTurnDataTable.Rows.Count > 0 && Convert.ToBoolean(TrafficStatusForAcceptTurnDataTable.Rows[0]["HasTurn_bit"]) == true)
                                                    {
                                                        bool?LadBillCreditCancel = (bool?)Hepsa.Core.Common.PersentationController.GetEntityValue(TrafficStatusForAcceptTurnDataTable.Rows[0]["LadBillCreditCancel_bit"], TypeCode.Boolean);
                                                        bool?LadBillCreditTurn   = (bool?)Hepsa.Core.Common.PersentationController.GetEntityValue(TrafficStatusForAcceptTurnDataTable.Rows[0]["LadBillCreditTurn_bit"], TypeCode.Boolean);
                                                        bool?TurnReturn          = (bool?)Hepsa.Core.Common.PersentationController.GetEntityValue(TrafficStatusForAcceptTurnDataTable.Rows[0]["TurnReturn_bit"], TypeCode.Boolean);
                                                        bool?TurnCanceled        = (bool?)Hepsa.Core.Common.PersentationController.GetEntityValue(TrafficStatusForAcceptTurnDataTable.Rows[0]["TurnCanceled_bit"], TypeCode.Boolean);
                                                        bool?TurnAccepted        = (bool?)Hepsa.Core.Common.PersentationController.GetEntityValue(TrafficStatusForAcceptTurnDataTable.Rows[0]["TurnAccepted_bit"], TypeCode.Boolean);

                                                        if (LadBillCreditCancel.HasValue && LadBillCreditCancel == true)
                                                        {
                                                            if (LadBillCreditTurn.HasValue && LadBillCreditTurn == true)
                                                            {
                                                                Description = (string.Format("این ناوگان دارای شماره نوبت تأیید شده< {0} >می باشد", TrafficStatusForAcceptTurnDataTable.Rows[0]["AcceptedTurnNumber_bint"]));
                                                                return(false);
                                                            }
                                                        }
                                                        else
                                                        {
                                                            if (TurnCanceled.HasValue && TurnCanceled == true)
                                                            {
                                                                if (TurnReturn.HasValue && TurnReturn == true)
                                                                {
                                                                    //احیای نوبت در ابطال مجوز پس مدت سفر داره
                                                                    if (dr[dr.Length - 1]["Out_bit"].ToString() == "False")
                                                                    {
                                                                        TimeSpan date          = NowDate - OutDate;
                                                                        double   remaindedHour = _CityTravelHour - date.TotalHours;
                                                                        string   RemaindeHour  = TimeSpan.FromDays(remaindedHour).ToString().Substring(0, TimeSpan.FromDays(remaindedHour).ToString().Length - 3);
                                                                        if (OutDate.AddHours(_CityTravelHour).CompareTo(NowDate) > 0)//date.TotalHours > _CityTravelHour)
                                                                        {
                                                                            Description = (string.Format("مدت سفراین ناوگان به مجوز< {0} >تمام نشده و مدت < {1} > مانده است ", dr[dr.Length - 1]["LadBillCreditID_int"], RemaindeHour));
                                                                            return(false);
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                            else
                                                            {
                                                                // لحاظ نمودن مدت سفر
                                                                if (dr[dr.Length - 1]["Out_bit"].ToString() == "False")
                                                                {
                                                                    TimeSpan date          = NowDate - OutDate;
                                                                    double   remaindedHour = _CityTravelHour - date.TotalHours;
                                                                    string   RemaindeHour  = TimeSpan.FromDays(remaindedHour).ToString().Substring(0, TimeSpan.FromDays(remaindedHour).ToString().Length - 3);
                                                                    if (OutDate.AddHours(_CityTravelHour).CompareTo(NowDate) > 0)//date.TotalHours > _CityTravelHour)
                                                                    {
                                                                        Description = (string.Format("مدت سفراین ناوگان به مجوز< {0} >تمام نشده و مدت < {1} > مانده است ", dr[dr.Length - 1]["LadBillCreditID_int"], RemaindeHour));
                                                                        return(false);
                                                                    }
                                                                    else
                                                                    {
                                                                        DataTable TurnStatusDataTable = new DataTable();
                                                                        TrafficFactory.GetTurnStatus((string)Hepsa.Core.Common.PersentationController.GetEntityValue(NumberPlate_nvc, TypeCode.String), (string)Hepsa.Core.Common.PersentationController.GetEntityValue(SerialPlate_nvc, TypeCode.String), TurnStatusDataTable);
                                                                        if (TurnStatusDataTable != null && TurnStatusDataTable.Rows.Count > 0)
                                                                        {
                                                                            List <HPS.BLL.TrafficBLL.BLLTraffic_T> trafficList = new List <HPS.BLL.TrafficBLL.BLLTraffic_T>();
                                                                            trafficList = TrafficFactory.GetAllBy(HPS.BLL.TrafficBLL.BLLTraffic_T.Traffic_TField.TrafficNumber_bint, TrafficNumber_bint);
                                                                            if (trafficList != null && trafficList.Count > 0)
                                                                            {
                                                                                if (trafficList[0].In_bit == true && (trafficList[0].NumberPlate_nvc != NumberPlate_nvc || Convert.ToInt32(trafficList[0].SerialPlate_nvc) != Convert.ToInt32(SerialPlate_nvc)))
                                                                                {
                                                                                    Description = (string.Format("ناوگان دارای شماره نوبت تأییدی < {0} >می باشد", TurnStatusDataTable.Rows[TurnStatusDataTable.Rows.Count - 1]["AcceptedTurnNumber_bint"]));
                                                                                    return(false);
                                                                                }
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                DataTable TurnStatus = new DataTable();
                                                TrafficFactory.GetTurnStatus((string)Hepsa.Core.Common.PersentationController.GetEntityValue(NumberPlate_nvc, TypeCode.String), (string)Hepsa.Core.Common.PersentationController.GetEntityValue(SerialPlate_nvc, TypeCode.String), TurnStatus);
                                                if (TurnStatus != null && TurnStatus.Rows.Count > 0)
                                                {
                                                    DataTable TrafficStatusForAcceptTurnDataTable = new DataTable();
                                                    TrafficFactory.GetLastStatusForAcceptTurn((Int64)Hepsa.Core.Common.PersentationController.GetEntityValue(TurnStatus.Rows[TurnStatus.Rows.Count - 1]["TrafficID_bint"], TypeCode.Int64), TrafficStatusForAcceptTurnDataTable);
                                                    if (TrafficStatusForAcceptTurnDataTable != null && TrafficStatusForAcceptTurnDataTable.Rows.Count > 0 && Convert.ToBoolean(TrafficStatusForAcceptTurnDataTable.Rows[0]["HasTurn_bit"]) == true)
                                                    {
                                                        bool?LadBillCreditCancel = (bool?)Hepsa.Core.Common.PersentationController.GetEntityValue(TrafficStatusForAcceptTurnDataTable.Rows[0]["LadBillCreditCancel_bit"], TypeCode.Boolean);
                                                        bool?LadBillCreditTurn   = (bool?)Hepsa.Core.Common.PersentationController.GetEntityValue(TrafficStatusForAcceptTurnDataTable.Rows[0]["LadBillCreditTurn_bit"], TypeCode.Boolean);
                                                        bool?TurnReturn          = (bool?)Hepsa.Core.Common.PersentationController.GetEntityValue(TrafficStatusForAcceptTurnDataTable.Rows[0]["TurnReturn_bit"], TypeCode.Boolean);
                                                        bool?TurnCanceled        = (bool?)Hepsa.Core.Common.PersentationController.GetEntityValue(TrafficStatusForAcceptTurnDataTable.Rows[0]["TurnCanceled_bit"], TypeCode.Boolean);
                                                        bool?TurnAccepted        = (bool?)Hepsa.Core.Common.PersentationController.GetEntityValue(TrafficStatusForAcceptTurnDataTable.Rows[0]["TurnAccepted_bit"], TypeCode.Boolean);

                                                        if (LadBillCreditCancel.HasValue && LadBillCreditCancel == true)
                                                        {
                                                            if (LadBillCreditTurn.HasValue && LadBillCreditTurn == true)
                                                            {
                                                                Description = (string.Format("این ناوگان دارای شماره نوبت تأیید شده< {0} >می باشد", TrafficStatusForAcceptTurnDataTable.Rows[0]["AcceptedTurnNumber_bint"]));
                                                                return(false);
                                                            }
                                                        }
                                                        else
                                                        {
                                                            if (TurnCanceled.HasValue && TurnCanceled == true)
                                                            {
                                                                if (TurnReturn.HasValue && TurnReturn == true)
                                                                {
                                                                    //نوبت فعال
                                                                    DataTable TurnStatusDataTable = new DataTable();
                                                                    TrafficFactory.GetTurnStatus((string)Hepsa.Core.Common.PersentationController.GetEntityValue(NumberPlate_nvc, TypeCode.String), (string)Hepsa.Core.Common.PersentationController.GetEntityValue(SerialPlate_nvc, TypeCode.String), TurnStatusDataTable);
                                                                    if (TurnStatusDataTable != null && TurnStatusDataTable.Rows.Count > 0)
                                                                    {
                                                                        Description = (string.Format("ناوگان دارای شماره نوبت تأییدی < {0} >می باشد", TurnStatusDataTable.Rows[TurnStatusDataTable.Rows.Count - 1]["AcceptedTurnNumber_bint"]));
                                                                        return(false);
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }

                                else
                                {
                                    DateTime  NowDate          = DateTime.Parse((new Hepsa.Core.Common.MyDateTime(TrafficFactory.ServerJalaliDate)).MyDate.ToString("yyyy/MM/dd") + " " + TrafficFactory.ServerTime);
                                    DataTable TrafficDataTable = new DataTable();
                                    string    Condition        = string.Format("Traffic_T.NumberPlate_nvc='{0}' and SerialPlate_nvc='{1}'", NumberPlate_nvc, SerialPlate_nvc);
                                    TrafficFactory.GetAllByConditionWithLadBill(Condition, ref TrafficDataTable);

                                    if (TrafficDataTable != null && TrafficDataTable.Rows.Count > 0)
                                    {
                                        string    filter = "LadeAssignmentId_bint=Max(LadeAssignmentId_bint)";
                                        DataRow[] dr     = TrafficDataTable.Select(filter);
                                        if (dr != null && dr.Length > 0)
                                        {
                                            if (((bool?)Hepsa.Core.Common.PersentationController.GetEntityValue(dr[dr.Length - 1]["Turn_bit"], TypeCode.Boolean) == true && (bool)Hepsa.Core.Common.PersentationController.GetEntityValue(dr[dr.Length - 1]["Canceled_bit"], TypeCode.Boolean) == true) || (bool)Hepsa.Core.Common.PersentationController.GetEntityValue(dr[dr.Length - 1]["Canceled_bit"], TypeCode.Boolean) == false)
                                            {
                                                Int32 _CityTravelHour = 0;
                                                if (!string.IsNullOrEmpty(dr[dr.Length - 1]["TravelTime_int"].ToString()))
                                                {
                                                    _CityTravelHour = Convert.ToInt32(dr[dr.Length - 1]["TravelTime_int"].ToString());
                                                }
                                                string    _OutDate = dr[dr.Length - 1]["LadBillDate"].ToString();
                                                string    _OutTime = dr[dr.Length - 1]["LadBillTime"].ToString();
                                                DateTime  OutDate  = DateTime.Parse((new Hepsa.Core.Common.MyDateTime(_OutDate)).MyDate.ToString("yyyy/MM/dd") + " " + _OutTime);
                                                DataTable TrafficStatusForAcceptTurnDataTable = new DataTable();

                                                if (dr[dr.Length - 1]["Out_bit"].ToString() == "False")
                                                {
                                                    TimeSpan date          = NowDate - OutDate;
                                                    double   remaindedHour = _CityTravelHour - date.TotalHours;
                                                    string   RemaindeHour  = TimeSpan.FromDays(remaindedHour).ToString().Substring(0, TimeSpan.FromDays(remaindedHour).ToString().Length - 3);
                                                    if (OutDate.AddHours(_CityTravelHour).CompareTo(NowDate) > 0)
                                                    {
                                                        if (string.IsNullOrEmpty(dr[dr.Length - 1]["Canceled_bit"].ToString()) || dr[dr.Length - 1]["Canceled_bit"].ToString() == "False")
                                                        {
                                                            Description = (string.Format("مدت سفراین ناوگان به مجوز< {0} >تمام نشده و مدت < {1} > مانده است ", dr[dr.Length - 1]["LadBillCreditID_int"], RemaindeHour));
                                                            return(false);
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                    else
                                    {
                                        // نوبت داره
                                        DataTable TurnStatusDataTable = new DataTable();
                                        TrafficFactory.GetTurnStatus((string)Hepsa.Core.Common.PersentationController.GetEntityValue(NumberPlate_nvc, TypeCode.String), (string)Hepsa.Core.Common.PersentationController.GetEntityValue(SerialPlate_nvc, TypeCode.String), TurnStatusDataTable);
                                        if (TurnStatusDataTable != null && TurnStatusDataTable.Rows.Count > 0)
                                        {
                                            Description = (string.Format("ناوگان دارای شماره نوبت تأییدی < {0} >می باشد", TurnStatusDataTable.Rows[TurnStatusDataTable.Rows.Count - 1]["AcceptedTurnNumber_bint"]));
                                            return(false);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                #endregion
                ////////////////////////////////////
                return(true);
            }
            catch (System.Exception ex)
            {
                this.Description = ex.Message;
                return(false);
            }
        }