예제 #1
0
        // Created By PVMS
        // Get Details of Car
        public void GetCarDetails(int id)
        {
            try
            {
                ActMonitorModel actmonitormodel = new ActMonitorModel();
                ActMonitor      actmonitor      = actmonitormodel.RetrieveData(id);

                ddlNetworkGrid.SelectedValue = actmonitor.Network_Grid_BA.ToString();
                SetNetworkBusinessDMZ(actmonitor);

                txtRemarks.Text      = actmonitor.Remarks__Comments;
                txtLocation.Text     = actmonitor.Location;
                txtBrgy.Text         = actmonitor.Affected_Barangay_s_;
                txtMunicipality.Text = actmonitor.Affected_Municipality;
                txtMRU.Text          = actmonitor.List_of_Affected_MRUs;
                txtDMA.Text          = actmonitor.List_of_Affected_DMAs;
                txtHousehold.Text    = actmonitor.Number_of_Affected_Households.ToString();

                SetClassificationEvent(actmonitor);

                ddlEquip.SelectedValue      = actmonitor.Equipment__Appurtenance.ToString();
                ddlType.SelectedValue       = actmonitor.Type_of_Equipment_Appurtenance.ToString();
                ddlSize.SelectedValue       = actmonitor.Size.ToString();
                ddlContractor.SelectedValue = actmonitor.Contractor.ToString();
            }
            catch (Exception Err)
            {
                lblError.Visible = true;
                lblError.Text    = Err.ToString();
            }
        }
예제 #2
0
        protected void grvActMonitor_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            int intCarID = Convert.ToInt32(grvActMonitor.DataKeys[e.RowIndex].Value);

            //SqlConnection objConnection = new SqlConnection(connString);
            //SqlCommand cmd = new SqlCommand("DELETE FROM ActMonitor WHERE [CAR Number] = " + intCarID + "", objConnection);
            //objConnection.Open();
            //int temp = cmd.ExecuteNonQuery();
            //if (temp == 1)
            //{
            //    lblErr.Text = "Record deleted successfully";
            //}
            //objConnection.Close();
            try
            {
                ActMonitorModel objActMonitorModel = new ActMonitorModel();
                objActMonitorModel.DeleteIncident(intCarID);
                grvActMonitor.PageIndex  = 0;
                grvActMonitor.DataSource = BindMonitoring();
                grvActMonitor.DataBind();
            }
            catch (Exception err)
            {
                lblErr.Text    = "Error is " + err.ToString();
                lblErr.Visible = true;
            }
        }
예제 #3
0
        //Created by PS2019
        //Private Method to update Actual Start Date
        private void UpdateActualStartDateTime(DateTime dtActual)
        {
            ActMonitorModel model         = new ActMonitorModel();
            ActMonitor      objActMonitor = new ActMonitor();

            objActMonitor.CAR_Number = Convert.ToInt32(txtCarID.Text);
            objActMonitor.Actual_Date_and_Time_of_Start = dtActual;
            int id = Convert.ToInt32(txtCarID.Text);

            model.UpdateActualStartDateTime(id, Session["UserName"].ToString(), objActMonitor);
        }
예제 #4
0
        /* Written by PS2019*/
        /* Cancel Milestone with Database operation */
        private void CancelMileStone(string _ActualDTServIntrp)
        {
            ActMonitorModel oActMonitorModel = new ActMonitorModel();
            ActMonitor      oActMonitor      = new ActMonitor();

            oActMonitor.CAR_Number = Convert.ToInt32(txtCarID.Text);
            oActMonitor.Actual_Date_and_Time_of_Service_Interruption = _ActualDTServIntrp;
            oActMonitor.Status = "Cancelled";
            oActMonitorModel.CancelActMonitor(Convert.ToInt32(txtCarID.Text), Session["UserName"].ToString(), oActMonitor);
            ViewState["IncidentStatus"] = "Cancelled";
            CancelMileStone();
            grvUpdates.DataBind();
        }
예제 #5
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            ActMonitorModel model = new ActMonitorModel();
            ActMonitor      act   = CreateActMonitor();

            string strMsg = "";

            if (model.InsertActMonitor(act, ref strMsg) == true)
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "Message", "alert('Car details are added sucessfully');window.location.href ='Default.aspx'", true); //window.location ='frmDisplayUsers.aspx';
                //Response.Redirect("~/Default.aspx");
            }
            else
            {
                lblResult.Text = strMsg;
            }
        }
예제 #6
0
        //Created by PS2019
        //Handle RowCommand event for MileStone grid for handling Start/Complete operation
        protected void grdMilestones_RowCommand(Object sender, GridViewCommandEventArgs e)
        {
            int                index           = Convert.ToInt32(e.CommandArgument);
            GridViewRow        row             = grdMilestones.Rows[index];
            CarDetails         objCarDetails   = new CarDetails();
            Details_Milestones objdtlMilestone = new Details_Milestones();
            Button             buttonCancel    = (Button)row.Cells[7].Controls[0];
            Button             buttonControl   = (Button)row.Cells[6].Controls[0];

            if (e.CommandName == "Start")
            {
                switch (((Button)row.Cells[6].Controls[0]).Text)
                {
                case "Cancel":
                    CancelMileStone(row.Cells[2].Text.ToString());
                    break;

                default:
                    if (ViewState["MileStoneStatus"].ToString() != "Complete")
                    {
                        row.Cells[5].Text = "In progress";
                        row.Cells[2].Text = System.DateTime.Now.ToString();
                        row.Cells[4].Text = SetDuration(DateTime.Now, DateTime.Parse(row.Cells[2].Text));
                        ((Button)row.Cells[6].Controls[0]).Text = "Cancel";
                        UpdateMileStone(Convert.ToInt32(row.Cells[0].Text), DateTime.Parse(row.Cells[2].Text), DateTime.Parse("1/1/0001"));
                    }

                    if (index == 0)
                    {
                        UpdateActualStartDateTime(DateTime.Parse(row.Cells[2].Text));
                    }
                    else if (index == 1)
                    {
                        ((Button)grdMilestones.Rows[0].Cells[6].Controls[0]).Text    = "Completed on time";
                        ((Button)grdMilestones.Rows[0].Cells[6].Controls[0]).Enabled = false;
                        grdMilestones.Rows[0].Cells[3].Text = System.DateTime.Now.ToString();
                        grdMilestones.Rows[0].Cells[4].Text = Convert.ToString((DateTime.Parse(grdMilestones.Rows[0].Cells[3].Text) - DateTime.Parse(grdMilestones.Rows[0].Cells[2].Text)).Seconds);
                        SetStatus(DateTime.Parse(grdMilestones.Rows[0].Cells[1].Text), DateTime.Parse(grdMilestones.Rows[0].Cells[2].Text), 0);
                        UpdateMileStone(Convert.ToInt32(grdMilestones.Rows[0].Cells[0].Text), DateTime.Parse(grdMilestones.Rows[0].Cells[2].Text), DateTime.Parse(grdMilestones.Rows[0].Cells[3].Text));
                        grdMilestones.Rows[0].Cells[4].Text = SetDuration(DateTime.Parse(grdMilestones.Rows[0].Cells[3].Text), DateTime.Parse(grdMilestones.Rows[0].Cells[2].Text));
                    }
                    else if (index == 2)
                    {
                        ((Button)grdMilestones.Rows[0].Cells[6].Controls[0]).Text    = "Completed on time";
                        ((Button)grdMilestones.Rows[0].Cells[6].Controls[0]).Enabled = false;
                        ((Button)grdMilestones.Rows[1].Cells[6].Controls[0]).Text    = "Completed on time";
                        ((Button)grdMilestones.Rows[1].Cells[6].Controls[0]).Enabled = false;
                        grdMilestones.Rows[1].Cells[3].Text = System.DateTime.Now.ToString();
                        grdMilestones.Rows[1].Cells[4].Text = Convert.ToString((DateTime.Parse(grdMilestones.Rows[1].Cells[3].Text) - DateTime.Parse(grdMilestones.Rows[1].Cells[2].Text)).Seconds);

                        SetStatus(DateTime.Parse(grdMilestones.Rows[0].Cells[1].Text), DateTime.Parse(grdMilestones.Rows[0].Cells[2].Text), 0);
                        SetStatus(DateTime.Parse(grdMilestones.Rows[1].Cells[1].Text), DateTime.Parse(grdMilestones.Rows[1].Cells[2].Text), 1);
                        UpdateMileStone(Convert.ToInt32(grdMilestones.Rows[1].Cells[0].Text), DateTime.Parse(grdMilestones.Rows[1].Cells[2].Text), DateTime.Parse(grdMilestones.Rows[1].Cells[3].Text));

                        grdMilestones.Rows[0].Cells[4].Text = SetDuration(DateTime.Parse(grdMilestones.Rows[0].Cells[3].Text), DateTime.Parse(grdMilestones.Rows[0].Cells[2].Text));
                        grdMilestones.Rows[1].Cells[4].Text = SetDuration(DateTime.Parse(grdMilestones.Rows[1].Cells[3].Text), DateTime.Parse(grdMilestones.Rows[1].Cells[2].Text));
                    }
                    else if (index == 3)
                    {
                        ((Button)grdMilestones.Rows[0].Cells[6].Controls[0]).Enabled = false;
                        ((Button)grdMilestones.Rows[1].Cells[6].Controls[0]).Enabled = false;
                        ((Button)grdMilestones.Rows[2].Cells[6].Controls[0]).Enabled = false;
                        ((Button)grdMilestones.Rows[3].Cells[6].Controls[0]).Text    = "Complete";

                        SetStatus(DateTime.Parse(grdMilestones.Rows[0].Cells[1].Text), DateTime.Parse(grdMilestones.Rows[0].Cells[2].Text), 0);
                        SetStatus(DateTime.Parse(grdMilestones.Rows[1].Cells[1].Text), DateTime.Parse(grdMilestones.Rows[1].Cells[2].Text), 1);
                        SetStatus(DateTime.Parse(grdMilestones.Rows[2].Cells[1].Text), DateTime.Parse(grdMilestones.Rows[2].Cells[2].Text), 2);

                        if (ViewState["MileStoneStatus"].ToString() == "Complete")
                        {
                            row.Cells[3].Text = System.DateTime.Now.ToString();
                            row.Cells[4].Text = SetDuration(DateTime.Now, DateTime.Parse(row.Cells[2].Text));
                            SetStatus(DateTime.Parse(grdMilestones.Rows[3].Cells[1].Text), DateTime.Parse(grdMilestones.Rows[3].Cells[2].Text), 3);
                            ((Button)grdMilestones.Rows[3].Cells[6].Controls[0]).Enabled = false;
                            buttonCancel.Visible = false;
                            ActMonitorModel model         = new ActMonitorModel();
                            ActMonitor      objActMonitor = new ActMonitor();
                            int             id            = Convert.ToInt32(txtCarID.Text);
                            objActMonitor.CAR_Number = Convert.ToInt32(txtCarID.Text);
                            objActMonitor.Actual_Date_and_Time_of_Completion = DateTime.Parse(System.DateTime.Now.ToString());
                            if ((grdMilestones.Rows[0].Cells[5].Text == "Delayed") || (grdMilestones.Rows[1].Cells[5].Text == "Delayed") ||
                                (grdMilestones.Rows[2].Cells[5].Text == "Delayed") || (grdMilestones.Rows[3].Cells[5].Text == "Delayed"))
                            {
                                objActMonitor.Status = "Delayed";
                            }
                            else
                            {
                                objActMonitor.Status = "Completed on time";
                            }
                            UpdateMileStone(Convert.ToInt32(row.Cells[0].Text), DateTime.Parse(row.Cells[2].Text), DateTime.Parse(System.DateTime.Now.ToString()));
                            model.UpdateActualCompletionDateTime(id, Session["UserName"].ToString(), objActMonitor);
                            grvUpdates.DataBind();
                            disableScreen();
                        }
                        else
                        {
                            buttonCancel.Visible = true;
                            grdMilestones.Rows[2].Cells[3].Text = System.DateTime.Now.ToString();
                            grdMilestones.Rows[2].Cells[4].Text = SetDuration(DateTime.Parse(grdMilestones.Rows[2].Cells[3].Text), DateTime.Parse(row.Cells[2].Text));
                            grdMilestones.Rows[0].Cells[4].Text = SetDuration(DateTime.Parse(grdMilestones.Rows[0].Cells[3].Text), DateTime.Parse(grdMilestones.Rows[0].Cells[2].Text));
                            grdMilestones.Rows[1].Cells[4].Text = SetDuration(DateTime.Parse(grdMilestones.Rows[1].Cells[3].Text), DateTime.Parse(grdMilestones.Rows[1].Cells[2].Text));
                            grdMilestones.Rows[2].Cells[4].Text = SetDuration(DateTime.Parse(grdMilestones.Rows[2].Cells[3].Text), DateTime.Parse(grdMilestones.Rows[2].Cells[2].Text));
                            UpdateMileStone(Convert.ToInt32(grdMilestones.Rows[2].Cells[0].Text), DateTime.Parse(grdMilestones.Rows[2].Cells[2].Text), DateTime.Parse(grdMilestones.Rows[2].Cells[3].Text));
                            ViewState["MileStoneStatus"] = "Complete";
                        }
                    }
                    break;
                }
            }
            else if (e.CommandName == "Cancel")
            {
                CancelMileStone(row.Cells[2].Text.ToString());
            }
            hidTAB.Value = "#tab0default";
        }