// FUNCTIONAL METHODS
 public void SendUser(Person xPerson)
 {
     if (xPerson is EMT)
     {
         if (DRs != null)
         {
             emt         = (EMT)xPerson;
             lbrtid.Text = emt.GetResponseTeam().GetID().ToString();
             if (DRs != null)
             {
                 for (int a = 0; a < DRs.Count; a++)
                 {
                     if (lbrtid.Text == DRs[a].GetResponseTeam().GetID().ToString())
                     {
                         dis = DRs[a];
                         lbEmergencyID.Text = DRs[a].GetEmergency().GetEmergency_ID().ToString();
                     }
                 }
             }
         }
     }
     else
     {
         btnSubmit.Enabled = false;
         SendStatusUpdate(true, "To access, you must have EMT access level!", "urgent");
     }
 }
Exemplo n.º 2
0
        // CONSTRUCTORS
        //To-setup the view.
        public EMT_Login_Shift_View(bool toDisplay, ref Special_List <EMT> xEmts, Employee xEmployee) : this(toDisplay)
        {
            if (xEmployee is EMT)
            {
                CurrentEMT = (EMT)xEmployee;
            }
            else
            {
                return;
            }
            timer1.Enabled  = true;
            timer1.Interval = 1000;
            emts            = xEmts.ToArray();
            int    a = int.Parse(CurrentEMT.getshifttime().Split(':')[0]);
            string time;
            if (a - 12 < 0)
            {
                a    = Math.Abs(a);
                time = a.ToString() + ":00 AM";
            }
            else
            {
                a    = a - 12;
                time = a.ToString() + ":00 PM";
            }


            LBshifttime.Text = time;

            int temp1;
            if (int.Parse(DateTime.Now.Hour.ToString()) - int.Parse(CurrentEMT.getshifttime().Split(':')[0]) < 0)
            {
                temp1 = int.Parse(DateTime.Now.Hour.ToString()) + 24 - Math.Abs(int.Parse(CurrentEMT.getshifttime().Split(':')[0]));
            }
            else
            {
                temp1 = int.Parse(DateTime.Now.Hour.ToString()) - int.Parse(CurrentEMT.getshifttime().Split(':')[0]);
            }


            if (CurrentEMT.getstatus() == "STARTED")
            {
                LBtotalworkedhours.Text = CurrentEMT.getTotalShiftTime().ToString().Substring(0, 8);
                lbrt.Text              = CurrentEMT.GetResponseTeam().GetID().ToString();
                labemtid.Text          = CurrentEMT.GetEmployee_ID().ToString();
                lblogtime.Text         = CurrentEMT.getstatus();
                button1.Enabled        = false;
                btnWaitingCall.Enabled = true;
                SendStatusUpdate(true, "You shift started by: " + CurrentEMT.getshiftlogintime(), null);
            }
            else if (temp1 >= 0 && temp1 < 8)
            {
                LBtotalworkedhours.Text = CurrentEMT.getTotalShiftTime().ToString().Substring(0, 8);
                lbrt.Text              = CurrentEMT.GetResponseTeam().GetID().ToString();
                labemtid.Text          = CurrentEMT.GetEmployee_ID().ToString();
                lblogtime.Text         = "READY";
                button1.Enabled        = true;
                btnWaitingCall.Enabled = false;
                SendStatusUpdate(true, "Ready to start the shift", null);
            }
            else
            {
                string b = (DateTime.Now.Hour.ToString());
                LBtotalworkedhours.Text = CurrentEMT.getTotalShiftTime().ToString().Substring(0, 8);
                lbrt.Text              = CurrentEMT.GetResponseTeam().GetID().ToString();
                labemtid.Text          = CurrentEMT.GetEmployee_ID().ToString();
                lblogtime.Text         = "NOT READY";
                btnWaitingCall.Enabled = false;
                button1.Enabled        = false;
                SendStatusUpdate(true, "It is not your shift time Yet", "urgent");
            }
        }