protected void btnAgregar_Click(object sender, EventArgs e) { if (ddlPersonal.SelectedValue == string.Empty) { string cleanMessage = "Falta indicar personal"; ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true); } else { BL_EQUIPO_RESPONSABLE obj = new BL_EQUIPO_RESPONSABLE(); DataTable dtResultado = new DataTable(); dtResultado = obj.uspSEL_EQUIPO_TRABAJO_ACTIVO(ddlPersonal.SelectedValue.ToString(), 0); if (dtResultado.Rows.Count > 0) { string jefe = dtResultado.Rows[0]["NOMBRE_COMPLETO"].ToString(); string centro = dtResultado.Rows[0]["CC_SUPERVISOR"].ToString(); //string gerencia = dtResultado.Rows[0]["GERENCIA"].ToString(); string cleanMessage = "Personal ya se encuentra asignado en el CC. " + centro + ", responsable " + jefe; ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true); } else { Registrar(); } } }
protected void btnAgregar_Click(object sender, EventArgs e) { string cleanMessage = string.Empty; if (ddlPersonal.SelectedValue == string.Empty) { cleanMessage = "Falta indicar personal responsable"; ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true); } else { int cantidad = 0; foreach (ListItem li in ddlCentro.Items) { if (li.Selected) { string centro = li.Value; //lblCodigo.Text = string.Empty; BE_EQUIPO_RESPONSABLE oBESol = new BE_EQUIPO_RESPONSABLE(); oBESol.IDE_RESPONSABLE = 0; oBESol.DNI_RESPONSABLE = ddlPersonal.SelectedValue.ToString(); oBESol.IP_CENTRO = ddlGerencia.SelectedValue; oBESol.CENTRO = centro; oBESol.FLG_ESTADO = 1; int dtrpta = 0; dtrpta = new BL_EQUIPO_RESPONSABLE().uspINS_EQUIPO_RESPONSABLE(oBESol); if (dtrpta > 0) { cantidad++; CargarTrabajadores(dtrpta, centro); } } } if (cantidad > 0) { ddlPersonal.Text = string.Empty; cleanMessage = "Registro exitoso"; ListarResponsables(); ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true); } else { cleanMessage = "Falta seleccionar centros de costos"; ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true); } } }
//protected void CargarTrabajadores() //{ // BL_EQUIPO_TRABAJO obj = new BL_EQUIPO_TRABAJO(); // DataTable dtResultado = new DataTable(); // dtResultado = obj.uspINS_EQUIPO_TRABAJO_VARIOS(Convert.ToInt32( Session["IDE_RESPONSABLE"].ToString()), txtCentro.Text, Session["IDE_USUARIO"].ToString()); //} protected void datosResponsable() { BL_EQUIPO_RESPONSABLE obj = new BL_EQUIPO_RESPONSABLE(); DataTable dtResultado = new DataTable(); dtResultado = obj.uspSEL_EQUIPO_RESPONSABLE_POR_ID(Convert.ToInt32(Session["IDE_RESPONSABLE"].ToString())); if (dtResultado.Rows.Count > 0) { txtResponsable.Text = dtResultado.Rows[0]["NOMBRE_COMPLETO"].ToString(); txtCentro.Text = dtResultado.Rows[0]["CENTRO"].ToString(); txtGerencia.Text = dtResultado.Rows[0]["GERENCIA"].ToString(); } }
protected void EliminarResponsable(object sender, ImageClickEventArgs e) { ImageButton btnEliminar = ((ImageButton)sender); GridViewRow row = btnEliminar.NamingContainer as GridViewRow; //string pk = GridView1.DataKeys[row.RowIndex].Values[0].ToString(); BL_EQUIPO_RESPONSABLE obj = new BL_EQUIPO_RESPONSABLE(); DataTable dtResultado = new DataTable(); dtResultado = obj.uspUPD_EQUIPO_RESPONSABLE_ESTADO(Convert.ToInt32(btnEliminar.CommandArgument), 0); ListarResponsables(); }
protected void ListarResponsables() { string Gerenencia = string.Empty; if (ddlGerenciaResponsable.SelectedIndex == 0) { Gerenencia = string.Empty; } else { Gerenencia = ddlGerenciaResponsable.SelectedValue.ToString(); } //BL_EQUIPO_RESPONSABLE obj = new BL_EQUIPO_RESPONSABLE(); //DataTable dtResultado = new DataTable(); //dtResultado = obj.uspSEL_EQUIPO_RESPONSABLE_GERENCIA(Gerenencia); //if (dtResultado.Rows.Count > 0) //{ // GridView1.Visible = true; // GridView1.DataSource = dtResultado; // GridView1.DataBind(); //} //else //{ // GridView1.Visible = false; // GridView1.DataSource = dtResultado; // GridView1.DataBind(); //} BL_EQUIPO_RESPONSABLE objGerencia = new BL_EQUIPO_RESPONSABLE(); DataTable dt = new DataTable(); dt = objGerencia.uspSEL_EQUIPO_GERENCIA(Gerenencia); if (dt.Rows.Count == 0) { dlCustomers.Visible = false; dlCustomers.DataSource = dt; dlCustomers.DataBind(); } else { dlCustomers.Visible = true; dlCustomers.DataSource = dt; dlCustomers.DataBind(); } }
protected void btnLiberar_Click(object sender, EventArgs e) { if (ddlPersonal.SelectedValue == string.Empty) { string cleanMessage = "Falta indicar personal responsable"; ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true); } else { BL_EQUIPO_RESPONSABLE obj = new BL_EQUIPO_RESPONSABLE(); DataTable dtResultado = new DataTable(); dtResultado = obj.uspUPD_LIBERAR_EQUIPO_RESPONSABLE(Convert.ToInt32(Session["IDE_RESPONSABLE"].ToString()), ddlPersonal.SelectedValue.ToString()); datosResponsable(); string cleanMessage = "AsignaciĆ³n de equipo satisfactorio"; ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true); } }
protected void dlCustomers_ItemDataBound(object sender, DataListItemEventArgs e) { //string estado = string.Empty; //if (ddlLeyenda.SelectedIndex == 0) //{ // estado = string.Empty; //} //else //{ // estado = ddlLeyenda.SelectedValue.ToString(); //} //BL_EQUIPO_RESPONSABLE obj = new BL_EQUIPO_RESPONSABLE(); //DataTable dtResultado = new DataTable(); //dtResultado = obj.uspSEL_EQUIPO_RESPONSABLE_GERENCIA(Gerenencia); //if (dtResultado.Rows.Count > 0) //{ // GridView1.Visible = true; // GridView1.DataSource = dtResultado; // GridView1.DataBind(); //} //else //{ // GridView1.Visible = false; // GridView1.DataSource = dtResultado; // GridView1.DataBind(); //} BL_EQUIPO_RESPONSABLE obj = new BL_EQUIPO_RESPONSABLE(); DataRowView drv = e.Item.DataItem as DataRowView; GridView innerDataList = e.Item.FindControl("GridView1") as GridView; Label lbl = (Label)e.Item.FindControl("lblGerencia"); DataTable _DataTable2 = new DataTable(); _DataTable2 = obj.uspSEL_EQUIPO_RESPONSABLE_GERENCIA(lbl.Text); foreach (DataRow rw in _DataTable2.Rows) { innerDataList.DataSource = _DataTable2; innerDataList.DataBind(); } }
protected void Registrar() { string cleanMessage = string.Empty; BE_EQUIPO_RESPONSABLE oBESol = new BE_EQUIPO_RESPONSABLE(); oBESol.IDE_RESPONSABLE = 0; oBESol.DNI_RESPONSABLE = ddlPersonal.SelectedValue.ToString(); oBESol.IP_CENTRO = ddlGerencia.SelectedValue; oBESol.CENTRO = ddlCentro.SelectedValue; oBESol.FLG_ESTADO = 1; int dtrpta = 0; dtrpta = new BL_EQUIPO_RESPONSABLE().uspINS_EQUIPO_RESPONSABLE(oBESol); if (dtrpta > 0) { ddlPersonal.Text = string.Empty; cleanMessage = "Registro exitoso"; ListarResponsables(); ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true); } }