private void cargar_GridView_SUB_C() { tools _tools = new tools(); SecureQueryString QueryStringSeguro; QueryStringSeguro = new SecureQueryString(_tools.byteParaQueryStringSeguro(), Request["data"]); Decimal ID_EMPRESA = Convert.ToDecimal(QueryStringSeguro["reg"].ToString()); Decimal ID_CENTRO_C = Convert.ToDecimal(QueryStringSeguro["cc"].ToString()); subCentroCosto _subCentroCosto = new subCentroCosto(Session["idEmpresa"].ToString(), Session["USU_LOG"].ToString()); DataTable tablaInfoSubC = _subCentroCosto.ObtenerSubCentrosDeCostoPorIdEmpresaIdCentroCosto(ID_EMPRESA, ID_CENTRO_C); if (tablaInfoSubC.Rows.Count > 0) { Panel_SUB_CENTROS.Visible = true; GridView_SUB_C.DataSource = tablaInfoSubC; GridView_SUB_C.DataBind(); } else { Informar(Panel_FONDO_MENSAJE, Image_MENSAJE_POPUP, Panel_MENSAJES, Label_MENSAJE, "El CENTRO DE COSTO no posee sub centros.", Proceso.Advertencia); } }
private void cargar_datos_sub_centro_costo() { tools _tools = new tools(); SecureQueryString QueryStringSeguro; QueryStringSeguro = new SecureQueryString(_tools.byteParaQueryStringSeguro(), Request["data"]); Decimal ID_SUB_C = Convert.ToDecimal(QueryStringSeguro["subcc"]); Panel_FORMULARIO.Visible = true; Panel_CONTROL_REGISTRO.Visible = false; subCentroCosto _subCentroCosto = new subCentroCosto(Session["idEmpresa"].ToString(), Session["USU_LOG"].ToString()); DataTable tablaSubCentro = _subCentroCosto.ObtenerSubCentrosDeCostoPorIdSubCosto(ID_SUB_C); DataRow filaSubCentro = tablaSubCentro.Rows[0]; Panel_ID_SUB_C.Visible = true; Panel_ID_SUB_C.Enabled = false; TextBox_ID_SUB_C.Text = filaSubCentro["ID_SUB_C"].ToString(); TextBox_NOM_SUB_C.Text = filaSubCentro["NOM_SUB_C"].ToString().Trim(); Panel_OcultarSubC.Visible = true; CheckBox_OcultarSubC.Checked = false; }
protected DataTable ConsultarInventario(String centroCostos, String subcentroCosto, String ciudad, String[] datos, DataRow fila) { String id_Ciudad; DataTable tablaentregas = new DataTable(); tablaentregas.Columns.Add("ID_PRODUCTO"); tablaentregas.Columns.Add("ID_LOTE"); tablaentregas.Columns.Add("CANTIDAD"); tablaentregas.Columns.Add("TALLA"); DataRow entrega = tablaentregas.NewRow(); if (!(centroCostos.Equals("0"))) { centroCosto _centroC = new centroCosto(Session["idEmpresa"].ToString(), Session["USU_LOG"].ToString()); DataTable tablaCentro = _centroC.ObtenerCentrosDeCostoPorIdCentroCosto(Convert.ToDecimal(centroCostos)); DataRow filaCentros = tablaCentro.Rows[0]; id_Ciudad = filaCentros["ID_CIUDAD"].ToString(); } else if (!(subcentroCosto.Equals("0"))) { subCentroCosto _SubCentroC = new subCentroCosto(Session["idEmpresa"].ToString(), Session["USU_LOG"].ToString()); DataTable tablaSub = _SubCentroC.ObtenerSubCentrosDeCostoPorIdSubCosto(Convert.ToDecimal(subcentroCosto)); DataRow filaSubCentro = tablaSub.Rows[0]; centroCosto _centroC = new centroCosto(Session["idEmpresa"].ToString(), Session["USU_LOG"].ToString()); DataTable tablaCentro = _centroC.ObtenerCentrosDeCostoPorIdCentroCosto(Convert.ToDecimal(filaSubCentro["ID_CENTRO_C"].ToString())); DataRow filaCentros = tablaCentro.Rows[0]; id_Ciudad = filaCentros["ID_CIUDAD"].ToString(); } else { id_Ciudad = ciudad; } int id_empresa = Convert.ToInt32(datos[3].ToString()); ciudad _ciudad = new ciudad(Session["idEmpresa"].ToString()); DataTable tablaCiudad = _ciudad.ObtenerCiudadPorIdCiudad(id_Ciudad); DataRow filaCiudad = tablaCiudad.Rows[0]; String id_regional = filaCiudad["ID_REGIONAL"].ToString(); bodega _bodega = new bodega(Session["idEmpresa"].ToString(), Session["USU_LOG"].ToString()); DataTable tablabodega = _bodega.ObtenerAlmRegBodegaPorIds(id_regional, id_Ciudad, id_empresa); if (tablabodega.Rows.Count <= 0) { Label_MENSAJE.Text = "ADVERTENCIA: No se encontraron bodegas para la empresa en la ubicación seleccionada. Valide por favor."; configurarMensajes(true, System.Drawing.Color.Red, Label_MENSAJE, Panel_MENSAJES); } else { DataRow filaBodega = tablabodega.Rows[0]; lote _lote = new lote(Session["idEmpresa"].ToString(), Session["USU_LOG"].ToString()); HiddenField_idBodega.Value = filaBodega["ID_BODEGA"].ToString(); DataTable tablaLote = _lote.ObtenerAlmLotePorIdProductoBodega(Convert.ToInt32(fila["ID_PRODUCTO"]), Convert.ToInt32(filaBodega["ID_BODEGA"].ToString())); if (tablaLote.Rows.Count <= 0) { Label_MENSAJE.Text = "ADVERTENCIA: No hay existencias del producto " + fila["NOMBRE"].ToString() + " para la empresa seleccionada. Valide por favor."; configurarMensajes(true, System.Drawing.Color.Red, Label_MENSAJE, Panel_MENSAJES); } else { int contLote; foreach (DataRow filalotes in tablaLote.Rows) { entrega = tablaentregas.NewRow(); contLote = Convert.ToInt32(filalotes["ENTRADAS"]) - Convert.ToInt32(filalotes["SALIDAS"]); entrega[0] = filalotes["ID_PRODUCTO"]; entrega[1] = filalotes["ID_LOTE"]; entrega[2] = contLote; entrega[3] = filalotes["TALLA"]; tablaentregas.Rows.Add(entrega); } } } return(tablaentregas); }
protected void Button_GUARDAR_Click(object sender, EventArgs e) { tools _tools = new tools(); SecureQueryString QueryStringSeguro; QueryStringSeguro = new SecureQueryString(_tools.byteParaQueryStringSeguro(), Request["data"]); String accion = QueryStringSeguro["accion"].ToString(); Decimal ID_EMPRESA = Convert.ToDecimal(QueryStringSeguro["reg"]); Decimal ID_CENTRO_C = Convert.ToDecimal(QueryStringSeguro["cc"]); String NOM_SUB_C = TextBox_NOM_SUB_C.Text.Trim().ToUpper(); Boolean OCULTAR_SUB_CENTRO = false; if (CheckBox_OcultarSubC.Checked == true) { OCULTAR_SUB_CENTRO = true; } subCentroCosto _subCentroCosto = new subCentroCosto(Session["idEmpresa"].ToString(), Session["USU_LOG"].ToString()); DataSet dataSetResultados; Decimal ID_SUB_C = 0; if (accion == "nuevo") { subCentroCosto _sub = new subCentroCosto(Session["idEmpresa"].ToString(), Session["USU_LOG"].ToString()); DataTable tablaSubCentro = _sub.ObtenerSubCentroDeCostoPorNombreIdCentroC(NOM_SUB_C, ID_CENTRO_C); if (tablaSubCentro.Rows.Count > 0) { DataRow filaSUBC = tablaSubCentro.Rows[0]; ID_SUB_C = Convert.ToDecimal(filaSUBC["ID_SUB_C"]); Boolean OCULTAR_SUBC = false; dataSetResultados = _sub.ActualizarSubCC(ID_SUB_C, ID_EMPRESA, ID_CENTRO_C, NOM_SUB_C, OCULTAR_SUBC); if (dataSetResultados.Tables.Count <= 0) { if (String.IsNullOrEmpty(_sub.MensajeError) == true) { Informar(Panel_FONDO_MENSAJE, Image_MENSAJE_POPUP, Panel_MENSAJES, Label_MENSAJE, "No se pudo procesar la petición. " + _sub.MensajeError, Proceso.Error); } else { Informar(Panel_FONDO_MENSAJE, Image_MENSAJE_POPUP, Panel_MENSAJES, Label_MENSAJE, "Ocurrio un error inesperado procesando la solicitud. No se actualizó el sub centro seleccionado.", Proceso.Error); } } else { DataView vistaResultados = dataSetResultados.Tables[1].DefaultView; DataTable tablaResultados = vistaResultados.Table; DataRow filaResultado = tablaResultados.Rows[0]; QueryStringSeguro = new SecureQueryString(_tools.byteParaQueryStringSeguro()); QueryStringSeguro["img_area"] = "contratacion"; QueryStringSeguro["nombre_area"] = "CONTRATACIÓN Y RELACIONES LABORALES"; QueryStringSeguro["nombre_modulo"] = "CENTROS DE COSTO"; QueryStringSeguro["accion"] = "cargarSubccActivado"; QueryStringSeguro["reg"] = ID_EMPRESA.ToString(); QueryStringSeguro["cc"] = ID_CENTRO_C.ToString(); QueryStringSeguro["subcc"] = ID_SUB_C.ToString(); QueryStringSeguro["tipo"] = filaResultado["tipo"].ToString().Trim().ToUpper(); QueryStringSeguro["mensaje"] = filaResultado["mensaje"].ToString().Trim(); Response.Redirect("~/contratacion/centrosCosto.aspx?data=" + HttpUtility.UrlEncode(QueryStringSeguro.ToString())); } } else { dataSetResultados = _subCentroCosto.AdicionarSUBCC(ID_EMPRESA, ID_CENTRO_C, NOM_SUB_C); if (dataSetResultados.Tables.Count <= 0) { if (String.IsNullOrEmpty(_subCentroCosto.MensajeError) == true) { Informar(Panel_FONDO_MENSAJE, Image_MENSAJE_POPUP, Panel_MENSAJES, Label_MENSAJE, "No se pudo procesar la petición. " + _subCentroCosto.MensajeError, Proceso.Error); } else { Informar(Panel_FONDO_MENSAJE, Image_MENSAJE_POPUP, Panel_MENSAJES, Label_MENSAJE, "Ocurrio un error inesperado procesando la solicitud. No se actualizó el sub centro seleccionado.", Proceso.Error); } } else { DataView vistaResultados = dataSetResultados.Tables[1].DefaultView; DataTable tablaResultados = vistaResultados.Table; DataRow filaResultado = tablaResultados.Rows[0]; QueryStringSeguro = new SecureQueryString(_tools.byteParaQueryStringSeguro()); QueryStringSeguro["img_area"] = "contratacion"; QueryStringSeguro["nombre_area"] = "CONTRATACIÓN Y RELACIONES LABORALES"; QueryStringSeguro["nombre_modulo"] = "CENTROS DE COSTO"; QueryStringSeguro["accion"] = "cargarSubccNuevo"; QueryStringSeguro["reg"] = ID_EMPRESA.ToString(); QueryStringSeguro["cc"] = ID_CENTRO_C.ToString(); QueryStringSeguro["subcc"] = filaResultado["id"].ToString(); QueryStringSeguro["tipo"] = filaResultado["tipo"].ToString().Trim().ToUpper(); QueryStringSeguro["mensaje"] = filaResultado["mensaje"].ToString(); Response.Redirect("~/contratacion/centrosCosto.aspx?data=" + HttpUtility.UrlEncode(QueryStringSeguro.ToString())); } } } else { if (accion == "modificar") { ID_SUB_C = Convert.ToDecimal(QueryStringSeguro["subcc"].ToString()); dataSetResultados = _subCentroCosto.ActualizarSubCC(ID_SUB_C, ID_EMPRESA, ID_CENTRO_C, NOM_SUB_C, OCULTAR_SUB_CENTRO); if (dataSetResultados.Tables.Count <= 0) { if (String.IsNullOrEmpty(_subCentroCosto.MensajeError) == true) { Informar(Panel_FONDO_MENSAJE, Image_MENSAJE_POPUP, Panel_MENSAJES, Label_MENSAJE, "No se pudo procesar la petición. " + _subCentroCosto.MensajeError, Proceso.Error); } else { Informar(Panel_FONDO_MENSAJE, Image_MENSAJE_POPUP, Panel_MENSAJES, Label_MENSAJE, "Ocurrio un error inesperado procesando la solicitud. No se actualizó el sub centro seleccionado.", Proceso.Error); } } else { DataView vistaResultados = dataSetResultados.Tables[1].DefaultView; DataTable tablaResultados = vistaResultados.Table; DataRow filaResultado = tablaResultados.Rows[0]; QueryStringSeguro = new SecureQueryString(_tools.byteParaQueryStringSeguro()); QueryStringSeguro["img_area"] = "contratacion"; QueryStringSeguro["nombre_area"] = "CONTRATACIÓN Y RELACIONES LABORALES"; QueryStringSeguro["nombre_modulo"] = "CENTROS DE COSTO"; QueryStringSeguro["accion"] = "cargarSubccModificado"; QueryStringSeguro["reg"] = ID_EMPRESA.ToString(); QueryStringSeguro["cc"] = ID_CENTRO_C.ToString(); QueryStringSeguro["subcc"] = ID_SUB_C.ToString(); QueryStringSeguro["tipo"] = filaResultado["tipo"].ToString().Trim().ToUpper(); QueryStringSeguro["mensaje"] = filaResultado["mensaje"].ToString().Trim(); Response.Redirect("~/contratacion/centrosCosto.aspx?data=" + HttpUtility.UrlEncode(QueryStringSeguro.ToString())); } } } }