Beispiel #1
0
        protected void Page_Init(object sender, EventArgs e)
        {
            string strId = Request.QueryString["id"];
            long id;

            if (string.IsNullOrEmpty(strId) || !long.TryParse(strId, out id))
                Prescriber = new Lib.Data.Prescriber();
            else
                Prescriber = new Lib.Data.Prescriber(id);
        }
Beispiel #2
0
        public static ReturnObject Prescriber(HttpContext context, string username, string password, string email, string fname, string lname, string street1, string city, string state, string zip, string npiid, string company = null, string street2 = null, string phone = null)
        {
            string err;

            var user = Framework.Security.Manager.CreateUser(username, password, email, out err);

            if (!string.IsNullOrEmpty(err))
            {
                return new ReturnObject()
                {
                    Error = true,
                    StatusCode = 200,
                    Message = err
                };
            }

            user.AddGroup(Framework.Security.Group.FindByName("users"));
            user.AddGroup(Framework.Security.Group.FindByName("prescribers"));

            var c = new Lib.Data.Contact();
            c.Email = email;
            c.FirstName = fname;
            c.LastName = lname;
            c.Phone = phone;
            c.Save();

            var a = new Lib.Data.Address();
            a.Street1 = street1;
            a.Street2 = street2;
            a.City = city;
            a.State = state;
            a.Zip = zip;
            a.Country = "United States";
            a.Save();

            var ut = Lib.Data.UserType.FindByName("prescriber");

            var profile = new Lib.Data.UserProfile();
            profile.UserID = user.ID.Value;
            profile.UserTypeID = ut.ID.Value;
            profile.Created = DateTime.Now;
            profile.PrimaryAddressID = a.ID.Value;
            profile.PrimaryContactID = c.ID.Value;
            profile.Save();

            var p = new Lib.Data.Prescriber();
            p.ProfileID = profile.ID.Value;
            p.SpecialityID = 0;
            p.NpiId = npiid;
            p.Save();

            var pp = new Lib.Data.PrescriberProfile();
            pp.AddressID = a.ID.Value;
            pp.ContactID = c.ID.Value;
            pp.Deleted = false;
            pp.Expires = DateTime.Now.AddYears(1);
            pp.PrescriberID = p.ID.Value;
            pp.Save();

            // TODO: Redirect to Step2 to collect credit card info
            var ret = new ReturnObject()
            {
                Error = false,
                StatusCode = 200,
                Message = "",
                Redirect = new ReturnRedirectObject()
                {
                    Url = "/Signup-Prescriber-Complete.aspx"
                }
            };

            return ret;
        }