Exemple #1
0
        protected void btnEnviarMotivo_Click(object sender, EventArgs e)
        {
            if (!(String.IsNullOrEmpty(TextBox4.Text)))
            {
                tbl_incidentTableAdapter   incident = new tbl_incidentTableAdapter();
                tbl_actionPlanTableAdapter acPlan   = new tbl_actionPlanTableAdapter();
                tbl_bitacoraTableAdapter   bitac    = new tbl_bitacoraTableAdapter();
                int folio = Convert.ToInt32(Request.QueryString["folio"]);
                acPlan.updateStatus(10, Convert.ToInt32(txt_folio0.Text));
                bitac.Insert(DateTime.Now, "plan de acción rechazado", "Motivo: " + TextBox4.Text, "planAccion", folio, 0, Convert.ToString(Session["userName"]));
                bitac.Dispose();
                incident.updateApprove(10, folio);
                incident.Dispose();
                try
                {
                    enviarCorreoRecha(Convert.ToInt32(Request.QueryString["folio"]), txtMotivo.Text);
                }
                catch (Exception ex)
                {
                    lblError.Text = ex.Message;
                }

                Response.Redirect("dash-incidentes.aspx");
            }
            else
            {
            }
        }
Exemple #2
0
        protected void Button3_Click(object sender, EventArgs e)
        {
            if (!(String.IsNullOrEmpty(txtMotivo.Text)))
            {
                tbl_incidentTableAdapter incident = new tbl_incidentTableAdapter();
                tbl_bitacoraTableAdapter bitac    = new tbl_bitacoraTableAdapter();
                int folio = Convert.ToInt32(Request.QueryString["folio"]);
                incident.updateApprove(8, folio);
                bitac.Insert(DateTime.Now, "solicitud rechazada", "Motivo: " + txtMotivo.Text, "incidenteAccidente", folio, 0, Convert.ToString(Session["userName"]));
                bitac.Dispose();
                incident.Dispose();
                try
                {
                    enviarCorreoRecha(Convert.ToInt32(Request.QueryString["folio"]), txtMotivo.Text);
                }
                catch (Exception ex)
                {
                    lblError.Text = ex.Message;
                }

                Response.Redirect("my-reports.aspx");
            }
            else
            {
            }
        }
Exemple #3
0
        private void enviarCorreo(int incid_id)
        {
            int userCreate = 0;

            using (tbl_incidentTableAdapter incident = new tbl_incidentTableAdapter())
            {
                DataTable dtUsuario = new DataTable();
                dtUsuario  = incident.GetIDByFolio(incid_id);
                userCreate = Convert.ToInt32(dtUsuario.Rows[0]["usr_id"]);
                dtUsuario.Dispose();
            }
            string bodytext;

            bodytext = "\nEl reporte  generado con número de folio: " + incid_id + " fue aprobado por su jefe";
            //bodytext = bodytext + "Descripción del evento: " + txt_eventDesc.Text + "\n";
            //bodytext = bodytext + "Clasificación del evento: " + ddl_eventClasif.SelectedItem.Text.ToString() + "\n";
            //bodytext = bodytext + "\nFecha del evento (formato aaaa-mm-dd): " + txt_eventFecha.Text.ToString() + "";
            //bodytext = bodytext + "\n\n Área en donde ocurrio el evento: " + ddl_eventArea.SelectedItem.Text.ToString() + "";
            bodytext = bodytext + "\n Para mayor información conultar en: http://10.240.151.139/pentagono/incidDetail.aspx?folio=" + incid_id + "\n";

            //string to = Convert.ToString(usrInfoTable.Rows[0]["usrInfo_email"]) + ";";
            string[] correos; // = {""};// = { "*****@*****.**", "*****@*****.**" };
            correos = new string[2];
            //correos = new string[1];
            correos[0] = getEmail(Convert.ToInt32(Session["userID"]));
            correos[1] = getEmail(userCreate);

            funcCorreo.enviarCorreo("Fernando Reyes", correos, Convert.ToString(Session["userName"]), bodytext, "Actualización de reporte accidente incidente folio " + incid_id);
        }
Exemple #4
0
        private int getEstatus(int incidentID)
        {
            int status = 0;
            tbl_incidentTableAdapter incid = new tbl_incidentTableAdapter();

            status = Convert.ToInt32(incid.getStatus(Convert.ToInt32(incidentID)));
            incid.Dispose();

            return(status);
        }
Exemple #5
0
        protected void btnAceptar_Click(object sender, EventArgs e)
        {
            tbl_incidentTableAdapter incident = new tbl_incidentTableAdapter();
            tbl_bitacoraTableAdapter bitac    = new tbl_bitacoraTableAdapter();
            int folio = Convert.ToInt32(Request.QueryString["folio"]);

            incident.updateApprove(7, folio);
            bitac.Insert(DateTime.Now, "solicitud aprobada", "", "incidentAccident", folio, 0, Convert.ToString(Session["userName"]));
            bitac.Dispose();
            incident.Dispose();
            enviarCorreo(Convert.ToInt32(Request.QueryString["folio"]));
            Response.Redirect("my-reports.aspx");
        }
Exemple #6
0
        private void enviarCorreoRecha(int incid_id, string motivo)
        {
            int userCreate = 0;

            using (tbl_incidentTableAdapter incident = new tbl_incidentTableAdapter())
            {
                DataTable dtUsuario = new DataTable();
                dtUsuario  = incident.GetIDByFolio(incid_id);
                userCreate = Convert.ToInt32(dtUsuario.Rows[0]["usr_id"]);
                dtUsuario.Dispose();
            }

            //using (tbl_userInfoTableAdapter usrInfo = new tbl_userInfoTableAdapter())
            //{
            //    using (DataSet1.tbl_userInfoDataTable usrInfoTable = new DataSet1.tbl_userInfoDataTable())
            //    {
            //        usrInfo.FillByUserID(usrInfoTable, userCreate);
            //        if (usrInfoTable.Rows[0]["usrInfo_name"].ToString() != "")
            //        {
            string bodytext;

            bodytext  = "Lamentamos informarle que el reporte que usted realizó con folio: " + incid_id + " ha sido rechazado por su jefe";
            bodytext += "por el/los siguiente(s) motivo(s): " + motivo;
            bodytext  = bodytext + "\nRequiere de su revisión y aporabación http://10.240.151.139/pentagono/incidentes.aspx?folio=" + incid_id + "\n";

            //string to = Convert.ToString(usrInfoTable.Rows[0]["usrInfo_email"]) + ";";
            string[] correos;             // = {""};// = { "*****@*****.**", "*****@*****.**" };
            correos = new string[2];
            //correos = new string[1];
            correos[0] = getEmail(userCreate);
            correos[1] = getEmail(Convert.ToInt32(Session["UserID"]));
            //using (tbl_responsablesTableAdapter jefe = new tbl_responsablesTableAdapter())
            //{
            //    using (DataSet1.tbl_responsablesDataTable dtjefe = new DataSet1.tbl_responsablesDataTable())
            //    {
            //        using (tbl_userTableAdapter usr = new tbl_userTableAdapter())
            //        {
            //            int resp = Convert.ToInt32(usr.respIDByUserID(Convert.ToInt32(Session["UserID"])));

            //            jefe.FillByRespID(dtjefe, resp);
            //            //correos[1] = Convert.ToString(dtjefe.Rows[0]["resp_email"]);
            //        }
            //    }
            //}

            funcCorreo.enviarCorreo("Fernando Reyes", correos, "Aspen WebApp", bodytext, "Actualización de reporte accidente incidente folio " + incid_id);
            //    }
            //}
            // }
        }
Exemple #7
0
        protected void btnActualizar_Click(object sender, EventArgs e)
        {
            int folio = Convert.ToInt32(Request.QueryString["folio"]);

            using (tbl_incidentTableAdapter incid = new tbl_incidentTableAdapter())
            {
                incid.updateApprove(6, folio);
            }
            using (tbl_bitacoraTableAdapter bitac = new tbl_bitacoraTableAdapter())
            {
                bitac.Insert(DateTime.Now, "Actualización de reporte", "", "incidentAccident", folio, 0, Convert.ToString(Session["userName"]));
            }
            enviarCorreo(Convert.ToInt32(Request.QueryString["folio"]));
        }
Exemple #8
0
        protected void btnAceptar0_Click(object sender, EventArgs e)
        {
            tbl_actionPlanTableAdapter acPlan   = new tbl_actionPlanTableAdapter();
            tbl_incidentTableAdapter   incident = new tbl_incidentTableAdapter();
            tbl_bitacoraTableAdapter   bitac    = new tbl_bitacoraTableAdapter();
            int folio      = Convert.ToInt32(Request.QueryString["folio"]);
            int actionPlan = Convert.ToInt32(txt_folio0.Text);

            acPlan.updateStatus(11, Convert.ToInt32(txt_folio0.Text));
            bitac.Insert(DateTime.Now, "plan de acción validado", "", "planAcción", folio, actionPlan, Convert.ToString(Session["userName"]));
            bitac.Dispose();
            incident.updateApprove(11, folio);
            incident.Dispose();
            acPlan.Dispose();
            correoSHEupdate(Convert.ToInt32(Request.QueryString["folio"]));
            Response.Redirect("dash-incidentes.aspx");
        }
Exemple #9
0
        protected void btnGuardaInv_Click(object sender, EventArgs e)
        {
            tbl_actionPlanTableAdapter   actionPlan = new tbl_actionPlanTableAdapter();
            tbl_eventActionsTableAdapter evActions  = new tbl_eventActionsTableAdapter();

            DataSet1.tbl_actionPlanDataTable dtActPlan = new DataSet1.tbl_actionPlanDataTable();
            if (grv_acciones.EditIndex > -1)
            {
            }
            if (txt_folio0.Text == "0")
            {
                int actPlan_id = 0;
                int inciID     = Convert.ToInt32(txt_folio.Text);
                actPlan_id = Convert.ToInt32(actionPlan.getMaxActPlan()) + 1;
                actionPlan.Insert(actPlan_id, "", false, 9, 0, inciID, 9);
                actPlan_id = Convert.ToInt32(actionPlan.getMaxActPlan());

                evActions.updateActPlan(actPlan_id, Convert.ToInt32(txt_folio.Text));

                tbl_bitacoraTableAdapter bitac = new tbl_bitacoraTableAdapter();
                bitac.Insert(DateTime.Now, "plan de acción creado", "", "investigación", Convert.ToInt32(txt_folio.Text), 0, Convert.ToString(Session["userName"]));
                correoSHE(Convert.ToInt32(txt_folio.Text));
            }
            else
            {
                actionPlan.updateStatus(9, Convert.ToInt32(txt_folio0.Text));
                tbl_bitacoraTableAdapter bitac = new tbl_bitacoraTableAdapter();
                bitac.Insert(DateTime.Now, "se ha actualizado el plan de acción", "", "investigación", Convert.ToInt32(txt_folio.Text), 0, Convert.ToString(Session["userName"]));
                correoSHEupdate(Convert.ToInt32(txt_folio.Text));
            }
            tbl_incidentTableAdapter incident = new tbl_incidentTableAdapter();
            int folio = Convert.ToInt32(Request.QueryString["folio"]);

            incident.updateApprove(9, folio);

            actionPlan.Dispose();
            evActions.Dispose();
            dtActPlan.Dispose();
            Response.Redirect("dash-incidentes.aspx");
        }
Exemple #10
0
        private void mail(int incid_id, string area, string clasif, string desc, string fecha, string estatus, string user, int areaID)
        {
            string bodytext;
            string involucrados = "";

            tbl_personEventTableAdapter involuc = new tbl_personEventTableAdapter();

            DataSet1.tbl_personEventDataTable tblinvoluc = new DataSet1.tbl_personEventDataTable();
            involuc.FillByIncid(tblinvoluc, user, incid_id);

            for (int i = 0; i <= tblinvoluc.Rows.Count - 1; i++)
            {
                if (!(String.IsNullOrEmpty(Convert.ToString(tblinvoluc.Rows[i]["perEvent_numEmploy"]))))
                {
                    involucrados += "No. empleado: " + tblinvoluc.Rows[i]["perEvent_numEmploy"] + " \n\n";
                }
                involucrados += "Nombre de la persona: " + tblinvoluc.Rows[i]["perEvent_name"] + " \n ";
                involucrados += "Empresa: " + tblinvoluc.Rows[i]["perEvent_company"] + " \n ";
                involucrados += "Area funcional: " + tblinvoluc.Rows[i]["area_id"] + " \n\n ";
            }
            involuc.Dispose();
            tblinvoluc.Dispose();

            tbl_incidentTableAdapter incid = new tbl_incidentTableAdapter();
            tbl_statusTableAdapter   stat  = new tbl_statusTableAdapter();

            bodytext = "\nPor medio del presente se notifica que ha ocurrido un accidente no." + incid_id + " del día " + fecha + " \n";
            bodytext = bodytext + "\n Area: " + area + "\n";
            bodytext = bodytext + " Clasificación del Incidente: " + clasif + "\n";
            bodytext = bodytext + "\n Descripción del Incidente: " + desc + "\n";
            bodytext = bodytext + "\nPersonal involucrado: " + "" + "";
            bodytext = bodytext + involucrados;
            bodytext = bodytext + "\n Área funcional: " + area + "";
            bodytext = bodytext + "\n Creador del reporte: " + Convert.ToString(Session["userName"]) + "";
            bodytext = bodytext + "\n\n Estatus: " + stat.getEstatusDesc(Convert.ToInt32(incid.getStatus(incid_id))) + "";
            bodytext = bodytext + "\nPara más información, favor de consultar la siguiente liga. \n http://10.240.151.139/pentagono/incidDetail.aspx?folio=" + incid_id + "\n";

            incid.Dispose();
            stat.Dispose();

            //string to = Convert.ToString(usrInfoTable.Rows[0]["usrInfo_email"]) + ";";
            tbl_userInfoTableAdapter usrInfo = new tbl_userInfoTableAdapter();

            DataSet1.tbl_userInfoDataTable tblusrInfo = new DataSet1.tbl_userInfoDataTable();
            usrInfo.FillByArea(tblusrInfo, areaID);

            string[] correos; // = {""};
            int      numCorreos = tblusrInfo.Rows.Count + 1;

            correos    = new string[numCorreos];
            correos[0] = Convert.ToString(Session["email"]);
            for (int j = 1; j <= tblusrInfo.Rows.Count; j++)
            {
                correos[j] = Convert.ToString(tblusrInfo.Rows[j - 1]["usrInfo_email"]);
            }
            //string[] correos; // = {""};
            //correos = new string[2];
            ////correos = new string[1];
            //correos[0] = Convert.ToString(Session["email"]);
            //correos[1] = getEmail(getResponsable(Convert.ToInt32(Session["userID"])));

            try
            {
                lblError.Text = f.enviarCorreoAsync("Fernando Reyes", correos, " ", bodytext, "Reporte incidente/accidente folio " + incid_id);
            }
            catch (Exception ex)
            {
                lblError.Text = ex.Message;
            }
        }
Exemple #11
0
        private void generaActualizaReporte()
        {
            if (grvPersonEvent.EditIndex != -1)
            {
                //lblError.Text ="Sorre";
            }
            //creamos la instancia para la tabla extraida del dataset XSD
            tbl_incidentTableAdapter incidentes = new tbl_incidentTableAdapter();

            if (grvPersonEvent.Rows.Count > 0 && grvInmedActions.Rows.Count > 0)
            {
                btn_reporte.Enabled = true;

                try
                {
                    lbl_errAction.Visible  = false;
                    lbl_errPersona.Visible = false;
                    string   descriptEvento     = txt_eventDesc.Text;
                    DateTime fechaEvento        = Convert.ToDateTime(txt_eventFecha.Text);
                    int      turnoEvento        = Convert.ToInt32(ddl_turno.SelectedValue);
                    int      areaEvento         = Convert.ToInt32(ddl_eventArea.SelectedValue);
                    int      tipoEvento         = Convert.ToInt32(ddlEvents2.SelectedValue);
                    int      placeEvento        = Convert.ToInt32(ddl_eventPlace.SelectedValue);
                    int      tipoEventoHijo     = 0;
                    int      gec                = 0;
                    int      tipoEventoHijoHijo = 0;
                    decimal  serie              = Convert.ToDecimal(generateSerial());
                    //string a = System.Configuration.ConfigurationManager.ConnectionStrings["WingtipToys"].ConnectionString;
                    if (!(DropDownList2.Visible == false || ddlEvCh.SelectedValue == ""))
                    {
                        tipoEventoHijo = Convert.ToInt32(DropDownList2.SelectedValue);
                    }
                    if (!(ddlEvChCh.Visible == false || ddlEvCh.SelectedValue == ""))
                    {
                        tipoEventoHijoHijo = Convert.ToInt32(ddlEvCh.SelectedValue);
                    }
                    if (RadioButtonList1.SelectedIndex == -1)
                    {
                        gec = 0;
                    }
                    else
                    {
                        gec = Convert.ToInt32(RadioButtonList1.SelectedValue);
                    }
                    //mail(0, ddl_eventArea.SelectedItem.Text, ddl_eventClasif.SelectedItem.Text, txt_eventDesc.Text, txt_eventFecha.Text, "Revisión", Session["userName"].ToString(), 5);
                    if ((txt_folio.Text == "0") || txt_folio.Text == "")
                    {
                        //metodo para insertar la información. De momento se toma todo tal cual de los campos
                        int resIncident = incidentes.Insert(descriptEvento, fechaEvento, turnoEvento,
                                                            areaEvento, tipoEvento, tipoEventoHijo, 0, placeEvento,
                                                            serie, 6, gec, Convert.ToInt32(ddl_eventClasif.SelectedValue), Convert.ToInt32(Session["userID"]), DateTime.Now, TimeSpan.Parse(txt_eventHora.Text), Convert.ToString(Session["userName"]));

                        int incid_id = Convert.ToInt32(incidentes.getIncidentIDBySerial(serie));

                        tbl_personEventTableAdapter employeeEvent = new tbl_personEventTableAdapter();
                        int resEmploy = employeeEvent.UpdateIncidID(incid_id, Convert.ToString(Session["userName"]));
                        //employeeEvent.DeleteTempQuery(Convert.ToString(Session["userName"]), incid_id);
                        tbl_inmediateActionTableAdapter actions = new tbl_inmediateActionTableAdapter();
                        int resActions = actions.UpdateIncidID(incid_id, Convert.ToString(Session["userName"]));
                        //actions.DeleteTempQuery(Convert.ToString(Session["userName"]), incid_id);
                        tbl_bitacoraTableAdapter bitac = new tbl_bitacoraTableAdapter();
                        bitac.Insert(DateTime.Now, "reporte creado", "", "incidenteAccidente", incid_id, 0, Convert.ToString(Session["userName"]));
                        bitac.Dispose();
                        //apartado de parametros que conforman el correo electrónico que se despliega
                        //******Descmentar para el servicio de correo electrónico********
                        //mail(incid_id, ddl_eventArea.SelectedItem.Text, ddl_eventClasif.SelectedItem.Text, txt_eventDesc.Text, txt_eventFecha.Text, "Revisión", Session["userName"].ToString(), Convert.ToInt32( ddl_eventArea.SelectedValue));
                        //enviarCorreo(incid_id);
                        //****** fin de correo electronico ****
                        lbl_reportNum.Text = incid_id.ToString();
                    }
                    else
                    {
                        int folio       = Convert.ToInt32(txt_folio.Text);
                        int resIncident = incidentes.Update(descriptEvento, fechaEvento, turnoEvento, areaEvento,
                                                            tipoEvento, tipoEventoHijo, 0, placeEvento, serie, 6, gec, Convert.ToInt32(ddl_eventClasif.SelectedValue),
                                                            Convert.ToInt32(Session["userID"]), Convert.ToDateTime(lblFechaReporte.Text), TimeSpan.Parse(txt_evHora.Text), Convert.ToString(Session["userName"]), folio);
                        mail(folio, ddl_eventArea.SelectedItem.Text, ddl_eventClasif.SelectedItem.Text, txt_eventDesc.Text, txt_eventFecha.Text, "Revisión", Session["userName"].ToString(), Convert.ToInt32(ddl_eventArea.SelectedValue));
                        //correoUpdateReport(folio);
                        tbl_bitacoraTableAdapter bitac = new tbl_bitacoraTableAdapter();
                        bitac.Insert(DateTime.Now, "Actualización de reporte", "", "incidenteAccidente", folio, 0, Convert.ToString(Session["userName"]));
                        bitac.Dispose();
                        Response.Redirect("my-reports.aspx");
                    }
                    hdf_ok_ModalPopupExtender.Show();
                    //una vez generado el registro de incidente vamos a buscar el ID para relacionar empleados y acciones inmediatas
                    //int incid_id = Convert.ToInt32(incidentes.GetIDByFolio(Convert.ToInt32(serie)).Rows[0][0]);
                }
                catch (Exception ex)
                {
                    lblError.Text = ex.Message;
                    incidentes.Dispose();
                }
            }
            else
            {
                //Label20.Text = "Es necesario agregar acciones y los involucrados";
                // HttpContext.Current.Response.Write("Es necesario agregar acciones y los involucrados");
                if (grvPersonEvent.Rows.Count == 0)
                {
                    lbl_errPersona.Visible = true;
                }
                else if (grv_acciones.Rows.Count == 0)
                {
                    lbl_errAction.Visible = true;
                }
            }
        }
Exemple #12
0
        private void cargaIncidente(int incidID)
        {
            tbl_incidentTableAdapter incid = new tbl_incidentTableAdapter();

            DataSet1.tbl_incidentDataTable tblIncid = new DataSet1.tbl_incidentDataTable();
            incid.FillByFolio(tblIncid, incidID);
            txt_eventDesc.Text  = Convert.ToString(tblIncid.Rows[0]["incident_desc"]);
            txt_eventFecha.Text = String.Format("{0:dd/MM/yyyy}", Convert.ToDateTime(tblIncid.Rows[0]["incident_date"]));
            string a = String.Format("{0:hh:mm}", tblIncid.Rows[0]["incident_hour"].ToString());

            //txt_eventHora.Text = String.Format("{0:hh:mm}", tblIncid.Rows[0]["incident_hour"].ToString()).Replace(":","");
            txt_evHora.Text             = tblIncid.Rows[0]["incident_hour"].ToString();
            ddl_turno.SelectedValue     = Convert.ToString(tblIncid.Rows[0]["turn_id"]);
            ddl_eventArea.SelectedValue = Convert.ToString(tblIncid.Rows[0]["area_id"]);

            eventID = Convert.ToString(tblIncid.Rows[0]["event_id"]);
            ddlEvents.SelectedValue  = eventID;
            ddlEvents2.SelectedValue = eventID;
            string eventIDAfter  = ddlEvents.SelectedValue;
            string evChildBefore = Convert.ToString(tblIncid.Rows[0]["evChild_id"]);

            muestraEventChild(eventID);
            if (ddlEvCh.Visible == true)
            {
                ddlEvCh.SelectedValue = Convert.ToString(tblIncid.Rows[0]["evChild_id"]);
            }
            if (ddlEvChCh.Visible == true)
            {
                ddlEvChCh.SelectedValue = Convert.ToString(tblIncid.Rows[0]["evGrndChild_id"]);
            }
            ddl_eventPlace.SelectedValue   = Convert.ToString(tblIncid.Rows[0]["evPlace_id"]);
            RadioButtonList1.SelectedValue = Convert.ToString(tblIncid.Rows[0]["gec_id"]);
            ddl_eventClasif.SelectedValue  = Convert.ToString(tblIncid.Rows[0]["evClass_id"]);
            lblFechaReporte.Text           = String.Format("{0:dd/MM/yyyy}", Convert.ToDateTime(tblIncid.Rows[0]["incident_repDate"]));
            int estatus = Convert.ToInt32(tblIncid.Rows[0]["stat_id"]);

            if (estatus == 8)
            {
                btn_accion.Enabled      = true;
                btn_reporte.Enabled     = true;
                btn_addEmployee.Enabled = true;
                lbl_estatus.Text        = "Rechazada";
                lbl_estatus.ForeColor   = System.Drawing.Color.Red;
            }
            else
            {
                btn_accion.Enabled      = true;
                btn_reporte.Enabled     = true;
                btn_addEmployee.Enabled = true;
                grvPersonEvent.Enabled  = true;
                grvInmedActions.Enabled = true;
                if (estatus == 6)
                {
                    lbl_estatus.Text      = "Revisión";
                    lbl_estatus.ForeColor = System.Drawing.Color.Blue;
                }
                if (estatus == 7)
                {
                    lbl_estatus.Text      = "Aprobada";
                    lbl_estatus.ForeColor = System.Drawing.Color.Green;
                    if (Convert.ToInt32(tblIncid.Rows[0]["gec_id"]) == 2)
                    {
                        Panel3.Visible = true;
                    }
                }
            }
            incid.Dispose();
            tblIncid.Dispose();
        }
Exemple #13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int estatus = 0;

            btnRechazada_ModalPopupExtender.Hide();
            tbl_incidentTableAdapter incid = new tbl_incidentTableAdapter();

            estatus = Convert.ToInt32(incid.getStatus(Convert.ToInt32(Request.QueryString["folio"])));
            tbl_statusTableAdapter stat = new tbl_statusTableAdapter();

            Label22.Text = stat.getEstatusDesc(Convert.ToInt32(estatus));
            stat.Dispose();
            incid.Dispose();
            txt_fechaComp_CalendarExtender.StartDate = DateTime.Today;

            if (!Page.IsPostBack)
            {
                if (Session["userID"] == null)
                {
                    Response.Redirect("login.aspx?pag=incidDetail&folio=" + Convert.ToString(Request.QueryString["folio"]));
                }
                if (Convert.ToInt32(Session["userRol"]) >= 4 || String.IsNullOrEmpty(Request.QueryString["folio"]) || Request.QueryString["folio"] == null)
                {
                    btnAceptar.Visible   = false;
                    btnRechazada.Visible = false;
                    pnl_motivo.Visible   = false;
                }
                if (!(Request.QueryString["folio"] == null))
                {
                    txt_folio.Text  = Request.QueryString["folio"];
                    txt_folio0.Text = Convert.ToString(getPlanAccion(Convert.ToInt32(txt_folio.Text)));
                }
            }
            if (estatus == 6)
            {
                //FormView1.DefaultMode = FormViewMode.Edit;
                btnActualizar.Visible            = false;
                btnAceptar.Visible               = true;
                btnRechazada.Visible             = true;
                FormView1.Enabled                = false;
                GridView1.AutoGenerateEditButton = false;
                GridView4.AutoGenerateEditButton = false;
                GridView1.Enabled                = false;
                GridView4.Enabled                = false;
                Panel3.Visible    = false;
                Panel2.Visible    = false;
                Label22.ForeColor = System.Drawing.Color.Blue;
            }
            else if (estatus == 7)
            {
                btnActualizar.Visible            = false;
                btnAceptar.Visible               = false;
                btnRechazada.Visible             = false;
                FormView1.Enabled                = false;
                GridView1.AutoGenerateEditButton = false;
                GridView4.AutoGenerateEditButton = false;
                GridView1.Enabled                = false;
                GridView4.Enabled                = false;
                pnl_motivo.Visible               = false;
                Label22.ForeColor                = System.Drawing.Color.Green;
                Panel3.Visible = true;
                int actPlanNum    = getPlanAccion(Convert.ToInt32(txt_folio.Text));
                int actPlanStatus = getPlanActStatus(actPlanNum);
            }
            else if (estatus == 8)
            {
                btnActualizar.Visible = true;
                btnAceptar.Visible    = false;
                btnRechazada.Visible  = false;
                pnl_motivo.Visible    = false;
                Panel3.Visible        = false;
                Panel2.Visible        = false;
                Label22.ForeColor     = System.Drawing.Color.Red;
            }
            else if (Convert.ToInt32(Session["userRol"]) > 2)
            {
                btnAceptar0.Visible   = false;
                btnRechazada0.Visible = false;
                Panel2.Visible        = false;
                pnlBotones.Visible    = false;
                if (estatus == 9)
                {
                    /* Revisar si se puede modificar despues de guardar */
                    //grv_acciones.Enabled = false;
                    //grv_causa.Enabled = false;
                    //btn_addCausa.Enabled = false;
                    //btn_save.Enabled = false;
                    //btnGuardaInv.Enabled = false;
                    lblEstatusPlan.Text = "Revisión";
                    Label22.ForeColor   = System.Drawing.Color.Blue;
                    FormView1.Enabled   = false;
                }
                else if (estatus == 11)
                {
                    btn_addCausa.Enabled = false;
                    btn_save.Enabled     = false;
                    lblEstatusPlan.Text  = "Validado";
                    Label22.ForeColor    = System.Drawing.Color.Green;
                    FormView1.Enabled    = false;
                    Panel5.Visible       = false;
                }
                else if (estatus == 10)
                {
                    lblEstatusPlan.Text = "Rechazada"; Label22.ForeColor = System.Drawing.Color.Red; FormView1.Enabled = false;
                }
            }
            else if (Convert.ToInt32(Session["userRol"]) <= 2)
            {
                pnlBotones.Visible   = false;
                btnGuardaInv.Visible = false;
                FormView1.Enabled    = false;
                GridView1.Enabled    = false;
                GridView4.Enabled    = false;
                if (estatus == 11)
                {
                    btn_addCausa.Enabled  = false;
                    btn_save.Enabled      = false;
                    lblEstatusPlan.Text   = "Validado";
                    Label22.ForeColor     = System.Drawing.Color.Green;
                    btnRechazada0.Visible = false;
                    btnAceptar0.Visible   = false;
                    pnl_motivo.Visible    = false;
                    Panel2.Visible        = false;
                    grv_causa.Enabled     = false;
                    FormView1.Enabled     = false;
                }
                else if (estatus == 10)
                {
                    btnRechazada0.Visible = false;
                    btnAceptar0.Visible   = false;
                    Panel2.Visible        = false;
                    lblEstatusPlan.Text   = "Rechazado por validación";
                    Label22.ForeColor     = System.Drawing.Color.Red;
                    FormView1.Enabled     = false;
                }
                else if (estatus == 9)
                {
                    lblEstatusPlan.Text = "Por Validar"; Label22.ForeColor = System.Drawing.Color.Blue; FormView1.Enabled = false;
                }
            }
        }