Esempio n. 1
0
 public Result ModificarContrato(ContratoBE.ResponseContratoBE objContratoBE)
 {
     try
     {
         if (objContratoBE.Activo.Equals(false))
         {
             var data = objContratoDA.EliminarContrato(objContratoBE);
             result.Data = data;
         }
         else
         {
             var data = objContratoDA.ModificarContrato(objContratoBE);
             result.Data = data;
         }
     }
     catch (SqlException sqlex)
     {
         result.Code    = Notification.OperationCode.ErrorDataBase.GetHashCode();;
         result.Message = sqlex.Message;
     }
     catch (CustomException cusex)
     {
         result.Code    = Notification.OperationCode.ErrorCustom.GetHashCode();;
         result.Message = cusex.Message;
     }
     catch (Exception ex)
     {
         result.Code    = Notification.OperationCode.ErrorNotControl.GetHashCode();;
         result.Message = ex.Message;
     }
     return(result);
 }
        public async Task <ActionResult> RegistrarContrato(ContratoBE.ResponseContratoBE duModel)
        {
            if (Session[Sesiones.UsuarioLogin] == null)
            {
                Session.Clear();
                return(RedirectToAction("Index", "Login"));
            }

            try
            {
                if (ModelState.IsValid)
                {
                    var Usuariores = (BaseModel)Session[Sesiones.UsuarioLogin];

                    var nuevo = new ContratoBE.ResponseContratoBE
                    {
                        IDContract    = duModel.IDContract
                        , DraegerUser = Usuariores.Usuario.DNI
                        , Amount      = duModel.Amount
                        , Company     = duModel.Company
                        , InitialDate = duModel.InitialDate
                        , FinalDate   = duModel.FinalDate
                        , Quantity    = duModel.Quantity
                        , Dascription = duModel.Dascription
                        , Celular     = duModel.Celular
                        , Email       = duModel.Email
                        , Activo      = true
                    };
                    var registrar = await ContratosPCL.RegistrarContrato(nuevo);

                    if (registrar.Code != 200)
                    {
                        throw new Exception(registrar.Message);
                    }
                    ObjMessage = new MessageDialog()
                    {
                        Title   = "Se registro correctamente el contrato.",
                        Estado  = 0,
                        Message = "Se registro correctamente el contrato. " + duModel.Dascription.ToUpper()
                    };
                    if (registrar.Data.Codigo != 0)
                    {
                        ObjMessage.Title  = "Error al intentar registrar el nuevo contrato";
                        ObjMessage.Estado = registrar.Data.Codigo;
                    }
                }
                return(RedirectToAction("Contratos", "Contrato"));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 3
0
 public static async Task <ResultDTO <ErrorBE> > ModificarContrato(ContratoBE.ResponseContratoBE oPerfil)
 {
     try
     {
         string post = url + "Modificar";
         return(await ResultPCL <ErrorBE> .Post(post, oPerfil));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 4
0
 public Sp_Delete_ContratoResult EliminarContrato(ContratoBE.ResponseContratoBE objContratoBE)
 {
     try
     {
         var OnjResult = from a in model.Sp_Delete_Contrato(objContratoBE.IDContract, objContratoBE.Activo)
                         select a;
         return(OnjResult.Single());
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        public async Task <PartialViewResult> DatosContrato(int id)
        {
            try
            {
                var datos = await ContratosPCL.BuscarContrato(id);

                if (datos.Code != 200)
                {
                    throw new Exception(datos.Message);
                }

                ContratoBE.ResponseContratoBE duModel = datos.Data.response;

                return(PartialView("_DatosContrato", duModel));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public async Task <ActionResult> DeleteContrato(ContratoBE.ResponseContratoBE duModel)
        {
            if (Session[Sesiones.UsuarioLogin] == null)
            {
                Session.Clear();
                return(RedirectToAction("Index", "Login"));
            }
            try
            {
                var Usuariores = (BaseModel)Session[Sesiones.UsuarioLogin];
                var modificado = new ContratoBE.ResponseContratoBE
                {
                    IDContract = duModel.IDContract,
                    Activo     = duModel.Activo
                };

                var guardar = await ContratosPCL.ModificarContrato(modificado);

                if (guardar.Code != 200)
                {
                    throw new Exception(guardar.Message);
                }
                ModelState.Clear();
                ObjMessage = new MessageDialog()
                {
                    Title   = "Se eliminó correctamente al Contrato.",
                    Estado  = 0,
                    Message = guardar.Data.Message
                };
                if (guardar.Data.Codigo != 0)
                {
                    ObjMessage.Title  = "Error al intentar eliminar al Contrato";
                    ObjMessage.Estado = guardar.Data.Codigo;
                }
                return(RedirectToAction("Contratos"));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 7
0
 public Sp_Update_ContratoResult ModificarContrato(ContratoBE.ResponseContratoBE objContratoBE)
 {
     try
     {
         var OnjResult = from a in model.Sp_Update_Contrato(objContratoBE.IDContract
                                                            , objContratoBE.DraegerUser
                                                            , Convert.ToInt32(objContratoBE.Amount)
                                                            , Convert.ToInt32(objContratoBE.Company)
                                                            , objContratoBE.InitialDate
                                                            , objContratoBE.FinalDate
                                                            , Convert.ToInt32(objContratoBE.Quantity)
                                                            , objContratoBE.Dascription
                                                            , Convert.ToInt32(objContratoBE.Celular)
                                                            , objContratoBE.Email
                                                            , objContratoBE.Activo)
                         select a;
         return(OnjResult.Single());
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 8
0
        public Sp_Insert_ContratoResult RegistrarContrato(ContratoBE.ResponseContratoBE ObjRequestBE)
        {
            try
            {
                var OnjResult = from a in model.Sp_Insert_Contrato(ObjRequestBE.DraegerUser
                                                                   , Convert.ToInt32(ObjRequestBE.Amount)
                                                                   , Convert.ToInt32(ObjRequestBE.Company)
                                                                   , ObjRequestBE.InitialDate
                                                                   , ObjRequestBE.FinalDate
                                                                   , Convert.ToInt32(ObjRequestBE.Quantity)
                                                                   , ObjRequestBE.Dascription
                                                                   , Convert.ToInt32(ObjRequestBE.Celular)
                                                                   , ObjRequestBE.Email
                                                                   , ObjRequestBE.Activo)
                                select a;

                return(OnjResult.Single());
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public async Task <ActionResult> RegistrarContrato()
        {
            if (Session[Sesiones.UsuarioLogin] == null)
            {
                Session.Clear();
                return(RedirectToAction("Index", "Login"));
            }
            var Usuariores = (BaseModel)Session[Sesiones.UsuarioLogin];

            var Contrato = await ContratosPCL.ListarContratos();

            if (Contrato.Code != 200)
            {
                throw new Exception(Contrato.Message);
            }
            if (Contrato.Data == null)
            {
                throw new Exception("Error al intentar cargar perfiles");
            }

            var duModel = new ContratoBE.ResponseContratoBE
            {
                IDContract    = 0
                , DraegerUser = Usuariores.Usuario.DNI
                , Amount      = ""
                , Company     = 0
                , lCompany    = Contrato.Data.lresponse.FirstOrDefault().lCompany
                , lUsuario    = Contrato.Data.lresponse.FirstOrDefault().lUsuario
                , InitialDate = ""
                , FinalDate   = ""
                , Dascription = ""
                , Email       = ""
                , Activo      = true
            };

            return(PartialView("_RegistrarContrato", duModel));
        }
Esempio n. 10
0
 public Result RegistrarContrato(ContratoBE.ResponseContratoBE ObjRequestContratoBE)
 {
     try
     {
         var data = objContratoDA.RegistrarContrato(ObjRequestContratoBE);
         result.Data = data;
     }
     catch (SqlException sqlex)
     {
         result.Code    = Notification.OperationCode.ErrorDataBase.GetHashCode();;
         result.Message = sqlex.Message;
     }
     catch (CustomException cusex)
     {
         result.Code    = Notification.OperationCode.ErrorCustom.GetHashCode();;
         result.Message = cusex.Message;
     }
     catch (Exception ex)
     {
         result.Code    = Notification.OperationCode.ErrorNotControl.GetHashCode();;
         result.Message = ex.Message;
     }
     return(result);
 }
Esempio n. 11
0
 public IHttpActionResult Registrar(ContratoBE.ResponseContratoBE objContratoBE)
 {
     return(Ok(objContratoBL.RegistrarContrato(objContratoBE)));
 }
Esempio n. 12
0
 public IHttpActionResult Modificar(ContratoBE.ResponseContratoBE objContratoBE)
 {
     return(Ok(objContratoBL.ModificarContrato(objContratoBE)));
 }