示例#1
0
 private void LoadTable()
 {
     if (!Name.Equals("Archived"))
     {
         AssignmentsGRD.DataSource            = Scheduling.GetAssignmentHistory(Gid);
         AssignmentsGRD.Columns[0].Visible    = false;
         AssignmentsGRD.Columns[0].Visible    = false;
         AssignmentsGRD.Columns[1].HeaderText = "ASSIGNED AT";
         AssignmentsGRD.Columns[1].Width      = 200;
         AssignmentsGRD.Columns[2].HeaderText = "ASSIGNED";
         AssignmentsGRD.Columns[2].Width      = 100;
         AssignmentsGRD.Columns[3].HeaderText = "UNASSIGNED";
         AssignmentsGRD.Columns[3].Width      = 100;
     }
     else
     {
         AssignmentsGRD.Location              = new Point(AssignmentsGRD.Location.X + 60, AssignmentsGRD.Location.Y);
         AssignmentsGRD.Size                  = new Size(AssignmentsGRD.Size.Width - 50, AssignmentsGRD.Size.Height);
         AssignmentsGRD.DataSource            = Archiver.GetAssignmentHistory(Gid);
         AssignmentsGRD.Columns[0].Visible    = false;
         AssignmentsGRD.Columns[1].HeaderText = "ASSIGNED ON";
         AssignmentsGRD.Columns[1].Width      = 100;
         AssignmentsGRD.Columns[2].Visible    = false;
         AssignmentsGRD.Columns[3].HeaderText = "ASSIGNED AT";
         AssignmentsGRD.Columns[3].Width      = 200;
     }
     SGuardHistoryViewBTN.Visible = AssignmentsGRD.Rows.Count > 0;
 }
示例#2
0
 private void LoadRequestedGuard()
 {
     RequestedGRD.DataSource = Scheduling.GetRequestedGuards(Raid);
     RequestedGRD.Columns[0].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
     RequestedGRD.Columns[0].Width     = 400;
     RequestedGRD.ColumnHeadersVisible = false;
 }
示例#3
0
 private void AssignBTN_Click(object sender, EventArgs e)
 {
     if (AssignBTN.Text.Equals("ASSIGN"))
     {
         var view = new SchedAssignGuards {
             Rid            = Raid,
             NumberOfGuards = _numGuards,
             Refer          = this,
             ClientName     = ClientLBL.Text,
             Location       = Location,
             ContractStart  = _contractStart,
             ContractEnd    = _contractEnd
         };
         view.ShowDialog();
     }
     else
     {
         Scheduling.UpdateRequestStatus(Raid, Enumeration.RequestStatus.Approved, Login.LoggedInUser);
         AssignBTN.Text     = "ASSIGN";
         AssignBTN.Location = new Point(220, 411);
         StatusLBL.Text     = "Status: Approved";
         DeclineBTN.Visible = false;
         RefreshData();
     }
 }
示例#4
0
        private void ConfirmBTN_Click(object sender, EventArgs e)
        {
            if (NumberOfGuards < _gidS.Length)
            {
                var rs = RylMessageBox.ShowDialog(
                    "The number of guards you've assigned is \n more than what the client requested \n Continue?",
                    "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                if (rs == DialogResult.Yes)
                {
                    Scheduling.AddAssignment(Rid, _gidS);
                    Close();
                    Refer.Close();
                }
            }
            else if (NumberOfGuards > _gidS.Length)
            {
                var rs = RylMessageBox.ShowDialog("The number of guards you've assigned is not enough. Do you still want to assign the selected guards?", "Warning",
                                                  MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                if (rs == DialogResult.Yes)
                {
                    Scheduling.AddAssignment(Rid, _gidS);
                    Close();
                    Refer.Close();
                }
            }
            else
            {
                Scheduling.AddAssignment(Rid, _gidS);
                Close();
                Refer.Close();
            }

            RylMessageBox.ShowDialog("The guards selected are now assigned to the clients.", "Assign Guards",
                                     MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
示例#5
0
 private void DeclineBTN_Click(object sender, EventArgs e)
 {
     Scheduling.DeclineRequest(Rid);
     ApproveBTN.Visible = false;
     DeclineBTN.Visible = false;
     RefreshData();
     Reference.SchedRefreshRequests();
 }
示例#6
0
 private void DeclineBTN_Click(object sender, EventArgs e)
 {
     Scheduling.DeclineRequest(Raid);
     AssignBTN.Visible    = false;
     DeclineBTN.Visible   = false;
     AvailablePNL.Visible = false;
     StatusLBL.Text       = "Status: Declined";
     RefreshData();
 }
示例#7
0
        public void RefreshData()
        {
            PeriodCMBX.Items.Clear();
            if (!Name.Equals("Archived"))
            {
                var dt = Scheduling.GetAllAssignmentDetails(Aid);
                NameLBL.Text      = dt.Rows[0][2].ToString().Split(',')[0] + ",";
                FirstNameLBL.Text = dt.Rows[0][2].ToString().Split(',')[1];
                ClientLBL.Text    = dt.Rows[0][3].ToString();

                foreach (DataRow row in Attendance.GetPeriods(Gid).Rows)
                {
                    PeriodCMBX.Items.Add(new ComboBoxDays(int.Parse(row["month"].ToString()),
                                                          int.Parse(row["period"].ToString()), int.Parse(row["year"].ToString())));
                }
                if (PeriodCMBX.Items.Count > 0)
                {
                    PeriodCMBX.SelectedIndex = 0;
                }
            }
            else
            {
                var dt = Archiver.GetAllAssignmentDetails(Aid);
                NameLBL.Text      = dt.Rows[0][2].ToString().Split(',')[0] + ",";
                FirstNameLBL.Text = dt.Rows[0][2].ToString().Split(',')[1];
                ClientLBL.Text    = dt.Rows[0][3].ToString();


                foreach (DataRow row in Archiver.GetPeriods(Gid).Rows)
                {
                    PeriodCMBX.Items.Add(new ComboBoxDays(int.Parse(row["month"].ToString()),
                                                          int.Parse(row["period"].ToString()), int.Parse(row["year"].ToString())));
                }
                if (PeriodCMBX.Items.Count > 0)
                {
                    PeriodCMBX.SelectedIndex = 0;
                }
            }
            if (DutyDetailsGRD.Rows.Count == 0)
            {
                ErrorPNL.Visible = true;
                ErrorPNL.BringToFront();
            }
            else
            {
                ErrorPNL.Visible = false;
            }
        }
示例#8
0
 public void RefreshCurrent()
 {
     if (!Name.Equals("Archived"))
     {
         var dt = Scheduling.GetAssignmentDetails(Aid);
         LocationLBL.Text = dt.Rows[0][0].ToString();
         StartLBL.Text    = dt.Rows[0][1].ToString().Split(' ')[0];
         EndLBL.Text      = dt.Rows[0][2].ToString().Split(' ')[0];
     }
     else
     {
         var dt = Archiver.GetAssignmentDetails(Aid);
         LocationLBL.Text = dt.Rows[0][0].ToString();
         StartLBL.Text    = dt.Rows[0][1].ToString().Split(' ')[0];
         EndLBL.Text      = dt.Rows[0][2].ToString().Split(' ')[0];
     }
 }
示例#9
0
        private void RefreshAvailable()
        {
            AvailableGRD.Rows.Clear();
            var dt = Scheduling.GetUnassignedGuards(_extraQueryParams, ContractStart, ContractEnd);

            foreach (DataRow row in dt.Rows)
            {
                if (!_gidS.Contains(int.Parse(row[0].ToString())))
                {
                    AvailableGRD.Rows.Add(row[0], row[1], row[2]);
                }
            }
            AvailableGRD.Columns[0].Visible    = false;
            AvailableGRD.Columns[1].HeaderText = "NAME";
            AvailableGRD.Columns[1].Width      = 200;
            AvailableGRD.Columns[2].HeaderText = "LOCATION";
            AvailableGRD.Columns[2].Width      = 240;
        }
示例#10
0
        private void DismissBTN_Click(object sender, EventArgs e)
        {
            if (DataValidation())
            {
                var giDs = new int[GuardsGRD.RowCount];
                for (var i = 0; i < GuardsGRD.RowCount; i++)
                {
                    giDs[i] = int.Parse(GuardsGRD.Rows[i].Cells[0].Value.ToString());
                }

                if (EnableIncidentCHKBX.Checked)
                {
                    Scheduling.AddUnassignmentRequest(Cid, giDs, IncidentTypeCMBX.SelectedIndex, Login.UserName,
                                                      DateDTPKR.Value,
                                                      LocationBX.Text.Replace("'", string.Empty), DescriptionBX.Text.Replace("'", string.Empty),
                                                      DateEffective.Value);

                    try {
                        _iid = int.Parse(SQLTools.getLastInsertedId("IncidentReport", "IID"));
                    }
                    catch { }
                    try {
                        foreach (DataGridViewRow row in DepsGRD.Rows)
                        {
                            InsertDependent(GetRelationshipIndex(row.Cells[4].Value.ToString()),
                                            row.Cells[1].Value.ToString().Replace("'", string.Empty),
                                            row.Cells[2].Value.ToString().Replace("'", string.Empty),
                                            row.Cells[3].Value.ToString().Replace("'", string.Empty));
                        }
                    }
                    catch { }
                }
                else
                {
                    Scheduling.AddUnassignmentRequestNoIncident(Cid, giDs, DateEffective.Value);
                }
                RylMessageBox.ShowDialog("Your Request has been added", "Request Added", MessageBoxButtons.OK,
                                         MessageBoxIcon.Information);
                Reference.SchedLoadSidePnl();
                Close();
            }
        }
示例#11
0
        public void RefreshDutyDetails()
        {
            DutyDetailsGRD.DataSource = Name.Equals("Archived")
                ? Archiver.GetDutyDetailsSummary(Aid)
                : Name.Equals("History") ? Scheduling.GetDutyDetailsSummaryHistory(Aid): Scheduling.GetDutyDetailsSummary(Aid);
            DutyDetailsGRD.Columns[0].Visible    = false;
            DutyDetailsGRD.Columns[1].HeaderText = "TIME-IN";
            DutyDetailsGRD.Columns[2].HeaderText = "TIME-OUT";
            DutyDetailsGRD.Columns[3].HeaderText = "DAYS";
            DutyDetailsGRD.Columns[4].HeaderText = "EFFECTIVE";
            DutyDetailsGRD.Columns[5].HeaderText = "DISMISSED";

            DutyDetailsGRD.Columns[1].Width = 95;
            DutyDetailsGRD.Columns[2].Width = 95;
            DutyDetailsGRD.Columns[3].Width = 95;
            DutyDetailsGRD.Columns[4].Width = 100;
            DutyDetailsGRD.Columns[5].Width = 100;

            DutyDetailsGRD.Select();
        }
示例#12
0
        private void LoadData() {
            try {
                var data = Scheduling.GetIncidentReport(Rid);
                if (data.Rows[0][0].ToString().Equals("")) {
                    RylMessageBox.ShowDialog("No Incident Report found", "Incident Report", MessageBoxButtons.OK,
                        MessageBoxIcon.Information);
                    Close();
                }
                TypeDateLBL.Text = "Type: " + data.Rows[0][0] + "          Event Date: " + data.Rows[0][1];
                LocationLBL.Text = data.Rows[0][2].ToString();
                DescriptionBX.Text = data.Rows[0][3].ToString();

                CertifiersGRD.DataSource = Scheduling.GetIncidentInvolved(Rid);
                CertifiersGRD.Columns[0].Width = 270;
                CertifiersGRD.Columns[1].Width = 100;
            }
            catch (Exception ex) {
                Console.WriteLine(ex.Message);
            }
        }
示例#13
0
        private void RefreshData()
        {
            var dt = Scheduling.GetUnassignmentRequestDetails(Rid);

            ClientLBL.Text = dt.Rows[0][0].ToString();

            if (dt.Rows[0][1].ToString().Equals("Approved"))
            {
                ApproveBTN.Visible    = false;
                DeclineBTN.Visible    = false;
                NameLBL.Text          = "Guards Unassigned";
                DateEffectiveLBL.Text = "Date Effective: " + dt.Rows[0]["dateeffective"];
                ApprovedByLBL.Text    = "Approved by: " + dt.Rows[0]["uname"];
            }
            else if (dt.Rows[0][1].ToString().Equals("Pending"))
            {
                if (Login.AccountType != 2)
                {
                    ApproveBTN.Visible = true;
                    DeclineBTN.Visible = true;
                }
                DateEffectiveLBL.Text = "Date Effective: " + dt.Rows[0]["dateeffective"];
                ApprovedByLBL.Text    = "Approved by: " + dt.Rows[0]["uname"];
            }
            else
            {
                ApproveBTN.Visible       = false;
                DeclineBTN.Visible       = false;
                NameLBL.Text             = "Declined Request to Unassign";
                DateEffectiveLBL.Visible = false;
                ApprovedByLBL.Text       = "Declined by: " + dt.Rows[0]["uname"];
            }

            AssignedGRD.DataSource         = Scheduling.GetGuardsToBeUnassigned(Rid);
            AssignedGRD.Columns[0].Visible = false;
            AssignedGRD.Columns[1].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            AssignedGRD.Columns[1].Width     = 400;
            AssignedGRD.ColumnHeadersVisible = false;
        }
示例#14
0
 private void AddBTN_Click(object sender, EventArgs e)
 {
     if (DataValidation())
     {
         if (_cid.Equals("-1"))
         {
             RylMessageBox.ShowDialog("Please select a client", "Request a guard", MessageBoxButtons.OK,
                                      MessageBoxIcon.Error);
         }
         else
         {
             Scheduling.AddAssignmentRequest(int.Parse(_cid), AssStreetNoBX.Text.Replace("'", string.Empty), AssStreetNameBX.Text.Replace("'", string.Empty),
                                             AssBrgyBX.Text.Replace("'", string.Empty), AssCityBX.Text.Replace("'", string.Empty), ContractStartDTPKR.Value, ContractEndDTPKR.Value,
                                             (int)NeededBX.Value);
             Reference.SchedLoadPage();
             RylMessageBox.ShowDialog("Your request is now pending for approval",
                                      "Request Added",
                                      MessageBoxButtons.OK, MessageBoxIcon.Information
                                      );
             Close();
         }
     }
 }
示例#15
0
        private void Sched_AddDutyDetail_Load(object sender, EventArgs e)
        {
            FadeTMR.Start();
            AddBTN.Text = Button;
            if (Button.Equals("ADD"))
            {
                TimeInHrBX.SelectedIndex    = 0;
                TimeInMinBX.SelectedIndex   = 0;
                TimeInAMPMBX.SelectedIndex  = 0;
                TimeOutAMPMBX.SelectedIndex = 0;
                TimeOutHrBX.SelectedIndex   = 0;
                TimeOutMinBX.SelectedIndex  = 0;
                DateDismissedCheck.Checked  = true;
                DateDismissed.MaxDate       = MaxDate;
                DateDismissed.MinDate       = MinDate;
                DateEffective.MinDate       = MinDate;
                DateEffective.MaxDate       = MaxDate;
            }
            else
            {
                DateDismissed.MaxDate = MaxDate;
                DateDismissed.MinDate = MinDate;
                DateEffective.MinDate = MinDate;
                DateEffective.MaxDate = MaxDate;

                var dt = Scheduling.GetDutyDetailsDetails(Did);
                TimeInHrBX.SelectedIndex   = int.Parse(dt.Rows[0][0].ToString()) - 1;
                TimeInMinBX.SelectedIndex  = int.Parse(dt.Rows[0][1].ToString());
                TimeInAMPMBX.Text          = dt.Rows[0][2].ToString();
                TimeOutHrBX.SelectedIndex  = int.Parse(dt.Rows[0][3].ToString()) - 1;
                TimeOutMinBX.SelectedIndex = int.Parse(dt.Rows[0][4].ToString());
                TimeOutAMPMBX.Text         = dt.Rows[0][5].ToString();
                DateEffective.Value        = DateTime.Parse(dt.Rows[0][6].ToString());

                if (DateTime.Parse(dt.Rows[0][7].ToString()).Year != 9999)
                {
                    DateDismissed.Value        = DateTime.Parse(dt.Rows[0][7].ToString());
                    DateDismissedCheck.Checked = true;
                }

                var temp = Scheduling.GetDays(Did).Value;
                if (temp[0])
                {
                    MBTN.PerformClick();
                }
                if (temp[1])
                {
                    TBTN.PerformClick();
                }
                if (temp[2])
                {
                    WBTN.PerformClick();
                }
                if (temp[3])
                {
                    ThBTN.PerformClick();
                }
                if (temp[4])
                {
                    FBTN.PerformClick();
                }
                if (temp[5])
                {
                    SaBTN.PerformClick();
                }
                if (temp[6])
                {
                    SuBTN.PerformClick();
                }

                FormLBL.Text = "Edit Duty Detail";
            }
        }
示例#16
0
 private void AddBTN_Click(object sender, EventArgs e)
 {
     if (DataValidation())
     {
         if (Button.Equals("ADD"))
         {
             var res = Scheduling.AddDutyDetail(Aid, TimeInHrBX.Text, TimeInMinBX.Text, TimeInAMPMBX.Text,
                                                TimeOutHrBX.Text, TimeOutMinBX.Text, TimeOutAMPMBX.Text,
                                                new Scheduling.Days(_dutyDays[1], _dutyDays[2], _dutyDays[3], _dutyDays[4], _dutyDays[5],
                                                                    _dutyDays[6], _dutyDays[0]), DateEffective.Value, DateDismissedCheck.Checked ? DateDismissed.Value : new DateTime(9999, 12, 31));
             if (res.Equals(">"))
             {
                 HoursTLTP.ToolTipTitle = "Duty Details";
                 HoursTLTP.Show("The specified schedule overlaps one of the current duty details.", HoursLBL, 2000);
             }
             else
             {
                 Refer.LoadPage();
                 CloseBTN.Tag = "1";
                 Close();
             }
         }
         else if (Button.Equals("UPDATE") && RylMessageBox.ShowDialog("Editing this Duty Details will reset all connected attendance records.\nAre you sure you want to continue?", "Update Duty Details", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
         {
             var res = Scheduling.UpdateDutyDetail(Did, TimeInHrBX.Text, TimeInMinBX.Text,
                                                   TimeInAMPMBX.Text,
                                                   TimeOutHrBX.Text, TimeOutMinBX.Text, TimeOutAMPMBX.Text,
                                                   new Scheduling.Days(_dutyDays[1], _dutyDays[2], _dutyDays[3], _dutyDays[4], _dutyDays[5],
                                                                       _dutyDays[6], _dutyDays[0]));
             if (DateDismissedCheck.Checked && DateEffective.Checked)
             {
                 Scheduling.UpdateDutyDetailDates(Did, DateEffective.Value, DateDismissed.Value);
             }
             if (!DateDismissedCheck.Checked)
             {
                 Scheduling.CancelDismissal(Did);
             }
             if (res.Equals("<"))
             {
                 if (RylMessageBox.ShowDialog(
                         "The schedule is less than 8hrs. Do you still want to add the details?", "Duty Hours",
                         MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
                 {
                     Refer.LoadPage();
                     CloseBTN.Tag = "1";
                     Close();
                 }
             }
             else if (res.Equals(">"))
             {
                 if (RylMessageBox.ShowDialog(
                         "The schedule is more than 8hrs. Do you still want to add the details?", "Duty Hours",
                         MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
                 {
                     Refer.LoadPage();
                     CloseBTN.Tag = "1";
                     Close();
                 }
             }
             else if (res.Equals("olap"))
             {
                 HoursTLTP.ToolTipTitle = "Duty Details";
                 HoursTLTP.Show("The specified schedule overlaps one of the current duty details.", HoursLBL, 2000);
             }
             else
             {
                 Refer.LoadPage();
                 CloseBTN.Tag = "1";
                 Close();
             }
         }
     }
 }
示例#17
0
 private void ApproveBTN_Click(object sender, EventArgs e)
 {
     Scheduling.ApproveUnassignment(Rid);
     RefreshData();
     Reference.SchedLoadPage();
 }
示例#18
0
 private void InsertDependent(int type, string first, string middle, string last)
 {
     Scheduling.AddIncidentReportInvolvement(_iid, type, first, middle, last);
 }
示例#19
0
        private void RefreshData()
        {
            var dt = Scheduling.GetAssignmentRequestDetails(Raid);

            ClientLBL.Text        = dt.Rows[0]["name"].ToString();
            PermAddLBL.Text       = "Location: " + dt.Rows[0]["location"];
            _contractStart        = ContractStartLBL.Text = "Contract Start: " + dt.Rows[0]["contractstart"];
            _contractEnd          = ContractEndLBL.Text = "Contract End: " + dt.Rows[0]["contractend"];
            _numGuards            = int.Parse(dt.Rows[0]["noguards"].ToString());
            NoLBL.Text            = "Guards Needed: " + _numGuards;
            UnassignedPNL.Visible = false;
            if (dt.Rows[0]["rstatus"].ToString().Equals(Enumeration.RequestStatus.Pending.ToString()))
            {
                AssignBTN.Text = "APPROVE";
                StatusLBL.Text = "Status: Pending";
                if (Login.AccountType == 2)
                {
                    AssignBTN.Visible  = false;
                    DeclineBTN.Visible = false;
                }
                ApprovedBy.Visible = false;
            }
            else if (dt.Rows[0]["rstatus"].ToString().Equals(Enumeration.RequestStatus.Approved.ToString()))
            {
                AssignBTN.Text     = "ASSIGN";
                StatusLBL.Text     = "Status: Approved";
                AssignBTN.Location = new Point(220, 411);
                if (Login.AccountType == 2)
                {
                    AssignBTN.Visible = false;
                }
                DeclineBTN.Visible = false;
                ApprovedBy.Text    = "Approved by: " + dt.Rows[0]["uname"];
            }
            else
            {
                AssignBTN.Visible    = false;
                AvailablePNL.Visible = false;
                DeclineBTN.Visible   = false;
                if (dt.Rows[0]["rstatus"].ToString().Equals(Enumeration.RequestStatus.Active.ToString()))
                {
                    StatusLBL.Text        = "Status: Active";
                    ApprovedBy.Text       = "Approved by: " + dt.Rows[0]["uname"];
                    UnassignedPNL.Visible = true;
                    LoadRequestedGuard();
                }
                else if (dt.Rows[0]["rstatus"].ToString().Equals(Enumeration.RequestStatus.Inactive.ToString()))
                {
                    StatusLBL.Text        = "Status: Inctive";
                    UnassignedPNL.Visible = true;
                    LoadRequestedGuard();
                }
                else if (dt.Rows[0]["rstatus"].ToString().Equals(Enumeration.RequestStatus.Declined.ToString()))
                {
                    StatusLBL.Text  = "Status: Decline";
                    ApprovedBy.Text = "Declined by: " + dt.Rows[0]["uname"];
                }
            }
            NeededLBL.ForeColor = _numGuards > Scheduling.GetNumberOfUnassignedGuards()
                ? Color.Salmon
                : Color.OliveDrab;
            NeededLBL.Text = Scheduling.GetUnassignedGuards("", ContractStartLBL.Text, ContractEndLBL.Text).Rows.Count + " available guards";
        }