Example #1
0
        public bool update(List <SectorDTO> pDtoSector)
        {
            bool      bReturn = false;
            SectorDAO oSector = new SectorDAO();

            try
            {
                foreach (SectorDTO pItem in pDtoSector)
                {
                    if (pItem.idSector == 0)
                    {
                        throw new Exception("Código do Setor não informado.");
                    }
                    if (pItem.dsSector.Trim() == "")
                    {
                        throw new Exception("Informe a descrição do Setor.");
                    }

                    bReturn = oSector.update(pItem);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally { }

            return(bReturn);
        }
Example #2
0
        public int insert(string pDsSector)
        {
            int       iReturn = 0;
            SectorDAO oSector = new SectorDAO();

            try
            {
                if (pDsSector.Trim() == "")
                {
                    throw new Exception("Informe a descrição do Setor");
                }

                iReturn = oSector.insert(pDsSector);
                if (iReturn == 0)
                {
                    throw new Exception("Ocorreu um erro ao inserir o setor " + pDsSector);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally { }

            return(iReturn);
        }
        void GetListSector()
        {
            List <SectorDTO> sectorDTOs = SectorDAO.GetListSector();

            cbbBuilding.DataSource        = sectorDTOs;
            cbbBuilding.DisplayMember     = "SectorName";
            cbbBuiding_Bill.DataSource    = sectorDTOs;
            cbbBuiding_Bill.DisplayMember = "SectorName";
        }
Example #4
0
        public List <SectorDTO> listSectory()
        {
            SectorDAO        oSector     = new SectorDAO();
            List <SectorDTO> oListReturn = new List <SectorDTO>();

            try
            {
                oListReturn = oSector.listSector();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally { }

            return(oListReturn);
        }
Example #5
0
        public void Sector()
        {
            var objSector = RecuperarDatos();


            var response = SectorDAO.getInstance().RegistrarMediciones(objSector);

            if (response)
            {
                lblMensaje.Text        = "Datos registrados con una temperatura de: C°" + objSector.Temperatura;
                panelMensajes.CssClass = "alert-success text-center";
            }
            else
            {
                lblMensaje.Text =
                    "Revise los datos ingresados por favor, es posible que haya ingresado algo incorrectamente";
                panelMensajes.CssClass = "alert-warning text-center";
            }
        }
Example #6
0
        public List <SectorDTO> getSectorByID(int pIdSector)
        {
            SectorDAO        oSector     = new SectorDAO();
            List <SectorDTO> oListReturn = new List <SectorDTO>();

            try
            {
                if (pIdSector == 0)
                {
                    throw new Exception("Código do Setor não informado.");
                }

                oListReturn = oSector.getSectorByID(pIdSector);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally { }

            return(oListReturn);
        }
Example #7
0
        public void Prev_Load(Usuario usu, Prevista prv)
        {
            // Llena el combobox tarifas
            //trfDao = new TarifaDAO(this.user);
            //cbxRate.DisplayMember = "TypeAppString";
            //cbxRate.ValueMember = "Code";
            //cbxRate.DataSource = trfDao.LoadTarifa();
            cbxRate.Items.Add("Mensual Fija");
            cbxRate.Items.Add("Metros Cúbicos");
            cbxRate.SelectedItem = 0;

            // LLena el combo de Abonados
            abnDao = new AbonadoDAO(this.user);
            cbxAbonado.DisplayMember = "Name";
            cbxAbonado.ValueMember   = "Identification";
            if (abnDao.LoadAbonado1().Count > 0)
            {
                cbxAbonado.DataSource = abnDao.LoadAbonado1();
            }
            else
            {
                MessageBox.Show("No hay abonados disponibles para asignar a las previstas!", "Atención");
                //mostrar popup, notificacion o mensaje en un label o formulario, por al menos 3 segundos
            }

            // obtiene el consecutivo de previstas
            prvDao           = new PrevistaDAO(this.user);
            txtCode.Text     = prvDao.ConsecutivePrv().ToString();
            txtCode.ReadOnly = true;
            txtCode.Enabled  = false;

            // se obtienen y establecen los sectores
            secDao = new SectorDAO(this.user);
            cbxSector.DisplayMember = "Description";
            cbxSector.ValueMember   = "Code";
            cbxSector.DataSource    = secDao.LoadSector();
        }
 private void FrmBuildings_Load(object sender, EventArgs e)
 {
     dgvBuildings.DataSource = SectorDAO.GetListSector();
 }