Esempio n. 1
0
        public async Task <ActionResult> RegistrarDoctor()
        {
            if (Session[Sesiones.UsuarioLogin] == null)
            {
                Session.Clear();
                return(RedirectToAction("Index", "Login"));
            }

            var lDoctor = await MantenimientoPCL.ListarDoctores();

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

            var duModel = new DoctorBE.ResponseDoctoreBE
            {
                DNIdoctor  = "",
                Specialism = "",
                CMP        = "",
                RENumber   = "",
                Activo     = true,
                Company    = 1,
                lEmpresa   = lDoctor.Data.lresponse.FirstOrDefault().lEmpresa,
                lUsuario   = lDoctor.Data.lresponse.FirstOrDefault().lUsuario
            };

            return(PartialView("_RegistrarDoctor", duModel));
        }
Esempio n. 2
0
 public Result ModificarDoctor(DoctorBE.ResponseDoctoreBE objDoctorBE)
 {
     try
     {
         if (objDoctorBE.Activo.Equals(false))
         {
             var data = objDoctorDA.EliminarDoctor(objDoctorBE);
             result.Data = data;
         }
         else
         {
             var data = objDoctorDA.ModificarDoctor(objDoctorBE);
             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. 3
0
 public static async Task <ResultDTO <ErrorBE> > ModificarDoctor(DoctorBE.ResponseDoctoreBE usuario)
 {
     try
     {
         string post = urlD + "Modificar";
         return(await ResultPCL <ErrorBE> .Post(post, usuario));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 4
0
 public Sp_Delete_DoctorResult EliminarDoctor(DoctorBE.ResponseDoctoreBE objDoctorBE)
 {
     try
     {
         var OnjResult = from a in model.Sp_Delete_Doctor(objDoctorBE.IdDoctor, objDoctorBE.Activo)
                         select a;
         return(OnjResult.Single());
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 5
0
        public async Task <ActionResult> RegistrarDoctor(DoctorBE.ResponseDoctoreBE 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 DoctorBE.ResponseDoctoreBE
                    {
                        DNIdoctor  = duModel.DNIdoctor,
                        Specialism = duModel.Specialism,
                        CMP        = duModel.CMP,
                        RENumber   = duModel.RENumber,
                        Activo     = true,
                        Company    = duModel.Company
                    };
                    var registrar = await MantenimientoPCL.RegistrarDoctor(nuevo);

                    if (registrar.Code != 200)
                    {
                        throw new Exception(registrar.Message);
                    }
                    ObjMessage = new MessageDialog()
                    {
                        Title   = "Se registro correctamente el usuario.",
                        Estado  = 0,
                        Message = registrar.Data.Message
                    };
                    if (registrar.Data.Codigo != 0)
                    {
                        ObjMessage.Title  = "Error al intentar registrar el nuevo usuario";
                        ObjMessage.Estado = registrar.Data.Codigo;
                    }
                }
                return(RedirectToAction("Doctores", "Doctor"));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 6
0
        public async Task <ActionResult> DatosDoctor(DoctorBE.ResponseDoctoreBE duModel)
        {
            if (Session[Sesiones.UsuarioLogin] == null)
            {
                Session.Clear();
                return(RedirectToAction("Index", "Login"));
            }

            try
            {
                var Usuariores = (BaseModel)Session[Sesiones.UsuarioLogin];
                var modificado = new DoctorBE.ResponseDoctoreBE
                {
                    IdDoctor     = duModel.IdDoctor
                    , DNIdoctor  = duModel.DNIdoctor
                    , Specialism = duModel.Specialism
                    , CMP        = duModel.CMP
                    , RENumber   = duModel.RENumber
                    , Company    = duModel.Company
                    , Activo     = duModel.Activo
                };

                var guardar = await MantenimientoPCL.ModificarDoctor(modificado);

                if (guardar.Code != 200)
                {
                    throw new Exception(guardar.Message);
                }
                ModelState.Clear();
                ObjMessage = new MessageDialog()
                {
                    Title   = "Se modificó correctamente el usuario.",
                    Estado  = 0,
                    Message = guardar.Data.Message
                };
                if (guardar.Data.Codigo != 0)
                {
                    ObjMessage.Title  = "Error al intentar modificar el usuario";
                    ObjMessage.Estado = guardar.Data.Codigo;
                }
                return(RedirectToAction("Doctores"));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 7
0
 public Sp_Update_DoctorResult ModificarDoctor(DoctorBE.ResponseDoctoreBE objDoctorBE)
 {
     try
     {
         var OnjResult = from a in model.Sp_Update_Doctor(objDoctorBE.IdDoctor
                                                          , objDoctorBE.DNIdoctor
                                                          , objDoctorBE.Specialism
                                                          , objDoctorBE.CMP
                                                          , objDoctorBE.RENumber
                                                          , objDoctorBE.Company
                                                          , objDoctorBE.Activo)
                         select a;
         return(OnjResult.Single());
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 8
0
        public Sp_Insert_DoctorResult RegistrarDoctor(DoctorBE.ResponseDoctoreBE ObjRequestBE)
        {
            try
            {
                var OnjResult = from a in model.Sp_Insert_Doctor(ObjRequestBE.DNIdoctor
                                                                 , ObjRequestBE.Specialism
                                                                 , ObjRequestBE.CMP
                                                                 , ObjRequestBE.RENumber
                                                                 , ObjRequestBE.Company
                                                                 , ObjRequestBE.Activo)
                                select a;

                return(OnjResult.Single());
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 9
0
        public async Task <PartialViewResult> DatosDoctor(int id)
        {
            try
            {
                var datos = await MantenimientoPCL.GetDoctorById(id);

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

                DoctorBE.ResponseDoctoreBE duModel = datos.Data.response;

                return(PartialView("_DatosDoctor", duModel));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 10
0
 public Result RegistrarDoctor(DoctorBE.ResponseDoctoreBE ObjRequestDoctorBE)
 {
     try
     {
         var data = objDoctorDA.RegistrarDoctor(ObjRequestDoctorBE);
         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(DoctorBE.ResponseDoctoreBE objDoctorBE)
 {
     return(Ok(objDoctorBL.RegistrarDoctor(objDoctorBE)));
 }
Esempio n. 12
0
 public IHttpActionResult Modificar(DoctorBE.ResponseDoctoreBE objDoctorBE)
 {
     return(Ok(objDoctorBL.ModificarDoctor(objDoctorBE)));
 }