protected void btnEditar_Click(object sender, EventArgs e) { int periodoID = int.Parse(dllPeriodos.SelectedValue); peridoTable = ClassPeriodo.BuscarIdPerido(periodoID); //obtener systemdate DateTime datesystem = System.DateTime.Now; //string date = dd.ToString("dd/MM/yyyy"); if (datesystem > Convert.ToDateTime(peridoTable.PerFechaFin)) { mensaje = "Fecha :" + datesystem.ToString("d") + " pertenece a otro Periodo"; ScriptManager.RegisterStartupScript(Page, Page.GetType(), "confirm", "MensajeError('" + mensaje + "');", true); ClientScript.RegisterStartupScript(this.GetType(), "", " setTimeout('window.location.href = window.location.href', 3000);", true); } else { int periodo = Convert.ToInt32(dllPeriodos.SelectedValue); if (periodo != 0) { String Strperiodo = "Periodo=" + periodo + "&"; String Ruta = Strperiodo + hd1.Value; Session["Categoria"] = 1; Response.Redirect("PM_StartEvaluacion.aspx?" + Ruta); } } }
protected void BtnEliminar_Click(object sender, EventArgs e) { try { OCKO_TblPeriodo PeriodoLocal = classPeriodo.BuscarIdPerido(Convert.ToInt32(hdId.Value)); classPeriodo.eliminarPeriodo(PeriodoLocal); mensaje = " " + PeriodoLocal.PerPeriodo + ""; ScriptManager.RegisterStartupScript(Page, Page.GetType(), "confirm", "MensajeEliminar('" + mensaje + "');", true); ClientScript.RegisterStartupScript(this.GetType(), "", " setTimeout('window.location.href = window.location.href', 3000);", true); } catch (Exception ex) { Session["ERROR_RRHH"] = ex; Response.Redirect("RRHH_ERROR.aspx"); } }
protected void dllPeriodos_SelectedIndexChanged(object sender, EventArgs e) { int periodoID = int.Parse(dllPeriodos.SelectedValue); peridoTable = ClassPeriodo.BuscarIdPerido(periodoID); //obtener systemdate DateTime datesystem = System.DateTime.Now; //string date = dd.ToString("dd/MM/yyyy"); if (datesystem > Convert.ToDateTime(peridoTable.PerFechaFin)) { mensaje = "Fecha :" + datesystem.ToString("d") + " pertenece a otro Periodo"; ScriptManager.RegisterStartupScript(Page, Page.GetType(), "confirm", "MensajeError('" + mensaje + "');", true); ClientScript.RegisterStartupScript(this.GetType(), "", " setTimeout('window.location.href = window.location.href', 3000);", true); } }
protected void btnEditar_Click(object sender, EventArgs e) { try { OCKO_TblPeriodo LocalPerido = classPeriodo.BuscarIdPerido(Convert.ToInt32(hdId.Value)); LocalPerido.PerPeriodo = txtNombreEdit.Text; LocalPerido.PerDescripcion = txtDescripcionEdit.Text; LocalPerido.PerFechaInicio = Convert.ToDateTime(dateFechaInicioEdit.Text).Date; LocalPerido.PerFechaFin = Convert.ToDateTime(datefinEdit.Text).Date; classPeriodo.EditarPeriodo(LocalPerido); mensaje = LocalPerido.PerPeriodo; ScriptManager.RegisterStartupScript(Page, Page.GetType(), "confirm", "MensajeEditado('" + mensaje + "');", true); ClientScript.RegisterStartupScript(this.GetType(), "", " setTimeout('window.location.href = window.location.href', 3000);", true); } catch (Exception ex) { Session["ERROR_RRHH"] = ex; Response.Redirect("RRHH_ERROR.aspx"); } }
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) { string id; DateTime fechaIncio, FechaFin; pnlBotones.Visible = true; try { GridViewRow row = GridView1.SelectedRow; id = row.Cells[1].Text; hdId.Value = id; OCKO_TblPeriodo periodo = classPeriodo.BuscarIdPerido(Convert.ToInt32(hdId.Value)); txtNombreEdit.Text = periodo.PerPeriodo; txtDescripcionEdit.Text = periodo.PerDescripcion; dateFechaInicioEdit.Text = Convert.ToDateTime(periodo.PerFechaInicio).ToString("d");// String.Format("{0:dd/MM/yyyy}", periodo.PerFechaInicio); datefinEdit.Text = Convert.ToDateTime(periodo.PerFechaFin).ToString("d"); } catch (Exception ex) { Session["ERROR_RRHH"] = ex; Response.Redirect("RRHH_ERROR.aspx"); } }
//GuArdar public void GuardarPeriodo(OCKO_TblPeriodo Periodo) { OckoDc.OCKO_TblPeriodo.InsertOnSubmit(Periodo); OckoDc.SubmitChanges(); }
//Editar public void EditarPeriodo(OCKO_TblPeriodo Periodo) { OckoDc.SubmitChanges(); }
//Eliminar public void eliminarPeriodo(OCKO_TblPeriodo Periodo) { OckoDc.OCKO_TblPeriodo.DeleteOnSubmit(Periodo); //comand.Tbl_Persona.DeleteOnSubmit(Evaluacion.Tbl_Persona); OckoDc.SubmitChanges(); }