Exemplo n.º 1
0
        public JsonResult Guardar(EmpresaViewModel oEmpresaViewModel)
        {
            List <String> resultado = new List <String>();

            resultado.Add("true");
            resultado.Add(Constantes.GuardadoExitoso);

            EmpresaServicesController oServices = new EmpresaServicesController();

            try
            {
                EntityEmpresa oEntityEmpresaExists = oServices.SelectByKey(oEmpresaViewModel.EntityEmpresa.Key);

                if (Constantes.Cero != oEntityEmpresaExists.Key.IDEmpresa)
                {
                    oServices.Update(oEmpresaViewModel.EntityEmpresa);
                }
                else
                {
                    oServices.Insert(oEmpresaViewModel.EntityEmpresa);
                }
            }
            catch (Exception)
            {
                resultado[0] = "false";
                resultado[1] = Constantes.GuardadoNoExitoso;
            }

            return(Json(resultado, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 2
0
 public EntityEmpresa Delete(EntityEmpresa oEntityEmpresa)
 {
     try
     {
         return(EmpresaApp.Update(oEntityEmpresa));
     }
     catch (Exception)
     {
         throw new FaultException("Error al eliminar Empresas");
     }
 }
Exemplo n.º 3
0
 public EntityEmpresa Update(EntityEmpresa oEntityEmpresa)
 {
     try
     {
         return(EmpresaApp.Update(oEntityEmpresa));
     }
     catch (Exception)
     {
         throw new FaultException("Error al actualizar Empresas");
     }
 }
Exemplo n.º 4
0
 public EntityEmpresa Insert(EntityEmpresa oEntityEmpresa)
 {
     try
     {
         return(EmpresaApp.Insert(oEntityEmpresa));
     }
     catch (Exception)
     {
         throw new FaultException("Error al insertar Empresas");
     }
 }
Exemplo n.º 5
0
 public IList <EntityEmpresa> Select(EntityEmpresa oEntityEmpresa)
 {
     try
     {
         return(EmpresaApp.Select(oEntityEmpresa));
     }
     catch (Exception)
     {
         throw new FaultException("Error al seleccionar Empresas");
     }
 }
Exemplo n.º 6
0
 public EntityEmpresa Update(EntityEmpresa oEntityEmpresa)
 {
     try
     {
         return(EmpresaService.Update(oEntityEmpresa));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 7
0
 public EntityEmpresa Insert(EntityEmpresa oEntityEmpresa)
 {
     try
     {
         return(EmpresaService.Insert(oEntityEmpresa));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 8
0
 public IList <EntityEmpresa> Select(EntityEmpresa oEntityEmpresa)
 {
     try
     {
         return(EmpresaService.Select(oEntityEmpresa));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 9
0
 public EntityEmpresa Delete(EntityEmpresa oEntityEmpresa, CTransaction oCTransaction)
 {
     try
     {
         DataEmpresaRepository data = new DataEmpresaRepository(oEntityEmpresa, "empresa");
         return(data.Delete(oCTransaction));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 10
0
 public IList <EntityEmpresa> Select(EntityEmpresa oEntityEmpresa, CTransaction oCTransaction)
 {
     try
     {
         DataEmpresaRepository data = new DataEmpresaRepository(oEntityEmpresa, "empresa");
         return(data.Select(oCTransaction));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 11
0
 public EntityEmpresa Delete(EntityEmpresa oEntityEmpresa)
 {
     try
     {
         CTransaction oCTransaction = CTransaction.Empty;
         return(Repo.Delete(oEntityEmpresa, oCTransaction));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 12
0
 public IList <EntityEmpresa> Select(EntityEmpresa oEntityEmpresa)
 {
     try
     {
         CTransaction oCTransaction = CTransaction.Empty;
         return(Repo.Select(oEntityEmpresa, oCTransaction));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 13
0
        public EntityEmpresa Insert(EntityEmpresa oEntityEmpresa, CTransaction oCTransaction)
        {
            try
            {
                DataEmpresaRepository data = new DataEmpresaRepository(oEntityEmpresa, "empresa");

                oEntityEmpresa = data.Insert(oCTransaction);
                KeyEmpresa key = new KeyEmpresa(DataCreator.CreateInt32(data.CollectionParams.GetParameter("IDEmpresa").Value));
                oEntityEmpresa.Key = key;
                return(oEntityEmpresa);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 14
0
        public ActionResult Edit(KeyEmpresa oKey)
        {
            EmpresaServicesController oServices        = new EmpresaServicesController();
            UsuarioServicesController oUsuarioServices = new UsuarioServicesController();

            EmpresaViewModel oEmpresaViewModel = new EmpresaViewModel();

            EntityEmpresa oEntityEmpresa = oServices.SelectByKey(oKey);

            oEmpresaViewModel.EntityEmpresa   = oEntityEmpresa;
            oEmpresaViewModel.ListTipoEmpresa = oServices.SelectTipoEmpresa(
                new EntityTipoEmpresa
            {
                Key = new KeyTipoEmpresa {
                    IDTipoEmpresa = Constantes.UnoNegativo
                },
                Estado = Constantes.Activo
            });

            return(PartialView(Constantes.EmpresaEdit, oEmpresaViewModel));
        }