コード例 #1
0
        public ActionResult SearchEmail(List <string> additionalEmails)
        {
            var populatedEmails = additionalEmails.Where(e => e != null && e.ToString().Length > 0);

            if (populatedEmails != null && populatedEmails.Count() > 0)   //BEW FIX THIS? replace with client validation!
            {
                foreach (string email in populatedEmails)
                {
                    BAResult      result  = Shared.GetMyrcene("person/email?email=" + email);
                    List <Person> persons = JsonConvert.DeserializeAnonymousType(result.ResultData.ToString(), new List <Person>());
                    //GenericEntityData result = SOA.GetIQAResults("$/JoinNow/FindNonCompanyByEmail", email).FirstOrDefault();
                    //if (result != null)
                    if (persons.Count() > 0)
                    {
                        return(RedirectToAction("FoundMatch", "Account", new { matchedEmailAddress = email }));
                    }
                }
                TempData["NoSearchResults"] = "No search results were found.";
            }
            else
            {
                TempData["NoSearchResults"] = "At least one email is required for search.";
            }
            return(RedirectToAction("Index"));
        }
コード例 #2
0
        protected bool PopulateModel(LoginModel loginModel = null)
        {
            //try
            //{
            if (decryptedLink != null && Invitation != null)
            {
                string         imisID  = GetLinkProperty("IMIS_ID");
                BAResult       result  = Shared.GetMyrcene("company/" + imisID);
                Models.Company company = JsonConvert.DeserializeAnonymousType(Shared.GetMyrcene("company/" + imisID).ResultData.ToString(), new Models.Company());

                //MYRCENE GenericEntityData companyResult = SOA.GetIQAResults("$/JoinNow/CompanyByIMISID", imisID).FirstOrDefault();
                //string companyName = companyResult.GetEntityProperty("FullName");
                Session["InvitationTitle"] = "Company Roster Registration for " + company.InstituteName;
                string email = (loginModel != null && loginModel.Email != null) ? loginModel.Email : GetLinkProperty("Email");
                //MYRCENE
                Person inviteeResults = GetInvitee(email);
                //GenericEntityData inviteeResults = GetInvitee(email);
                string userName = String.Empty;
                //username will only be pre-populated (i.e., in GetLinkProperty("userName")) if user clicked a password reset link sent from this website.
                userName        = (loginModel != null && loginModel.Username != null) ? loginModel.Username : GetLinkProperty("userName");
                invitationModel = new InvitationModel
                {
                    InvitationID      = Invitation.InvitationID,
                    InvitationIMIS_ID = imisID,
                    InstituteName     = company.InstituteName,
                    SentDateTime      = Convert.ToDateTime(GetLinkProperty("SentDateTime")),
                    Email             = email,
                    AdditionalEmails  = new List <string>()
                    {
                        String.Empty, String.Empty, String.Empty
                    },
                    InviteeIMIS_ID   = inviteeResults.ContactID,          //GetEntityProperty("ID"),
                    InviteeCompanyID = inviteeResults.InstituteContactID, //GetEntityProperty("CompanyID"),
                    FirstName        = inviteeResults.FirstName,          //GetEntityProperty("FirstName"),
                    MiddleName       = inviteeResults.MiddleName,         //GetEntityProperty("MiddleName"),
                    LastName         = inviteeResults.LastName,           //GetEntityProperty("LastName"),
                    MemberType       = inviteeResults.CustomerType,       //GetEntityProperty("MemberType"),
                    WorkPhone        = company.WorkPhone,                 //companyResult.GetEntityProperty("WorkPhone"),
                    ResetPassword    = GetLinkProperty("passwordReset") == "passwordReset",
                    Username         = userName,
                    Password         = (loginModel != null) ? loginModel.Password : null,
                    ATSMethod        = (loginModel != null) ? loginModel.ATSMethod : ATS.Methods.NotInitialized
                };
                invitationModel.HasIMISAccount = !(String.IsNullOrEmpty(invitationModel.InviteeIMIS_ID) || String.IsNullOrEmpty(invitationModel.MemberType));
                return(true);
            }
            //}
            //catch (Exception ex)
            //{
            //    throw new Exception("Could not retrieve invitee data.");
            //}
            return(false);
        }
コード例 #3
0
ファイル: PEPDataPlugin.cs プロジェクト: aticucu/projects
    /// <summary>
    /// Gets the value.
    /// </summary>
    /// <returns>The value.</returns>
    /// <param name="name">Name.</param>
    /// <param name="def">Def.</param>
    private BAResult GetValue(string name, BAResult def)
    {
        string tmp = string.Empty;

        try
        {
            tmp = _MyActivityObject.Get <string> (name);
        }
        catch {
        }
        if (string.IsNullOrEmpty(tmp))
        {
            return(def);
        }
        else
        {
            return((BAResult)(int.Parse(tmp)));
        }
    }
コード例 #4
0
        private Person GetInvitee(string Email)
        {
            //Return the NM, EMP, or NEMP record first if exists, otherwise return other member types, such as AHA, etc.
            BAResult      result           = Shared.GetMyrcene("person/email?email=" + Email);
            List <string> validMemberTypes = new List <string>()
            {
                "EMP", "NEMP", "NM"
            };
            List <Person> persons = new List <Person>();

            if (result.ResultData != null)
            {
                persons = JsonConvert.DeserializeAnonymousType(result.ResultData.ToString(), new List <Person>());
                Person person = persons.Where(r => validMemberTypes.Contains(r.CustomerType)).FirstOrDefault();
                if (person != null)
                {
                    return(person);
                }
                else
                {
                    return(persons.FirstOrDefault());
                }
            }
            else
            {
                return(new Person());
            }



            //List<GenericEntityData> results = Shared.FindNonCompanyByEmail(Email);
            //List<string> validMemberTypes = new List<string>() { "EMP", "NEMP", "NM" };
            //GenericEntityData primaryResult = results.Where(r => validMemberTypes.Contains(r.GetEntityProperty("MemberType"))).FirstOrDefault();
            //if (primaryResult != null)
            //{
            //    return primaryResult;
            //}
            //else
            //{
            //    return results.FirstOrDefault();
            //}
        }
コード例 #5
0
        public ActionResult CreateAccount(InvitationModel model)
        {
            Person person       = new Person();
            string customerType = string.Empty;

            switch (model.MemberType)
            {
            case "SHOP":
                customerType = "AHAE";
                break;

            case "NSHOP":
                customerType = "NAHAE";
                break;

            default:
                customerType = "EMP";     //model.MemberType.StartsWith("N") ? "NEMP" : "EMP";
                break;
            }
            person.CustomerType       = customerType;
            person.FirstName          = model.FirstName;
            person.MiddleName         = model.MiddleName ?? String.Empty;
            person.LastName           = model.LastName;
            person.EmailAddress       = model.Email;
            person.Username           = model.Username;
            person.Password           = model.Password;
            person.WorkPhone          = model.WorkPhone;
            person.HomePhone          = model.HomePhone ?? String.Empty;
            person.InstituteName      = model.InstituteName;
            person.InstituteContactID = model.InvitationIMIS_ID;
            BAResult  baResult = new BAResult();
            ATSResult result   = new ATSResult();

            if (Shared.CanAddContact(model.InvitationIMIS_ID, model.FirstName, model.LastName, model.Email))
            {
                if (model.ATSMethod == ATS.Methods.CreateContact)
                {
                    //this is the first time through (NotInitialized) so we know we have to do a Create
                    baResult = Shared.PostMyrcene("person", person);
                    //result = Shared.CreateContact(model.FirstName,
                    //                                model.MiddleName ?? String.Empty,
                    //                                model.LastName,
                    //                                model.Email,
                    //                                model.Username,
                    //                                model.Password,
                    //                                model.WorkPhone,
                    //                                model.HomePhone ?? String.Empty,
                    //                                model.InstituteName,
                    //                                model.InvitationIMIS_ID
                    //                                );
                }
            }
            else if (model.ATSMethod == ATS.Methods.UpdateContact)
            {
                /* ATS wsContacts went ahead and created an account, even though one or more properties (such as "login id is already in use") were incorrect,
                 * so now we have to call it again and do an update. BUT....to do this, we need to find the ContactID from the account just created via an IQA.
                 */


                string updateContactID = SQL.GetContactID(model.InvitationIMIS_ID, model.FirstName, model.LastName, model.Email);
                person.ContactID = updateContactID;
                //((GenericEntityData)SOA.GetIQAResults("$/JoinNow/FindContactID",
                //                                                            model.InvitationIMIS_ID,
                //                                                            model.FirstName,
                //                                                            model.LastName,
                //                                                            model.Email).FirstOrDefault()).GetEntityProperty("ContactID");
                baResult = Shared.PutMyrcene("person", person);
                //Shared.UpdateContact(updateContactID,
                //                            model.FirstName,
                //                            model.MiddleName ?? String.Empty,
                //                            model.LastName,
                //                            model.Email,
                //                            model.Username,
                //                            model.Password,
                //                            model.WorkPhone,
                //                            model.HomePhone ?? String.Empty,
                //                            model.InstituteName,
                //                            model.InvitationIMIS_ID
                //                            );
            }
            else
            {
                TempData["ErrorMsg"] = "This account already exists. Please try again.";
                model.ATSMethod      = ATS.Methods.CreateContact;
            }

            if (baResult.ResultData == null)
            {
                TempData["ErrorMsg"] = baResult.ResultMessage; //"An unexpected error was encountered while creating a new account. Please try again.";
                model.ATSMethod      = ATS.Methods.CreateContact;
            }
            //reapply bandaid
            else if (baResult.ResultMessage != String.Empty)
            {
                string resultMessage = Shared.GetMyrcene("person/email?email=" + person.EmailAddress).ResultMessage;
                if (Shared.GetMyrcene("person/email?email=" + person.EmailAddress).ResultMessage != "Not Found")
                {
                    return(View("AddedToRoster"));
                }
            }
            //else if (result.ResultCode != 0 && result.ResultMessage != String.Empty)
            //{
            //    /* BEW BAND AID! I have intermittently seen "The operation has timed out", but this may have had something to do with the Shared.GetWebResponse request.Timeout not being set to
            //     * Timeout.Infinite, which it now IS set to. So what we'll do just in case it happens again, is assume that the ATS web service went ahead and created the account, so we're going
            //     * to check to see if it actually happened, and if so, we'll attempt to login.
            //     * The worst that should happen is that the login will fail.
            //     */
            //    if (result.ResultMessage.ToLower().Contains("The operation has timed out"))
            //    {
            //        if (Shared.FindContactID(model.InvitationIMIS_ID, model.FirstName, model.LastName, model.Email) != String.Empty)
            //        {
            //            return RedirectToAction("Login", model);
            //        }
            //    }

            //    /* Otherwise, so far it looks like a non-zero ResultCode with a populated ResultMessage is the result of such cases as when a login ID is already in use,
            //     * so redirect to UpdateAccount since the ATS webservice goes ahead and creates the account anyway.
            //     * And then all the user should need to do, for example, is update their loginID.
            //     */
            //    TempData["ErrorMsg"] = result.ResultMessage;
            //    model.ATSMethod = ATS.Methods.UpdateContact;
            //}
            else
            {
                return(View("AddedToRoster"));
            }
            return(RedirectToAction("NewAccount", model));
        }