Ejemplo n.º 1
0
        void GetSector(int tipo)
        {
            ELRMaestros.FormSectores frm = new ELRMaestros.FormSectores();
            int sectorId = 0, municipioId = 0;

            try
            {
                frm.empresaID   = EMPRESA_ID;
                frm.oficinaID   = OFICINA_ID;
                frm.esBusqueda  = true;
                frm.EnEjecusion = true;
                frm.EsAgregar   = true;
                frm.EsModificar = true;

                if (tipo == 0 && cboMunicipio.SelectedValue != null)
                {
                    municipioId = int.Parse(cboMunicipio.SelectedValue.ToString());
                }
                else if (tipo == 1 && cboCliEmpresaMunicipio.SelectedValue != null)
                {
                    municipioId = int.Parse(cboCliEmpresaMunicipio.SelectedValue.ToString());
                }
                else
                {
                    municipioId = defMunicipioId;
                }

                frm.FiltroEstatico = "EsActivo = 1 And Municipio_Id = " + municipioId.ToString();

                frm.ShowDialog();

                if (frm.filaSelecionada != null)
                {
                    cboSector.LlenarCombo();
                    cboClienteEmpresaSector.LlenarCombo();


                    sectorId = objUtil.GetAsInt("Sector_Id", frm.filaSelecionada);

                    if (tipo <= 0)
                    {
                        cboSector.SelectedValue = sectorId;
                    }
                    else if (tipo == 1)
                    {
                        cboClienteEmpresaSector.SelectedValue = sectorId;
                    }
                }
            }
            catch (Exception ex)
            {
                objUtil.MostrarMensajeError(ex.Message);
            }
            finally
            {
                frm.Dispose();
            }
        }
Ejemplo n.º 2
0
        void GetSector(int tipo)
        {
            ELRMaestros.FormSectores frm = new ELRMaestros.FormSectores();
            int sectorId = 0;

            try
            {
                frm.empresaID   = EMPRESA_ID;
                frm.oficinaID   = OFICINA_ID;
                frm.esBusqueda  = true;
                frm.EnEjecusion = true;
                frm.EsAgregar   = true;
                frm.EsModificar = true;

                frm.ShowDialog();

                if (frm.filaSelecionada != null)
                {
                    cboSector.LlenarCombo();
                    cboClienteEmpresaSector.LlenarCombo();

                    sectorId = objUtil.GetAsInt("Sector_Id", frm.filaSelecionada);

                    if (tipo <= 0)
                    {
                        cboSector.SelectedValue = sectorId;
                    }
                    else if (tipo == 1)
                    {
                        cboClienteEmpresaSector.SelectedValue = sectorId;
                    }
                }
            }
            catch (Exception ex)
            {
                objUtil.MostrarMensajeError(ex.Message);
            }
            finally
            {
                frm.Dispose();
            }
        }
Ejemplo n.º 3
0
        void GetSector(string codigo = "")
        {
            DataTable DTData = null;
            DataRow   fila0 = null;
            string    SSQL = "", nombre = "(TODOS)";

            ELRMaestros.FormSectores frm = new ELRMaestros.FormSectores();

            try
            {
                sectorId = 0;
                codigo   = codigo.Trim().Replace('-', ' ');
                if (codigo != "")
                {
                    SSQL  = " SELECT TOP 1 Sector_Id, Nombre FROM TZONAS_SECTORES";
                    SSQL += " WHERE Cast(Sector_Id as Varchar) = '" + codigo + "'";

                    if (municipioId > 0)
                    {
                        SSQL += " And Municipio_Id = " + municipioId.ToString();
                    }

                    DTData = objDB.GetSQL(SSQL);
                    if (DTData.Rows.Count > 0)
                    {
                        fila0 = DTData.Rows[0];
                    }
                }
                else
                {
                    frm.empresaID      = empresaID;
                    frm.oficinaID      = oficinaID;
                    frm.EsAgregar      = false;
                    frm.EsModificar    = false;
                    frm.esBusqueda     = true;
                    frm.EnEjecusion    = true;
                    frm.FiltroEstatico = "";

                    if (municipioId > 0)
                    {
                        frm.FiltroEstatico = " Municipio_Id = " + municipioId.ToString();
                    }


                    frm.ShowDialog();

                    if (frm.filaSelecionada != null)
                    {
                        fila0 = frm.filaSelecionada;
                    }
                }

                if (fila0 != null)
                {
                    sectorId = objUtil.GetAsInt("Sector_Id", fila0);
                    nombre   = objUtil.GetAsString("Nombre", fila0);
                }

                txtCodigoSector.Text = sectorId.ToString();
                txtNomSector.Text    = nombre;
                toolTip1.SetToolTip(txtNomSector, nombre);
            }
            catch (Exception ex)
            {
                objUtil.MostrarMensajeError(ex.Message);
            }
        }