protected void Page_Init(object sender, EventArgs e) { string strID = Request.QueryString["id"]; long id; string strParentID = Request.QueryString["parent-id"]; long parent_id; if (!long.TryParse(strParentID, out parent_id)) RedirectHash("admin/drugs/companies/list"); Company = new Lib.Data.DrugCompany(parent_id); if (string.IsNullOrEmpty(strID) || !long.TryParse(strID, out id)) { item = new Lib.Data.DrugCompanyUser(); profile = new Lib.Data.UserProfile(); contact = new Lib.Data.Contact(); address = new Lib.Data.Address(); user = new Framework.Security.User(); } else { item = new Lib.Data.DrugCompanyUser(id); profile = item.Profile; user = profile.User; contact = profile.PrimaryContact; address = profile.PrimaryAddress; } }
public AppControlPage() : base() { IgnoreDrugSelection = false; if( User != null ) Profile = Lib.Data.UserProfile.FindByUser( User ); }
protected void Page_Init(object sender, EventArgs e) { string strID = Request.QueryString["id"]; long id; if( string.IsNullOrEmpty(strID) || !long.TryParse(strID,out id) ) item = new Lib.Data.UserProfile(); else item = new Lib.Data.UserProfile(id); user = item.User; if (user == null) user = new Framework.Security.User(); contact = item.PrimaryContact; if (contact == null) contact = new Lib.Data.Contact(); Groups = Framework.Security.Group.FindAll(); UserGroups = user.GetGroups(); UserTypes = Lib.Data.UserType.FindAll(); }
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; }