protected void addActionsTemporal() { tbl_inmediateActionTableAdapter action = new tbl_inmediateActionTableAdapter(); string persona, inAction; DateTime fechaAc; persona = txt_persona.Text; inAction = txt_accion.Text; fechaAc = Convert.ToDateTime(txt_fechaAccion.Text); int folio = Convert.ToInt32(txt_folio.Text); action.Insert(inAction, fechaAc, persona, folio, Convert.ToString(Session["userName"])); action.Dispose(); }
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; } } }
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; } } }