Beispiel #1
0
 private void btnDeleteEmployee_Click(object sender, EventArgs e)
 {
     try
     {
         CompanyDAO.SetData <Employee>((cmbEmployees.SelectedItem as ComboItem <Employee>).Value, DAOAcsessModifier.DeleteEmployee);
         if (CompanyDAO.IsInDataBase <Employee>((cmbEmployees.SelectedItem as ComboItem <Employee>).Value))
         {
             throw new Exception($"Something went wrong, {(cmbEmployees.SelectedItem as ComboItem<Employee>).Value} didn't deleted");
         }
         else
         {
             FlexibleMessageBox.Show($"{(cmbEmployees.SelectedItem as ComboItem<Employee>).Value} deleted sucsessfully");
         }
     }
     catch (NullReferenceException nrex)
     {
         FlexibleMessageBox.Show($"Please choose from the ComboBox above\n\n{nrex.Message}");
     }
     catch (Exception ex)
     {
         FlexibleMessageBox.MAX_WIDTH_FACTOR = Screen.PrimaryScreen.WorkingArea.Width;
         FlexibleMessageBox.Show($"{ex.GetType().Name}\n\n{ex.Message}\n\n{ex.StackTrace}");
     }
     finally
     {
         InitializeCombo();
         GetListOfEmployees();
     }
 }
Beispiel #2
0
        public void ejecutarProcesos()
        {
            mConn = Connection.Instance;
            if (mConn.datosValidos)
            {
                DirectoryDAO.createDirectoryLocal(mConn.pathJSONLog);
                List <CompanyBean> sociedades = CompanyDAO.obtenerSociedades(mConn.urlGetEmpresa);

                if (sociedades.Count > 0)
                {
                    foreach (var sociedad in sociedades)
                    {
                        //  OrdenVenta.registrarOrdenesEnSAP(sociedad);
                        // PagoRecibido.registrarPagosEnSAP(sociedad);
                        // SocioNegocio.registrarSociosEnSAP(sociedad);
                        // PagoRecibido.registrarPagosEnSAP(sociedad);
                        //Incidencia.registrarIncidenciasEnSAP(sociedad);
                        //Ubicaciones.actualizarUbicacionesEnSAP(sociedad);
                        //Devolucion.registrarDevolucionesEnSAP(sociedad);
                        if (sociedad.id == 2)
                        {
                            NotaCredito.registrarNotasCreditoEnSAP(sociedad);
                        }
                    }
                }
            }
        }
Beispiel #3
0
        private void btnAddEmployee_Click(object sender, EventArgs e)
        {
            lblPnlOutInfo.Text = string.Empty;

            Employee emp = new Employee
            {
                NAME    = txtName.Text,
                ADDRESS = txtAddress.Text,
                AGE     = (int)numAge.Value,
                SALARY  = (int)numSalary.Value
            };

            try
            {
                CompanyDAO.SetData <Employee>(emp, DAOAcsessModifier.InsertEmployee);
            }
            catch (Exception ex)
            {
                FlexibleMessageBox.MAX_WIDTH_FACTOR = Screen.PrimaryScreen.WorkingArea.Width;
                FlexibleMessageBox.Show($"{ex.GetType().Name}\n\n{ex.Message}\n\n{ex.StackTrace}");
            }
            InitializeEmployeeDefaults();
            InitializeCombo();
            GetListOfEmployees();
        }
Beispiel #4
0
        public IActionResult Get(
            [FromServices] CompanyDAO dao)
        {
            var result = dao.ListarTodosSync();

            return(Ok(result));
        }
Beispiel #5
0
        public string abrirPeriodo(string periodo)
        {
            CompanyDAO cDao = new CompanyDAO();

            if (Inicializar.codCompany.HasValue)
            {
                EPeriodo objPer = cDao.getPeriodo(Inicializar.codCompany);
                int      nReg   = 0;
                if (objPer == null)
                {
                    nReg = cDao.guardarPeriodo(periodo, "Nuevo", Inicializar.codCompany);
                }
                else
                {
                    nReg = cDao.guardarPeriodo(periodo, "Actualizar", Inicializar.codCompany);
                }

                if (nReg > 0)
                {
                    string       ruta       = AppDomain.CurrentDomain.BaseDirectory + "\\" + Inicializar.company + ".txt";
                    StreamWriter swEscritor = new StreamWriter(ruta, false);
                    swEscritor.Write(periodo.Trim());
                    swEscritor.Close();
                    return("Correcto");
                }
                else
                {
                    return("Error al Abrir Periodo.. ");
                }
            }
            else
            {
                return("El período no se pudo abrir porque la compañia no existe, verifique... ");
            }
        }
        public ActionResult Create()
        {
            // Check cookies admin
            if (Request.Cookies["AdminIIT"] == null ||
                Request.Cookies["AdminIIT"].Values["expires"].AsDateTime() < DateTime.Now)
            {
                return(RedirectToAction("Login", "Account", "Admin"));
            }

            // Check cookies editor
            if (Request.Cookies["AdminIIT"].Values["admin"].Equals("false"))
            {
                return(RedirectToAction("Index", "Article", "Admin"));
            }


            var dao = new  CompanyDAO();
            var inf = dao.GetInformation();

            if (inf != null)
            {
                return(RedirectToAction("Index", "CompanyIn4"));
            }

            return(View());
        }
Beispiel #7
0
        public ActionResult Index()
        {
            var dao = new CompanyDAO();

            var model = dao.GetInformation();

            return(View(model));
        }
Beispiel #8
0
        public IActionResult PutUpdateCompany([FromBody] CompanyDTO company)
        {
            string message = CompanyDAO.UpdateCompany(company);

            if (message == null)
            {
                return(new JsonResult(rm.Success(message)));
            }
            return(new JsonResult(rm.Error(message)));
        }
Beispiel #9
0
        public ActionResult Change([FromBody] Company company)
        {
            using (var companyDAO = new CompanyDAO())
                if (companyDAO.Change(company))
                {
                    return(StatusCode(200, new { Message = "Alterado com sucesso" }));
                }

            return(StatusCode(304, new { Message = "Não alterado" }));
        }
Beispiel #10
0
 public Service(Int64 id, string title, decimal price, int period, int periodsPaid,
                decimal effectiveness, Int64 asset_id, Int64 company_id, MySqlConnection _connection)
 {
     Id            = id;
     Title         = title;
     Price         = price;
     Period        = period;
     PeriodsPaid   = periodsPaid;
     Asset_id      = asset_id;
     Company       = CompanyDAO.GetCompanyById((int)company_id, _connection);
     Effectiveness = effectiveness;
 }
Beispiel #11
0
 public ActionResult Load()
 {
     try
     {
         using (var companyDAO = new CompanyDAO())
             return(StatusCode(200, companyDAO.Load()));
     }
     catch (Exception ex)
     {
         return(StatusCode(500, new { Message = "Falha" }));
     }
 }
Beispiel #12
0
        public ActionResult Get(int id)
        {
            try
            {
                using (var companyDAO = new CompanyDAO())
                    return(StatusCode(200, companyDAO.Get(id)));
            }

            catch (Exception ex)
            {
                return(StatusCode(500, new { Message = "Erro ao obter esta empresa" }));
            }
        }
        public ActionResult Create(Information in4)
        {
            if (ModelState.IsValid)
            {
                var dao = new CompanyDAO();

                dao.AddCompanyIn4(in4);

                return(RedirectToAction("Index", "CompanyIn4", "Admin"));
            }

            return(View(in4));
        }
Beispiel #14
0
 private void InitializeCombo()
 {
     lblPnlOutInfo.Text = string.Empty;
     cmbEmployees.Items.Clear();
     try
     {
         CompanyDAO.GetData <List <Employee> >(DAOAcsessModifier.GetAllEmployees).ForEach(x => cmbEmployees.Items.Add(new ComboItem <Employee>(x)));
     }
     catch (Exception ex)
     {
         FlexibleMessageBox.MAX_WIDTH_FACTOR = Screen.PrimaryScreen.WorkingArea.Width;
         FlexibleMessageBox.Show($"{ex.GetType().Name}\n\n{ex.Message}\n\n{ex.StackTrace}");
     }
 }
Beispiel #15
0
 private void GetListOfEmployees()
 {
     InitializeCombo();
     lblPnlOutInfo.Text = string.Empty;
     try
     {
         CompanyDAO.GetData <List <Employee> >(DAOAcsessModifier.GetAllEmployees).ForEach(x => lblPnlOutInfo.Text += x);
     }
     catch (Exception ex)
     {
         FlexibleMessageBox.MAX_WIDTH_FACTOR = Screen.PrimaryScreen.WorkingArea.Width;
         FlexibleMessageBox.Show($"{ex.GetType().Name}\n\n{ex.Message}\n\n{ex.StackTrace}");
     }
 }
Beispiel #16
0
 public ActionResult <IEnumerable <string> > PostCreateCompany([FromBody] CompanyDataDTO companyDataDTO)
 {
     try
     {
         var      company        = CompanyDAO.CreateCompany(companyDataDTO);
         var      account        = companyDataDTO.AccountDTO;
         var      messageAccount = new MessageAccount(company.CompanyId, account.Fullname, account.Email, 2);
         Producer producer       = new Producer();
         producer.PublishMessage(message: JsonConvert.SerializeObject(messageAccount), "AccountGenerate");
         return(new JsonResult(rm.Success("Save success")));
     } catch
     {
         return(new JsonResult(rm.Error("Save fail")));
     }
 }
        public ActionResult Edit(Information in4)
        {
            if (ModelState.IsValid)
            {
                var dao    = new CompanyDAO();
                var result = dao.UpdateIn4(in4);

                if (result)
                {
                    return(RedirectToAction("Index", "CompanyIn4"));
                }

                return(View(in4));
            }
            return(View(in4));
        }
Beispiel #18
0
        public ActionResult Add([FromBody] Company company)
        {
            try
            {
                using (var companyDAO = new CompanyDAO())
                    if (companyDAO.Add(company) != 0)
                    {
                        return(StatusCode(201, "Adicionada"));
                    }

                return(StatusCode(304, new { Message = "Não adicionada" }));
            }

            catch (Exception ex)
            {
                return(StatusCode(500, new { Message = "Falha" }));
            }
        }
Beispiel #19
0
 public DAOStorage(
     CompanyDAO companyDAO,
     FormatDAO formatDAO,
     GenreDAO genreDAO,
     PosterDAO posterDAO,
     QualityDAO qualityDAO,
     MovieDAO movieDAO,
     PosterImageDAO posterImageDAO
     )
 {
     CompanyDAO     = companyDAO;
     FormatDAO      = formatDAO;
     GenreDAO       = genreDAO;
     PosterDAO      = posterDAO;
     QualityDAO     = qualityDAO;
     MovieDAO       = movieDAO;
     PosterImageDAO = posterImageDAO;
 }
Beispiel #20
0
        public ActionResult Remove(int id)
        {
            try
            {
                using (var companyDAO = new CompanyDAO())
                    if (companyDAO.Remove(id))
                    {
                        return(StatusCode(200, new { Message = "Removido" }));
                    }

                return(StatusCode(304, new { Message = "Não Removido" }));
            }

            catch (Exception ex)
            {
                return(StatusCode(500, new { Message = "Falha" }));
            }
        }
        private void btnUpdateEmployee_Click(object sender, EventArgs e)
        {
            try
            {
                CompanyDAO.SetData <Employee>(new Employee(_employee.ID, this.txtName.Text, this.txtAddress.Text, (double)this.numSalary.Value, (int)this.numAge.Value), DAOAcsessModifier.UpdateEmployee);
                this.BackgroundImage = new Bitmap(this.ClientRectangle.Width, this.ClientRectangle.Height);
            }
            catch (Exception ex)
            {
                FlexibleMessageBox.MAX_WIDTH_FACTOR = Screen.PrimaryScreen.WorkingArea.Width;
                FlexibleMessageBox.Show($"{ex.GetType().Name}\n\n{ex.Message}\n\n{ex.StackTrace}");
            }

            /*
             * InitializeEmployeeDefaults();
             * InitializeCombo();
             * GetListOfEmployees();
             */
        }
    void CompanyTest(MySqlConnection connection)
    {
        List <Company> companies = new List <Company>();

        companies.Add(new Company(2, "DigiSoft", 2.5, 4, 20.50M));

        CompanyDAO.InsertCompanies(connection, companies);

        List <Company> companies2 = CompanyDAO.GetCompanies(connection);

        companies2[1].Title = "Dan";

        CompanyDAO.UpdateCompanies(connection, companies2);

        companies2 = CompanyDAO.GetCompanies(connection);

        CompanyDAO.DeleteCompanies(connection, companies);

        companies2 = CompanyDAO.GetCompanies(connection);
    }
Beispiel #23
0
        public void ejecutarProcesos()
        {
            try
            {
                mConn = Connection.Instance;
                if (mConn.datosValidos)
                {
                    DirectoryDAO.createDirectoryLocal(mConn.pathJSONLog);
                    List <CompanyBean> sociedades = CompanyDAO.obtenerSociedades(mConn.urlGetEmpresa);

                    if (sociedades.Count > 0)
                    {
                        foreach (var sociedad in sociedades)
                        {
                            SocioNegocio.registrarSociosEnSAP(sociedad);
                            OrdenVenta.registrarOrdenesEnSAP(sociedad);
                            PagoRecibido.registrarPagosEnSAP(sociedad);
                            Incidencia.registrarIncidenciasEnSAP(sociedad);
                            Devolucion.registrarDevolucionesEnSAP(sociedad);
                            NotaCredito.registrarNotasCreditoEnSAP(sociedad);

                            if (sociedad.inSession && !string.IsNullOrEmpty(sociedad.sessionId) &&
                                !string.IsNullOrEmpty(sociedad.routeId))
                            {
                                LoginDAO.cerrarSesion(sociedad.sessionId, sociedad.routeId, mConn.BaseUrl);
                                sociedad.inSession = false;
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                log.Error("MainProcess > " + e.Message);
            }
        }
Beispiel #24
0
        /// <summary>
        /// Obtiene el Periodo de Actual de la Compañia
        /// </summary>
        /// <param name="codigo"></param>
        /// <returns></returns>
        public EPeriodo getPeriodo(int codigo)
        {
            CompanyDAO cDao = new CompanyDAO();

            return(cDao.getPeriodo(codigo));
        }
Beispiel #25
0
        /// <summary>
        /// Retorna una lista de todas las Compañias
        /// </summary>
        /// <returns></returns>
        public List <ECompany> getAll()
        {
            CompanyDAO cDao = new CompanyDAO();

            return(cDao.getAll());
        }
Beispiel #26
0
        /// <summary>
        /// Retorna los Datos de una Compañia
        /// </summary>
        /// <param name="login">Login de la Compañia</param>
        /// <param name="clave">Clave Compañia</param>
        /// <returns></returns>
        public ECompany buscar(string login, string clave)
        {
            CompanyDAO cDao = new CompanyDAO();

            return(cDao.buscar(login, clave));
        }
Beispiel #27
0
        /// <summary>
        /// Devuelve los datos de la Compañia Actualmente Seleccionada
        /// </summary>
        /// <returns></returns>
        public ECompany buscar()
        {
            CompanyDAO cDao = new CompanyDAO();

            return(cDao.buscar(Inicializar.company));
        }
Beispiel #28
0
        /// <summary>
        /// Devuelve una Lista Con los Periodos Bloqueados de una Compañia
        /// </summary>
        /// <param name="dato"></param>
        /// <returns></returns>
        public List <EPeriodo> getPerBloqueado(string dato)
        {
            CompanyDAO cDao = new CompanyDAO();

            return(cDao.getPerBloqueado(dato));
        }
Beispiel #29
0
 public int addCompany(Empresa e)
 {
     return(CompanyDAO.addCompany(e));
 }
Beispiel #30
0
        public ActionResult <IEnumerable <string> > GetAllCompanyByName(string name)
        {
            List <CompanyDTO> com = CompanyDAO.GetCompanyByName(name);

            return(new JsonResult(rm.Success(com)));
        }