Example #1
0
        protected void addPersonTemporal()
        {
            tbl_personEventTableAdapter persona = new tbl_personEventTableAdapter();
            int    tipo, clase, area, noEmpleado;
            string company, nombre, tiempo;

            tipo  = Convert.ToInt32(ddl_tipoPersonal.SelectedValue);
            clase = Convert.ToInt32(ddl_classPersonal.SelectedValue);
            area  = Convert.ToInt32(ddl_personArea.SelectedValue);
            if (String.IsNullOrEmpty(txt_numEmployee.Text))
            {
                noEmpleado = 0;
            }
            else
            {
                noEmpleado = Convert.ToInt32(txt_numEmployee.Text);
            }
            company = txt_company.Text;
            nombre  = txt_nombreEmployee.Text;
            tiempo  = txt_antique.Text;
            int folio = Convert.ToInt32(txt_folio.Text);

            persona.Insert(company, nombre, tiempo, tipo, clase, folio, area, Convert.ToString(Session["userName"]), noEmpleado);

            persona.Dispose();
        }
Example #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                lblFechaReporte.Text = String.Format("{0:dd/MM/yyyy}", Convert.ToString(DateTime.Today));
                if (Session["userID"] == null)
                {
                    Response.Redirect("login.aspx?pag=incidentes");
                }
                txt_eventFecha_CalendarExtender.EndDate    = DateTime.Today;
                txt_fechaAccion_CalendarExtender.StartDate = DateTime.Today;
                tbl_personEventTableAdapter     perEvent = new tbl_personEventTableAdapter();
                tbl_inmediateActionTableAdapter inAction = new tbl_inmediateActionTableAdapter();

                perEvent.DeleteTempQuery(Session["userName"].ToString(), 0);

                inAction.DeleteTempQuery(Session["userName"].ToString(), 0);

                if (Request.QueryString["folio"] == null)
                {
                    txt_folio.Text     = "0";
                    btn_reporte.Text   = "Generar Reporte";
                    txt_evHora.Visible = false;
                    //if (Convert.ToInt32(Session["userRol"]) > 3)
                    //{
                    Panel3.Visible = false;
                    //}
                }
                else
                {
                    txt_folio.Text        = Convert.ToString(Request.QueryString["folio"]);
                    txt_eventHora.Visible = false;
                    cargaIncidente(Convert.ToInt32(Request.QueryString["folio"]));
                    btn_reporte.Text = "Actualizar reporte";
                    Panel3.Visible   = false;
                    pnl_ok.Visible   = false;
                }
            }
        }
Example #3
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;
            }
        }
Example #4
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;
                }
            }
        }