Ejemplo n.º 1
0
        public DriverEnterPage ValidateDriverlnfolsFilledOut(DriverInformation driverInformation)
        {
            var node = GetLastNode();

            try
            {
                ParameterValidator.ValidateNotNull(driverInformation, "Driver Information");
                List <KeyValuePair <string, string[]> > comparisons = new List <KeyValuePair <string, string[]> >()
                {
                    new KeyValuePair <string, string[]>("First Name", new string[] { driverInformation.FullName.FirstName, FirstNameTextBox.GetValue() }),
                    new KeyValuePair <string, string[]>("MiddIe Initial", new string[] { driverInformation.FullName.MiddleInitial, MiddleInitialTextBox.GetValue() }),
                    new KeyValuePair <string, string[]>("Last Name", new string[] { driverInformation.FullName.LastName, LastNameTextBox.GetValue() }),
                    new KeyValuePair <string, string[]>("Date Of Birth", new string[] { driverInformation.DateOfBirth, DateOfBirthTextBox.GetValue() }),
                    new KeyValuePair <string, string[]>("License Number", new string[] { driverInformation.LicenseNumber, LicenseNumberTextBox.GetValue() }),
                    new KeyValuePair <string, string[]>("License State", new string[] { driverInformation.LicenseState, LicenseStateDropdown.Text }),
                };
                foreach (var item in comparisons)
                {
                    if (item.Value[0] == item.Value[1])
                    {
                        SetPassValidation(node, ValidationMessage.ValidateDriverInfoIsFilledOut, item.Key, item.Value[0]);
                    }
                    else
                    {
                        SetFailValidation(node, ValidationMessage.ValidateDriverInfoIsFilledOut, item.Key, item.Value[0], item.Value[1]);
                    }
                }
            }
            catch (Exception e)
            {
                SetErrorValidation(node, ValidationMessage.ValidateDriverInfoIsFilledOut, e);
            }
            return(this);
        }
Ejemplo n.º 2
0
        private void Recover(DriverInformation driverInformation)
        {
            IPEndPoint driverEndpoint = NetUtilities.ParseIpEndpoint(driverInformation.DriverRemoteIdentifier);

            _remoteId = new SocketRemoteIdentifier(driverEndpoint);
            _observer = _remoteManager.GetRemoteObserver(new RemoteEventEndPoint <REEFMessage>(_remoteId));
            lock (_evaluatorSettings)
            {
                if (_evaluatorSettings.NameClient != null)
                {
                    try
                    {
                        LOGGER.Log(Level.Verbose, "Trying to reset and reconnect to name server" + driverInformation.NameServerId);
                        _evaluatorSettings.NameClient.Restart(NetUtilities.ParseIpEndpoint(driverInformation.NameServerId));
                        LOGGER.Log(Level.Info, "Reconnected to name server: " + driverInformation.NameServerId);
                    }
                    catch (Exception e)
                    {
                        Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Caught(e, Level.Error, LOGGER);
                    }
                }
            }

            lock (_queuedHeartbeats)
            {
                bool firstHeartbeatInQueue = true;
                while (_queuedHeartbeats.Any())
                {
                    LOGGER.Log(Level.Info, "Sending cached recovery heartbeats to " + _remoteId);
                    try
                    {
                        if (firstHeartbeatInQueue)
                        {
                            // first heartbeat is specially construted to include the recovery flag
                            EvaluatorHeartbeatProto recoveryHeartbeat = ConstructRecoveryHeartBeat(_queuedHeartbeats.Dequeue());
                            LOGGER.Log(Level.Info, "Recovery heartbeat to be sent:" + recoveryHeartbeat);
                            _observer.OnNext(new REEFMessage(recoveryHeartbeat));
                            firstHeartbeatInQueue = false;
                        }
                        else
                        {
                            _observer.OnNext(new REEFMessage(_queuedHeartbeats.Dequeue()));
                        }
                    }
                    catch (Exception e)
                    {
                        // we do not handle failures during RECOVERY
                        Org.Apache.REEF.Utilities.Diagnostics.Exceptions.CaughtAndThrow(
                            e,
                            Level.Error,
                            string.Format(CultureInfo.InvariantCulture, "Hearbeat attempt failed in RECOVERY mode to Driver {0} , giving up...", _remoteId),
                            LOGGER);
                    }
                    Thread.Sleep(500);
                }
            }
            _evaluatorSettings.OperationState = EvaluatorOperationState.OPERATIONAL;
            LOGGER.Log(Level.Info, "=========== Exiting RECOVERY mode. ===========");
        }
Ejemplo n.º 3
0
        public bool EditDriverInformation(DriverInformationBLL objEdit)
        {
            //check if it has a GRN not in Edit mood.

            if (isGRNEditable(this.ReceivigRequestId) == false)
            {
                throw new GRNNotOnUpdateStatus(" This Information can't up updated because the GRN is not on Edit status");
            }


            bool           isSaved = false;
            SqlTransaction tran;
            SqlConnection  Conn = Connection.getConnection();

            tran = Conn.BeginTransaction();
            int AtStatus = -1;

            try
            {
                DriverInformation objDriverInfoDAL = new DriverInformation();
                isSaved = objDriverInfoDAL.UpdateDriverInformation(this, tran);
                if (isSaved == true)
                {
                    string        AppMode = WFStepsName.EditDriverInfo.ToString();
                    AuditTrailBLL objAt   = new AuditTrailBLL();
                    AtStatus = objAt.saveAuditTrail(this, objEdit, AppMode, UserBLL.GetCurrentUser(), "DriverInformationUpdate");
                    if (AtStatus == 1 || AtStatus == 0)
                    {
                        tran.Commit();
                    }
                    else
                    {
                        tran.Rollback();
                    }
                }
            }
            catch (Exception ex)
            {
                tran.Rollback();
                ErrorLogger.Log(ex);
                return(false);
            }
            if (AtStatus == 1 || AtStatus == 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 4
0
 public DriverEnterPage EnterNameAndDOB(DriverInformation driverInformation, bool wasAbleToProceed = true)
 {
     GetLastNode().LogDataInfo(driverInformation);
     ParameterValidator.ValidateNotNull(driverInformation, "Driver Information");
     FirstNameTextBox.InputText(driverInformation.FullName.FirstName);
     MiddleInitialTextBox.InputText(driverInformation.FullName.MiddleInitial);
     LastNameTextBox.InputText(driverInformation.FullName.LastName);
     DateOfBirthTextBox.InputText(driverInformation.DateOfBirth);
     if (wasAbleToProceed)
     {
         WaitForElementEnabled(_btnNext);
     }
     return(this);
 }
Ejemplo n.º 5
0
        public void BindData(Guid Id)
        {
            DataTable         dt            = new DataTable("tblDriverInfo");
            DataSet           dsResult      = new DataSet("DriverInformation");
            DriverInformation objDriverInfo = new DriverInformation();

            dsResult = objDriverInfo.GetDriverInformationByReceivigRequestId(Id);
            if (dsResult != null)
            {
                dt = dsResult.Tables[0];
                this.gvDriverInformation.DataSource = dt;
                this.gvDriverInformation.DataBind();
            }
        }
Ejemplo n.º 6
0
        public bool isDuplicate(Guid ReceivingRequestId, string LicenseNumber, string LicenseIssuedPlace)
        {
            int count = 0;

            count = DriverInformation.GetUniqueCount(ReceivingRequestId, LicenseNumber, LicenseIssuedPlace);
            if (count != 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 7
0
        public List <DriverInformationBLL> GetActiveDriverInformationByReceivigRequestId(Guid ReceivigRequestId)
        {
            List <DriverInformationBLL> list = new List <DriverInformationBLL>();

            try
            {
                list = DriverInformation.GetActiveDriverInformationByReceivigRequestId(ReceivigRequestId);
                return(list);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 8
0
 public DriverEnterPage EnterLicenseAndState(DriverInformation driverInformation, bool wasAbleToProceed = true)
 {
     GetLastNode().LogDataInfo(driverInformation);
     ParameterValidator.ValidateNotNull(driverInformation, "Driver Information");
     LicenseNumberTextBox.InputText(driverInformation.LicenseNumber);
     LicenseStateDropdown.SelectByText(driverInformation.LicenseState);
     if (driverInformation.DoesNotDrive)
     {
         DoesNotDriveCheckBox.Check();
     }
     if (wasAbleToProceed)
     {
         WaitForElementEnabled(_btnNext);
     }
     return(this);
 }
Ejemplo n.º 9
0
 public void OnNext(Alarm value)
 {
     LOGGER.Log(Level.Verbose, "Before acquiring lock: HeartbeatManager::OnNext(Alarm)");
     lock (this)
     {
         LOGGER.Log(Level.Verbose, "HeartbeatManager::OnNext(Alarm)");
         if (_evaluatorSettings.OperationState == EvaluatorOperationState.OPERATIONAL && EvaluatorRuntime.State == State.RUNNING)
         {
             EvaluatorHeartbeatProto evaluatorHeartbeatProto = GetEvaluatorHeartbeatProto();
             LOGGER.Log(Level.Verbose, string.Format(CultureInfo.InvariantCulture, "Triggered a heartbeat: {0}. {1}Node Health: {2}", evaluatorHeartbeatProto, Environment.NewLine, MachineStatus.ToString()));
             Send(evaluatorHeartbeatProto);
             _clock.ScheduleAlarm(_heartBeatPeriodInMillSeconds, this);
         }
         else
         {
             LOGGER.Log(Level.Verbose, string.Format(CultureInfo.InvariantCulture, "Ignoring regular heartbeat since Evaluator operation state is [{0}] and runtime state is [{1}]. ", EvaluatorSettings.OperationState, EvaluatorRuntime.State));
             try
             {
                 DriverInformation driverInformation = _driverConnection.GetDriverInformation();
                 if (driverInformation == null)
                 {
                     LOGGER.Log(Level.Verbose, "In RECOVERY mode, cannot retrieve driver information, will try again later.");
                 }
                 else
                 {
                     LOGGER.Log(
                         Level.Info,
                         string.Format(CultureInfo.InvariantCulture, "Detect driver restarted at {0} and is running on endpoint {1} with services {2}. Now trying to re-establish connection", driverInformation.DriverStartTime, driverInformation.DriverRemoteIdentifier, driverInformation.NameServerId));
                     Recover(driverInformation);
                 }
             }
             catch (Exception e)
             {
                 // we do not want any exception to stop the query for driver status
                 Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Caught(e, Level.Warning, LOGGER);
             }
             _clock.ScheduleAlarm(_heartBeatPeriodInMillSeconds, this);
         }
     }
 }
Ejemplo n.º 10
0
 public DriverEnterPage EnterDriverInfo(DriverInformation driverInformation, bool wasAbleToProceed = true)
 {
     GetLastNode().LogDataInfo(driverInformation);
     ParameterValidator.ValidateNotNull(driverInformation, "Driver Information");
     if (!driverInformation.IsPO)
     {
         FirstNameTextBox.InputText(driverInformation.FullName.FirstName);
         MiddleInitialTextBox.InputText(driverInformation.FullName.MiddleInitial);
         LastNameTextBox.InputText(driverInformation.FullName.LastName);
     }
     DateOfBirthTextBox.InputText(driverInformation.DateOfBirth);
     LicenseNumberTextBox.InputText(driverInformation.LicenseNumber);
     LicenseStateDropdown.SelectByText(driverInformation.LicenseState);
     if (driverInformation.DoesNotDrive)
     {
         DoesNotDriveCheckBox.Check();
     }
     if (wasAbleToProceed)
     {
         WaitForElementEnabled(_btnNext);
     }
     return(this);
 }
Ejemplo n.º 11
0
        public DriverInformationBLL GetById(Guid Id)
        {
            DriverInformationBLL obj = new DriverInformationBLL();
            DataSet dsDriver         = DriverInformation.GetDriverInformationById(Id);

            if (dsDriver != null)
            {
                if (dsDriver.Tables[0].Rows.Count == 1)
                {
                    obj.Id = new Guid(dsDriver.Tables[0].Rows[0]["Id"].ToString());
                    obj.ReceivigRequestId  = new Guid(dsDriver.Tables[0].Rows[0]["ReceivingRequestId"].ToString());
                    obj.DriverName         = dsDriver.Tables[0].Rows[0]["DriverName"].ToString();
                    obj.LicenseNumber      = dsDriver.Tables[0].Rows[0]["LicenseNumber"].ToString();
                    obj.LicenseIssuedPlace = dsDriver.Tables[0].Rows[0]["LicenseIssuedPlace"].ToString();
                    obj.PlateNumber        = dsDriver.Tables[0].Rows[0]["PlateNumber"].ToString();
                    obj.TrailerPlateNumber = dsDriver.Tables[0].Rows[0]["TrailerPlateNumber"].ToString();
                    obj.Status             = Convert.ToInt32(dsDriver.Tables[0].Rows[0]["Status"].ToString());
                    obj.Remark             = dsDriver.Tables[0].Rows[0]["Remark"].ToString();
                    return(obj);
                }
            }
            return(null);
        }
Ejemplo n.º 12
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            this.lblMessage.Text = "";
            bool isSaved = false;
            // Save the Driver Information.
            DriverInformation objDriverInfo = new DriverInformation();
            Guid CommodityDepositRequestId  = new Guid(this.CommodityDepositRequestId.Value.ToString());

            Guid CreatedBy = UserBLL.GetCurrentUser();

            if (this.txtRemark.Text == null)
            {
                this.txtRemark.Text = String.Empty;
            }
            Guid TruckRegisterId = Guid.Empty;


            if (txtPlateNo.Text != "")
            {
                //Registering Truck
                TruckRegisterBLL objTruckRegister = new TruckRegisterBLL();
                objTruckRegister.IsTrailer = false;
                if (cboModelYear.SelectedValue.ToString() != "")
                {
                    objTruckRegister.TruckModelYearId = new Guid(cboModelYear.SelectedValue.ToString());
                }
                else
                {
                    this.lblMessage.Text = "Please Select Truck Model Year.";
                    return;
                }
                objTruckRegister.TruckNumber = txtPlateNo.Text;
                objTruckRegister.Status      = TruckStatus.Active;
                objTruckRegister.Add();
            }
            if (txtTrailerPlateNo.Text != "")
            {
                //Registering Truck
                TruckRegisterBLL objTrailerTruckRegister = new TruckRegisterBLL();
                objTrailerTruckRegister.IsTrailer = true;
                if (cboTrailerModelYear.SelectedValue.ToString() != "")
                {
                    objTrailerTruckRegister.TruckModelYearId = new Guid(cboTrailerModelYear.SelectedValue.ToString());
                }
                else
                {
                    this.lblMessage.Text = "Please Select Trailer Model Year.";
                    return;
                }
                objTrailerTruckRegister.TruckNumber = txtTrailerPlateNo.Text;
                objTrailerTruckRegister.Status      = TruckStatus.Active;
                objTrailerTruckRegister.Add();
            }


            DriverInformationBLL obj = new DriverInformationBLL(CommodityDepositRequestId, this.txtDriverName.Text,
                                                                this.txtLicenseNo.Text, this.txtPlaceIssued.Text, this.txtPlateNo.Text, this.txtTrailerPlateNo.Text,
                                                                1, this.txtRemark.Text, CreatedBy);

            try
            {
                isSaved = obj.SaveDriverInformation();
            }
            catch (DuplicateDriverInformationException ex)
            {
                this.lblMessage.Text = ex.msg;
                return;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            if (isSaved == true)
            {
                this.lblMessage.Text = "Record Added Successfully";
                this.btnSave.Enabled = false;
                ClearForm();
                this.CommodityDepositRequestId.Value = CommodityDepositRequestId.ToString();
                BindData(CommodityDepositRequestId);
            }
            else
            {
                this.lblMessage.Text = "Unable to Add the data please check the form and try agian.";
            }
            ToggleNext();
        }
Ejemplo n.º 13
0
        public static T AddDriver <T>(this DriverEnterPage driverEnterPage, DriverInformation driverInformation)
        {
            ParameterValidator.ValidateNotNull(driverEnterPage, "Driver enter page");
            ParameterValidator.ValidateNotNull(driverInformation, "Driver information");

            AddAnotherDriverPage addAnotherDriverPage = new AddAnotherDriverPage();
            CDLExperiencePage    cDLExperiencePage    = new CDLExperiencePage();
            DriverOverviewPage   driverOverviewPage   = new DriverOverviewPage();

            if (driverInformation.IsPO)
            {
                //1. Complete driver info and select next
                driverEnterPage.EnterDriverInfo(driverInformation).SelectNextButton();
            }
            else
            {
                //1.1 Complete Name and Date of Birth
                driverEnterPage.EnterNameAndDOB(driverInformation);
                //Verification
                driverEnterPage.ValidateNextButtonDisplayedAndEnabled();

                //1.2 Complete license number and state and select next
                driverEnterPage.EnterLicenseAndState(driverInformation).SelectNextButton();
            }
            //Verification
            cDLExperiencePage.ValidateCDLExperiencePageDisplayed();

            //2. Complete CDL Experience info and select next
            dynamic currentPage = cDLExperiencePage.EnterCDLExperience(driverInformation.CDLExperience).SelectNextButton();

            if (driverInformation.MVRStatus == OrderMVRStatus.Invalid ||
                (driverInformation.MVRStatus == OrderMVRStatus.Unknown &&
                 currentPage is AccidentsAndViolationsPage))
            {
                AccidentsAndViolationsPage accidentsAndViolationsPage = new AccidentsAndViolationsPage();
                //verification
                accidentsAndViolationsPage.ValidateAccidentsAndViolationsPageDisplayed();

                //3. Complete Accident and Violation info and select next
                ConvictionsPage convictionsPage = accidentsAndViolationsPage.EnterAccidentAndViolation(driverInformation.AccidentsAndViolations).SelectNextButton();

                //Verification
                convictionsPage.ValidateConvictionsPageDisplayed();

                //4. Complete Convictions info
                convictionsPage.EnterConviction(driverInformation.Conviction);

                // Navigate to Driver Overview page if process is edit Flow
                if (driverInformation.IsEditFlow)
                {
                    //Select next button
                    convictionsPage.SelectNextButton <DriverOverviewPage>();
                }
                // Require the second driver if DoseNotDrive was checked
                else if (driverInformation.DoesNotDrive)
                {
                    // Select Next Button
                    convictionsPage.SelectNextButton <DriverEnterPage>();
                }
                else
                {
                    // Select Next button
                    convictionsPage.SelectNextButton <AddAnotherDriverPage>();
                }
            }
            if (driverInformation.IsEditFlow)
            {
                // verification
                driverOverviewPage.ValidateDriverOverviewPageDisplayed();
            }
            else if (driverInformation.DoesNotDrive)
            {
                //Verification
                driverEnterPage.ValidateDriverEnterPageDisplayed();
            }
            else
            {
                // Verification
                addAnotherDriverPage.ValidateAddAnotherDriverPageDisplayed();
            }
            return((T)Activator.CreateInstance(typeof(T)));
        }
Ejemplo n.º 14
0
 public static DriverOverviewPage EditDriver(this DriverEnterPage driverFormPage, DriverInformation driverInformation)
 {
     if (driverInformation != null)
     {
         driverInformation.IsEditFlow = true;
     }
     return(AddDriver <DriverOverviewPage>(driverFormPage, driverInformation));
 }
Ejemplo n.º 15
0
 public static AddAnotherDriverPage AddDriver(this DriverEnterPage driverEnterPage, DriverInformation driverInformation)
 {
     return(AddDriver <AddAnotherDriverPage>(driverEnterPage, driverInformation));
 }
Ejemplo n.º 16
0
        public bool SaveDriverInformation()
        {
            bool                 isValid, isDuplicate = false;
            bool                 isSaved          = false;
            AuditTrailBLL        objAt            = new AuditTrailBLL();
            DriverInformationBLL objDriverInfoBLL = new DriverInformationBLL(this.ReceivigRequestId, this.DriverName,
                                                                             this.LicenseNumber, this.LicenseIssuedPlace, this.PlateNumber, this.TrailerPlateNumber, this.Status, this.Remark, this.CreatedBy);

            //TODO : Check status is not cancelled
            //isDuplicate = this.isDuplicate(this.ReceivigRequestId, this.LicenseIssuedPlace, this.LicenseIssuedPlace);
            //if (isDuplicate == true)
            //{
            //throw new DuplicateDriverInformationException("This driver information has already been added");
            //}
            isValid = this.isValidForSave(objDriverInfoBLL);
            if (isValid == true)
            {
                SqlTransaction tran;
                SqlConnection  conn = Connection.getConnection();
                tran = conn.BeginTransaction();
                try
                {
                    DriverInformation objDriverInfoDAL = new DriverInformation();
                    Guid DriverInformationId           = Guid.Empty;

                    DriverInformationId = objDriverInfoDAL.InsertDriverInformation(objDriverInfoBLL, tran);
                    if (DriverInformationId == Guid.Empty)
                    {
                        tran.Rollback();
                        isSaved = false;
                    }
                    else
                    {
                        objDriverInfoBLL.Id = DriverInformationId;

                        if (objAt.saveAuditTrail(objDriverInfoBLL, WFStepsName.AddDriverInformation.ToString(), UserBLL.GetCurrentUser(), "Add New Driver Information") == -1)
                        {
                            tran.Rollback();
                            isSaved = false;
                        }
                        else
                        {
                            tran.Commit();
                            isSaved = true;
                        }
                    }
                    conn.Close();
                }
                catch (Exception e)
                {
                    tran.Rollback();
                    objAt.RoleBack();
                    throw e;
                }
                finally
                {
                    tran.Dispose();
                    conn.Close();
                }
            }
            else
            {
                return(false);
            }
            return(isSaved);
        }