예제 #1
0
        public string Processar(Entity entidade)
        {
            if (entidade is Profile)
            {
                var dao           = new ProfileDAO();
                var Profile       = (Profile)entidade;
                var SearchProfile = new Profile();

                //Passando um  perfil soh com o rg
                SearchProfile.Rg = Profile.Rg;
                List <Entity> resultProfile = (List <Entity>)dao.VerificarRg(SearchProfile);
                if (resultProfile.Count > 0)
                {
                    return("Esse RG já está cadastrado!");
                }

                //Passando um  perfil soh com o cpf
                SearchProfile.Rg  = "";
                SearchProfile.Cpf = Profile.Cpf;
                resultProfile     = (List <Entity>)dao.VerificarCpf(SearchProfile);
                if (resultProfile.Count > 0)
                {
                    return("Esse CPF já está cadastrado!");
                }

                return(null);
            }
            return("Essa entidade não é do tipo usuário!");
        }
예제 #2
0
        public Profiles GetProfiles()
        {
            ProfileDAO profileDao = new ProfileDAO();
            Profiles   profiles   = new Profiles();

            profiles.profiles = profileDao.GetAll();

            return(profiles);
        }
예제 #3
0
        public JsonResult ListName(string q)
        {
            var data = new ProfileDAO().ListName(q);

            return(Json(new
            {
                data = data,
                status = true
            }, JsonRequestBehavior.AllowGet));
        }
예제 #4
0
        public void DeleteProfile(int id)
        {
            BillingSystemContext context = new BillingSystemContext();

            Profile profile = context.Profiles.FirstOrDefault(p => p.IDNumber == id);

            ProfileDAO dao = new ProfileDAO();

            dao.Delete(profile);
        }
예제 #5
0
        public void Add(
            string PhoneNumber,
            string Name)
        {
            BillingSystemContext context = new BillingSystemContext();

            Profile profile = new Profile()
            {
                PhoneNumber = PhoneNumber,
                Name        = Name
            };

            ProfileDAO dao = new ProfileDAO();

            dao.Insert(profile);
        }
        public string Processar(Entity entidade)
        {
            if (entidade is Profile)
            {
                var dao           = new ProfileDAO();
                var Profile       = (Profile)entidade;
                var SearchProfile = (Profile)entidade;

                SearchProfile.NickName = Profile.NickName;
                List <Entity> resultProfile = (List <Entity>)dao.VerificarNick(SearchProfile);
                if (resultProfile.Count > 0)
                {
                    return("Esse Nickname já está cadastrado!");
                }
            }
            return(null);
        }
예제 #7
0
        public ActionResult Save(Profile obj, int?[] ids)
        {
            ConnectionFactory conex = null;

            try
            {
                List <Restriction> lst = new List <Restriction>();

                foreach (var item in ids)
                {
                    lst.Add(new Restriction {
                        IdRestriction = (byte)item
                    });
                }

                obj.Restrictions = lst;

                conex = new ConnectionFactory();
                ProfileDAO dao = new ProfileDAO(conex);
                conex.BeginTran();

                if (obj.IdProfile == 0)
                {
                    dao.Insert(obj);
                    TempData["SuccessMsg"] = "Perfil salva com sucesso!";
                }
                else
                {
                    dao.Update(obj);
                    TempData["SuccessMsg"] = "Perfil Editada com sucesso!";
                }

                conex.Commit();
            }
            catch (Exception ex)
            {
                conex.Rollback();
                TempData["SuccessMsg"] = "";
                TempData["ErrorMsg"]   = String.Format("Falha ao salvar o perfil. {0}", ex.Message);

                return(View("Create", obj));
            }


            return(RedirectToAction("Index"));
        }
예제 #8
0
        public void UpdateProfile(
            string PhoneNumber,
            string Name,
            int IDNumber)
        {
            BillingSystemContext context = new BillingSystemContext();

            Profile profile = new Profile()
            {
                PhoneNumber = PhoneNumber,
                Name        = Name,
                IDNumber    = IDNumber
            };

            ProfileDAO dao = new ProfileDAO();

            dao.Update(profile);
        }
예제 #9
0
        public ActionResult Edit(int?id)
        {
            if (id == null || id == 0)
            {
                return(RedirectToAction("Create"));
            }
            try
            {
                Profile profile = new ProfileDAO(new ConnectionFactory()).Select((int)id);

                List <Restriction> restrictions = new RestrictionDAO(new ConnectionFactory()).Select();

                foreach (var restriction in restrictions)
                {
                    foreach (var profileRestriction in profile.Restrictions)
                    {
                        if (restriction.IdRestriction == profileRestriction.IdRestriction)
                        {
                            restriction.Checked = "checked";
                            break;
                        }
                        else
                        {
                            restriction.Checked = "";
                        }
                    }
                }

                profile.Restrictions = restrictions;

                return(View(profile));
            }
            catch (KeyNotFoundException ex)
            {
                TempData["ErrorMsg"] = ex.Message;
                return(View());
            }
            catch (Exception ex)
            {
                TempData["ErrorMsg"] = String.Format("Erro ao editar o Perfil. {0}", ex.Message);
                return(View());
            }
        }
예제 #10
0
        public List <UserProfileDto> GetUserProfiles()
        {
            UsersBLL usersBll            = new UsersBLL();
            List <UserProfileDto> output = new List <UserProfileDto>();

            foreach (Users u in usersBll.GetUsers())
            {
                UserProfileDto dto = new UserProfileDto();
                dto.IDNumber = u.IDNumber;
                dto.UserName = u.UserName;
                dto.Email    = u.Email;
                ProfileDAO profileDao = new ProfileDAO();
                Profile    profile    = profileDao.Details(u.ProfileID);

                dto.Name        = profile.Name;
                dto.PhoneNumber = profile.PhoneNumber;

                output.Add(dto);
            }

            return(output);
        }
예제 #11
0
        public int UpdateProfile(string email, string fname, string lname, string bio, string country, string phone, string language, string nickname, string dob, string image)
        {
            ProfileDAO dao = new ProfileDAO();

            return(dao.UpdateById(email, fname, lname, bio, country, phone, language, nickname, dob, image));
        }
예제 #12
0
        public int LoginCheckBy(string email, string password)
        {
            ProfileDAO DAO = new ProfileDAO();

            return(DAO.LoginCheck(email, password));
        }
        public IActionResult ViewProfile()
        {
            ProfileDAO dao = new ProfileDAO();

            return(View(dao.GetAll()));
        }
        public IActionResult ViewAllRegisteredProfiles()
        {
            ProfileDAO dao = new ProfileDAO();

            return(View(dao.GetAll()));
        }
예제 #15
0
        public Profile GetProfile(int id)
        {
            ProfileDAO profileDao = new ProfileDAO();

            return(profileDao.Details(id));
        }
예제 #16
0
        public List <Profiles> GetAllProfiles()
        {
            ProfileDAO DAO = new ProfileDAO();

            return(DAO.SelectAll());
        }
        public string getProfileInformation(string s, ProfileDAO profile, int i)
        {
            string pn = profile.name;

            return(pn);
        }
예제 #18
0
        public int GetPostCountById(string accid)
        {
            ProfileDAO DAO = new ProfileDAO();

            return(DAO.CountQuestionsById(accid));
        }
예제 #19
0
        public Profiles GetProfileById(string email)
        {
            ProfileDAO DAO = new ProfileDAO();

            return(DAO.SelectById(email));
        }
예제 #20
0
        public Facade()
        {
            _daos = new Dictionary <Type, IDAO>();
            _rns  = new Dictionary <Type, Dictionary <string, List <IStrategy> > >();

            // regras de negócio genéricas
            var VerificarId = new VerificarId();

            // USER FACADE
            var UserDAO = new UserDAO();

            _daos.Add(new User().GetType(), UserDAO);

            // regras de negócio User
            var CriptografarSenha            = new CriptografarSenha();
            var ConfirmarSenhaAntiga         = new ConfirmarSenhaAntiga();
            var CriptografarNovaSenha        = new CriptografarNovaSenha();
            var VerificarConfirmacaoSenha    = new VerificarConfirmacaoSenha();
            var VerificarExistenciaEmail     = new VerificarExistenciaEmail();
            var VerificarCamposNulosCadastro = new VerificarCamposNulosCadastro();
            var VerificarCamposNulosAlterar  = new VerificarCamposNulosAlterar();
            var VerificarInexistenciaEmail   = new VerificarInexistenciaEmail();
            var ConfirmarNovaSenha           = new ConfirmarNovaSenha();

            List <IStrategy> rnsSalvarUser = new List <IStrategy>();

            rnsSalvarUser.Add(VerificarCamposNulosCadastro);
            rnsSalvarUser.Add(VerificarConfirmacaoSenha);
            rnsSalvarUser.Add(CriptografarSenha);
            rnsSalvarUser.Add(VerificarExistenciaEmail);

            List <IStrategy> rnsConsultarUser = new List <IStrategy>();

            rnsConsultarUser.Add(VerificarCamposNulosCadastro);
            rnsConsultarUser.Add(CriptografarSenha);
            rnsConsultarUser.Add(VerificarInexistenciaEmail);

            List <IStrategy> rnsAlterarUser = new List <IStrategy>();

            rnsAlterarUser.Add(VerificarCamposNulosCadastro);
            rnsAlterarUser.Add(VerificarCamposNulosAlterar);
            rnsAlterarUser.Add(VerificarId);
            rnsAlterarUser.Add(ConfirmarNovaSenha);
            rnsAlterarUser.Add(CriptografarSenha);
            rnsAlterarUser.Add(ConfirmarSenhaAntiga);
            rnsAlterarUser.Add(CriptografarNovaSenha);


            List <IStrategy> rnsExcluirUser = new List <IStrategy>();

            rnsExcluirUser.Add(VerificarId);

            var rnsUser = new Dictionary <string, List <IStrategy> >();

            rnsUser.Add("CONSULTAR", rnsConsultarUser);
            rnsUser.Add("SALVAR", rnsSalvarUser);
            rnsUser.Add("ALTERAR", rnsAlterarUser);
            rnsUser.Add("EXCLUIR", rnsExcluirUser);

            _rns.Add(new User().GetType(), rnsUser);



            // PROFILE FACADE
            var ProfileDAO = new ProfileDAO();

            _daos.Add(new Profile().GetType(), ProfileDAO);

            // regras de negócio Profile
            var VerificarUserId = new VerificarUserId();

            var VerificarCamposObrigatorios = new VerificarCamposObrigatorios();
            var VerificarCpfValido          = new VerificarCpfValido();
            var VerficarRgCpfUnicos         = new VerficarRgCpfUnicos();
            var VerificarNicknameUnico      = new VerificarNicknameUnico();

            List <IStrategy> rnsSalvarProfile = new List <IStrategy>();

            //rnsSalvarProfile.Add(VerificarUserId);
            rnsSalvarProfile.Add(VerificarCamposObrigatorios);
            rnsSalvarProfile.Add(VerificarCpfValido);
            rnsSalvarProfile.Add(VerficarRgCpfUnicos);
            rnsSalvarProfile.Add(VerificarNicknameUnico);

            List <IStrategy> rnsConsultarProfile = new List <IStrategy>();

            rnsConsultarProfile.Add(VerificarId);

            var rnsProfile = new Dictionary <string, List <IStrategy> >();

            rnsProfile.Add("CONSULTAR", rnsConsultarProfile);
            rnsProfile.Add("SALVAR", rnsSalvarProfile);

            _rns.Add(new Profile().GetType(), rnsProfile);


            //Address FACADE
            var AddressDAO = new AddressDAO();

            _daos.Add(new Address().GetType(), AddressDAO);

            // regras de negócio Address
            var VerificarCamposObrigatoriosEnd = new VerificarCamposObrigatoriosEnd();
            var VerificarNomeUnico             = new VerificarNomeUnico();
            var VerificarCampoObgAltEnd        = new VerificarCampoObrigatorioAlteracaoEnd();

            List <IStrategy> rnsSalvarAddress = new List <IStrategy>();

            rnsSalvarAddress.Add(VerificarCamposObrigatoriosEnd);
            rnsSalvarAddress.Add(VerificarNomeUnico);

            List <IStrategy> rnsConsultarAddress = new List <IStrategy>();

            List <IStrategy> rnsAlterarAddress = new List <IStrategy>();

            rnsAlterarAddress.Add(VerificarNomeUnico);
            rnsAlterarAddress.Add(VerificarCampoObgAltEnd);

            List <IStrategy> rnsExcluirAddress = new List <IStrategy>();

            var rnsAddress = new Dictionary <string, List <IStrategy> >();

            rnsAddress.Add("CONSULTAR", rnsConsultarAddress);
            rnsAddress.Add("SALVAR", rnsSalvarAddress);
            rnsAddress.Add("ALTERAR", rnsAlterarAddress);
            rnsAddress.Add("EXCLUIR", rnsExcluirAddress);

            _rns.Add(new Address().GetType(), rnsAddress);



            // PROFILE FACADE
            //var ProfileDAO = new ProfileDAO();

            //_daos.Add(new Profile().GetType(), ProfileDAO);

            //// regras de negócio Profile

            //List<IStrategy> rnsSalvarProfile = new List<IStrategy>();

            //List<IStrategy> rnsConsultarProfile = new List<IStrategy>();

            //List<IStrategy> rnsAlterarProfile = new List<IStrategy>();

            //List<IStrategy> rnsExcluirProfile = new List<IStrategy>();

            //var rnsProfile = new Dictionary<string, List<IStrategy>>();

            //rnsProfile.Add("CONSULTAR", rnsConsultarProfile);
            //rnsProfile.Add("SALVAR", rnsSalvarProfile);
            //rnsProfile.Add("ALTERAR", rnsAlterarProfile);
            //rnsProfile.Add("EXCLUIR", rnsExcluirProfile);

            //_rns.Add(new Profile().GetType(), rnsProfile);
        }
예제 #21
0
        public int AddProfile()
        {
            ProfileDAO DAO = new ProfileDAO();

            return(DAO.Insert(this));
        }
        public ProfileDAO getProfileInformation(ProfileDAO profile, string s, int i)
        {
            string p3 = s;

            return(p3);
        }
        public string getProfileInformation(string s, ProfileDAO profile, int i)
        {
            string p2 = s;

            return(p2);
        }
예제 #24
0
 public ProfileBO()
 {
     _dao = new ProfileDAO();
 }
예제 #25
0
파일: Profile.cs 프로젝트: igmar/HUSACCT
 //FR5.5
 public string getProfileInformation(ProfileDAO dao)
 {
     return "";
 }
예제 #26
0
        public bool CargarExpedienteCompleto(ref DocumentoOriginacion documents, HttpPostedFileBase hpf)
        {
            try
            {
                documents.nombreDoc = documents.nombreDoc.Replace("Ñ", "N").Replace("ñ", "n");
                documents.nombreDoc = documents.nombreDoc.Replace("á", "a").Replace("é", "e").Replace("í", "i").Replace("ó", "o").Replace("ú", "u");
                documents.nombreDoc = documents.nombreDoc.Replace("Á", "A").Replace("É", "E").Replace("Í", "I").Replace("Ó", "O").Replace("Ú", "U");

                Regex regex = new Regex("(.pdf|.png|.jpeg|.jpg)$");

                Match match = regex.Match(documents.nombreDoc);

                String extension = "";

                if (match.Success)
                {
                    extension = match.Value;
                }
                documents.path  = $@"{ConfigurationManager.AppSettings["rutaRaiz"]}\DOCUMENTOS_ORIGINACION \\" + documents.folder + "\\" + documents.dependencia;
                documents.path += (documents.producto != null) ? "\\" + documents.producto : "";
                var firma      = (documents.firma == 1) ? "_firma" : "";
                var expediente = (documents.expedienteCompleto == 1) ? "_expediente_completo" : "";
                documents.nombreDoc = regex.Replace(documents.nombreDoc, "_" + firma + expediente + extension);
                documents.nombreDoc = documents.nombreDoc.Replace(" ", "_");
                if (!Directory.Exists(documents.path))
                {
                    Directory.CreateDirectory(documents.path + "\\" + documents.folder + "\\" + documents.dependencia);
                }

                if (File.Exists(documents.path + "\\" + documents.nombreDoc))
                {
                    File.Delete(documents.path + "\\" + documents.nombreDoc);
                }
                var savedFileName = Path.Combine(documents.path, documents.nombreDoc);
                hpf.SaveAs(savedFileName);
                LogHelper.WriteLog("Models", "ManageDocuments", "CargarArchivo", new Exception(), "Guarda Expediente Completo");
                if (!File.Exists(savedFileName))
                {
                    documents.msg.errorCode    = "300";
                    documents.msg.errorMessage = "Error Al subir el Archivo Intente Nuevamente";
                    LogHelper.WriteLog("Models", "ManageDocuments", "CargarArchivo", null, savedFileName);
                    return(false);
                }
                documents.file = null;
                documents.path = savedFileName;
                ProfileDAO dao    = new ProfileDAO();
                var        existe = dao.docExisteExpendiente(documents.folder);
                if (existe[0] == "0")
                {
                    documents.msg = dao.cargaDocumentosOriginacion(ref documents);
                }
                else
                {
                    documents.msg = dao.actualizaDocOriginacion(double.Parse(existe[2]), documents.folder, documents.nombreDoc, documents.path);
                }
                LogHelper.WriteLog("Models", "ManageDocuments", "CargarArchivo", new Exception(), "Guarda Expediente Completo BD");
                return(true);
            }
            catch (Exception e)
            {
                documents.msg.errorCode    = "320";
                documents.msg.errorMessage = "Error Al subir el Archivo Intente Nuevamente";
                LogHelper.WriteLog("Models", "ManageDocuments", "CargarArchivo", e, documents.nombreDoc);
                return(false);
            }
        }