public OrganizationAccountResponse GetStateList(OrganizationAccountRequest Request)
        {
            OrganizationAccountResponse Response = new OrganizationAccountResponse();

            Response = _iDataService.GetStateList(Request);
            return(Response);
        }
        public OrganizationAccountResponse GetUserOrgId(OrganizationAccountRequest Request)
        {
            OrganizationAccountResponse Response = new OrganizationAccountResponse();

            Response = _iDataService.GetUserOrgId(Request);
            return(Response);
        }
示例#3
0
        public OrganizationAccountResponse CreateAccount(OrganizationAccountRequest AccountRequest)

        {
            OrganizationAccountResponse OrganizationAccountResponse = _iOrgAccountRepository.CreateAccount(AccountRequest);

            return(OrganizationAccountResponse);
        }
        public OrganizationAccountResponse CreateAccount(OrganizationAccountRequest Request)
        {
            OrganizationAccountResponse Response = new OrganizationAccountResponse();

            Response = _iDataService.CreateAccount(Request);
            return(Response);
        }
示例#5
0
        public OrganizationAccountResponse GetOrg(OrganizationAccountRequest Request)
        {
            OrganizationAccountResponse Response = new OrganizationAccountResponse();

            Response = _iOrgAccountRepository.GetOrg(Request);

            return(Response);
        }
示例#6
0
        public OrganizationAccountResponse GetStateList(OrganizationAccountRequest Request)
        {
            OrganizationAccountResponse OrgAccountResponse = new OrganizationAccountResponse();

            try
            {
                Epi.Web.Interfaces.DataInterfaces.IStateDao StateDao = new EF.EntityStateDao();
                Epi.Web.BLL.Account Implementation = new Epi.Web.BLL.Account(StateDao);

                OrgAccountResponse.StateList = Mapper.ToStateDTO(Implementation.GetStateList());
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(OrgAccountResponse);
        }
示例#7
0
        public OrganizationAccountResponse GetUserOrgId(OrganizationAccountRequest Request)
        {
            OrganizationAccountResponse Response = new OrganizationAccountResponse();

            try
            {
                Epi.Web.Interfaces.DataInterfaces.IAdminDao        AdminDao        = new EF.EntityAdminDao();
                Epi.Web.Interfaces.DataInterfaces.IOrganizationDao OrganizationDao = new EF.EntityOrganizationDao();
                Epi.Web.BLL.Account Implementation = new Epi.Web.BLL.Account(AdminDao, OrganizationDao);
                Response.OrganizationDTO = new OrganizationDTO();
                Response.OrganizationDTO.OrganizationKey = Implementation.GetUserOrgId(Request.Admin.AdminEmail);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(Response);
        }
示例#8
0
        public OrganizationAccountResponse CreateAccount(OrganizationAccountRequest pRequest)
        {
            OrganizationAccountResponse OrgAccountResponse = new OrganizationAccountResponse();

            try {
                Epi.Web.Interfaces.DataInterfaces.IAdminDao        AdminDao        = new EF.EntityAdminDao();
                Epi.Web.Interfaces.DataInterfaces.IOrganizationDao OrganizationDao = new EF.EntityOrganizationDao();
                Epi.Web.BLL.Account Implementation = new Epi.Web.BLL.Account(AdminDao, OrganizationDao);
                var Organization = Mapper.ToBusinessObject(pRequest.Organization);
                var Admin        = Mapper.ToBusinessObject(pRequest.Admin);
                OrgAccountResponse.Message = Implementation.CreateAccount(pRequest.AccountType, Admin, Organization);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(OrgAccountResponse);
        }
示例#9
0
        //[ValidateAntiForgeryToken]
        public ActionResult Index()
        {
            OrganizationAccountResponse Response = new OrganizationAccountResponse();
            OrganizationAccountRequest  Request  = new OrganizationAccountRequest();
            string AccountType = ConfigurationManager.AppSettings["ACCOUNT_TYPE"];
            string version     = Assembly.GetExecutingAssembly().GetName().Version.ToString();

            ViewBag.Version = version;
            string           filepath = Server.MapPath("~\\Content\\Text\\TermOfUse.txt");
            string           content  = string.Empty;
            AccountInfoModel Model    = new AccountInfoModel();

            // Model.AccountType = ConfigurationManager.AppSettings["ACCOUNT_TYPE"];
            try
            {
                using (var stream = new StreamReader(filepath))
                {
                    content = stream.ReadToEnd();
                }
            }
            catch (Exception exc)
            {
            }
            ViewData["TermOfUse"] = content;

            Response = _isurveyFacade.GetStateList(Request);
            //Model.States.Add(new SelectListItem { Text = "Select a State", Value = "0" });

            foreach (var item in Response.StateList)
            {
                Model.States.Add(new SelectListItem {
                    Text = item.StateName, Value = item.StateId.ToString()
                });
            }
            if (string.IsNullOrEmpty(AccountType))
            {
                return(View("AccessDenied"));
            }
            else
            {
                return(View(Model));
            }
        }
示例#10
0
        public OrganizationAccountResponse GetOrganization(OrganizationAccountRequest request)
        {
            OrganizationAccountResponse OrgAccountResponse = new OrganizationAccountResponse();

            try
            {
                Epi.Web.Interfaces.DataInterfaces.IOrganizationDao OrgDao = new EF.EntityOrganizationDao();
                Epi.Web.BLL.Account Implementation = new Epi.Web.BLL.Account(null, OrgDao);
                OrganizationBO      OrgInfo        = Implementation.GetOrganization(request.Organization.OrganizationKey);
                if (OrgInfo != null)
                {
                    OrgAccountResponse.OrganizationDTO = Mapper.ToDataTransferObjects(OrgInfo);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(OrgAccountResponse);
        }
示例#11
0
        public OrganizationAccountResponse GetStateList(OrganizationAccountRequest Request)
        {
            OrganizationAccountResponse OrganizationAccountResponse = _iOrgAccountRepository.GetStateList(Request);

            return(OrganizationAccountResponse);
        }
        public ActionResult Index()
        {
            string       content = string.Empty;
            PublishModel Model   = new PublishModel();

            ViewBag.Version = Assembly.GetExecutingAssembly().GetName().Version.ToString();
            var IsAuthenticated = System.Web.HttpContext.Current.User.Identity.IsAuthenticated;

            Session["IsAuthenticated"] = false;
            Session["IsNewOrg"]        = false;
            string filepath = Server.MapPath("~\\Content\\Text\\TermOfUse.txt");

            try
            {
                using (var stream = new StreamReader(filepath))
                {
                    content = stream.ReadToEnd();
                }
            }
            catch (Exception exc)
            {
            }
            ViewData["TermOfUse1"] = content;
            if (IsAuthenticated)
            {
                Session["IsAuthenticated"] = Model.IsAuthenticated = IsAuthenticated;
                //check if the user exists
                var UserName = System.Web.HttpContext.Current.User.Identity.Name;
                OrganizationAccountRequest Request = new OrganizationAccountRequest();
                Request.Admin            = new AdminDTO();
                Request.Admin.AdminEmail = UserName;
                OrganizationAccountResponse Response = this._isurveyFacade.GetUserOrgId(Request);
                var OrgId = "";
                if (!string.IsNullOrEmpty(Response.OrganizationDTO.OrganizationKey))
                {
                    OrgId = Epi.Web.Common.Security.Cryptography.Decrypt(Response.OrganizationDTO.OrganizationKey);
                }
                if (Epi.Web.MVC.Utility.SurveyHelper.IsGuid(OrgId))
                {
                    Model.OrganizationKey = OrgId;
                    Model.IsValidOrg      = ValidateOrganizationId(Model.OrganizationKey);

                    if (!Model.IsValidOrg)
                    {
                        ModelState.AddModelError("OrganizationKey", "Organization Key does not exist.");
                    }
                    else
                    {
                        Session["OrgId"] = Model.OrganizationKey;

                        Model.SurveyNameList = ViewBag.SurveyNameList1 = GetAllSurveysByOrgId(Model.OrganizationKey);;
                    }
                }
                else
                {
                    // create a new account
                    Request.AccountType               = "ORGANIZATION";
                    Request.Admin.IsActive            = true;
                    Request.Admin.Notify              = false;
                    Request.Organization              = new OrganizationDTO();
                    Request.Organization.Organization = UserName.Replace("\\", " ") + "_Organization";
                    Request.Organization.IsEnabled    = true;
                    Guid OrgKey = Guid.NewGuid();
                    Request.Organization.OrganizationKey = OrgKey.ToString();

                    Response = this._isurveyFacade.CreateAccount(Request);
                    if (Response.Message == "Success")
                    {
                        Model.OrganizationKey = OrgKey.ToString();
                        Model.IsValidOrg      = ValidateOrganizationId(Model.OrganizationKey);

                        if (!Model.IsValidOrg)
                        {
                            ModelState.AddModelError("OrganizationKey", "Organization Key does not exist.");
                        }
                        else
                        {
                            Session["OrgId"]     = Model.OrganizationKey;
                            ViewBag.IsNewOrg     = Session["IsNewOrg"] = true;
                            Model.SurveyNameList = ViewBag.SurveyNameList1 = GetAllSurveysByOrgId(Model.OrganizationKey);;
                        }
                    }
                }
                Model.PublishDivState = true;
                return(View("Index", Model));
            }
            else
            {
                Model.PublishDivState = true;
                return(View("Index", Model));
            }
        }
示例#13
0
        public ActionResult Index(Epi.Web.MVC.Models.AccountInfoModel AccountInfo)
        {
            string filepath            = Server.MapPath("~\\Content\\Text\\TermOfUse.txt");
            string content             = string.Empty;
            string AccountType         = ConfigurationManager.AppSettings["ACCOUNT_TYPE"];
            string ApplicantValidation = ConfigurationManager.AppSettings["APPLICANT_VALIDATION_IS_ENABLED"];

            try
            {
                using (var stream = new StreamReader(filepath))
                {
                    content = stream.ReadToEnd();
                }
            }
            catch (Exception exc)
            {
            }
            ViewData["TermOfUse"] = content;

            try
            {
                OrganizationAccountResponse Response      = new OrganizationAccountResponse();
                OrganizationAccountResponse StateResponse = new OrganizationAccountResponse();
                OrganizationAccountRequest  Request       = new OrganizationAccountRequest();
                AdminDTO        AdminDTO        = new AdminDTO();
                OrganizationDTO OrganizationDTO = new OrganizationDTO();
                Guid            OrgKey          = Guid.NewGuid();
                Guid            AdminKey        = Guid.NewGuid();

                AdminDTO.AdminEmail       = AccountInfo.Email;
                AdminDTO.FirstName        = AccountInfo.FirstName;
                AdminDTO.LastName         = AccountInfo.LastName;
                AdminDTO.PhoneNumber      = AccountInfo.PhoneNumber;
                AdminDTO.AdressLine1      = AccountInfo.AdressLine1;
                AdminDTO.AdressLine2      = AccountInfo.AdressLine2;
                AdminDTO.City             = AccountInfo.City;
                AdminDTO.StateId          = AccountInfo.SelectedState;
                AdminDTO.Zip              = AccountInfo.Zip;
                AdminDTO.IsActive         = true;
                OrganizationDTO.IsEnabled = true;


                OrganizationDTO.Organization = AccountInfo.OrgName;

                OrganizationDTO.OrganizationKey = OrgKey.ToString();
                Request.AccountType             = AccountType;
                Request.Organization            = OrganizationDTO;
                Request.Admin = AdminDTO;
                if (AccountType.ToUpper() != "USER")
                {
                    this.ModelState.Remove("LastName");
                    this.ModelState.Remove("FirstName");
                    this.ModelState.Remove("PhoneNumber");

                    this.ModelState.Remove("AdressLine1");

                    this.ModelState.Remove("City");
                    this.ModelState.Remove("State");
                    this.ModelState.Remove("Zip");
                }
                StateResponse = _isurveyFacade.GetStateList(Request);

                foreach (var item in StateResponse.StateList)
                {
                    AccountInfo.States.Add(new SelectListItem {
                        Text = item.StateName, Value = item.StateId.ToString()
                    });
                }
                if (ModelState.IsValid)
                {
                    Response = _isurveyFacade.CreateAccount(Request);
                }
                else
                {
                    return(View(AccountInfo));
                }

                if (Response.Message.ToUpper() == "SUCCESS")
                {
                    AccountInfo.Status = "SUCCESS";
                    return(View(AccountInfo));
                }
                else
                {
                    if (AccountType.ToUpper() == "USER")
                    {
                        ModelState.AddModelError("Error", "This organization name and/or email address already exists.");
                    }
                    else
                    {
                        ModelState.AddModelError("Error", "This organization name already exists.");
                    }
                    return(View(AccountInfo));
                }
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("Error", "An error occurred while trying to create an account. Please try again later.");
                return(View(AccountInfo));
            }
        }