public static ReturnObject Delete(HttpContext context, long id) { if (id <= 0) return new ReturnObject() { Error = true, Message = "Invalid Contact." }; var item = new Lib.Data.Contact(id); item.Delete(); return new ReturnObject() { Growl = new ReturnGrowlObject() { Type = "default", Vars = new ReturnGrowlVarsObject() { text = "You have successfully deleted a contact.", title = "Contact Deleted" } }, Actions = new List<ReturnActionObject>() { new ReturnActionObject() { Ele = "#contacts-table tr[data-id=\""+id.ToString()+"\"]", Type = "remove" } } }; }
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; } }
protected void Page_Init(object sender, EventArgs e) { BackHash = Request.QueryString["back-hash"]; ParentType = Request.QueryString["parent-type"]; ParentID = Request.QueryString["parent-id"]; string strID = Request.QueryString["id"]; long id; if (string.IsNullOrEmpty(strID) || !long.TryParse(strID, out id)) item = new Lib.Data.Contact(); else item = new Lib.Data.Contact(id); }
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 Edit(HttpContext context, long id, string back_hash, string first_name, string last_name, string phone, string email, string title = null, string prefix = null, string postfix = null, string fax = null) { Lib.Data.Contact item = null; if (id > 0) item = new Lib.Data.Contact(id); else item = new Lib.Data.Contact(); item.Prefix = prefix; item.FirstName = first_name; item.LastName = last_name; item.Postfix = postfix; item.Title = title; item.Email = email; item.Phone = phone; item.Fax = fax; item.Save(); return new ReturnObject() { Result = item, Redirect = new ReturnRedirectObject() { Hash = back_hash }, Growl = new ReturnGrowlObject() { Type = "default", Vars = new ReturnGrowlVarsObject() { text = "You have successfully saved this contact.", title = "Contact Saved" } } }; }
public static ReturnObject Provider(HttpContext context, string facility_size, string street1, string city, string state, string zip, string fname, string lname, string email, string street2 = null, string title = null, string company = null, string phone = null) { 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 c = new Lib.Data.Contact(); c.FirstName = fname; c.LastName = lname; c.Title = title; c.Email = email; c.Phone = phone; c.Save(); var p = new Lib.Data.Provider(); p.PrimaryContactID = c.ID.Value; p.AddressID = a.ID.Value; p.Name = company; p.FacilitySize = facility_size; p.Created = DateTime.Now; p.Save(); // TODO: Set mail settings in web.config /* var sb = new System.Text.StringBuilder(); sb.AppendLine("<html><body>"); sb.AppendLine("<b>Name</b>: " + lname + ", " + fname + "<br />"); sb.AppendLine("<b>Title</b>: " + title + "<br />"); sb.AppendLine("<b>Email</b>: " + email + "<br />"); sb.AppendLine("<b>Company</b>: " + company + "<br />"); sb.AppendLine("<b>Address</b>: <br />" + street1 + "<br />" + ((!string.IsNullOrEmpty(street2)) ? street2 + "<br />" : "") + city + ", " + state + " " + zip + "<br />"); sb.AppendLine("<b>Phone</b>: " + phone + "<br />"); sb.AppendLine("<b>Facility Size</b>: " + facility_size + "<br />"); sb.AppendLine("</body></html>"); var msg = new System.Net.Mail.MailMessage("*****@*****.**", "*****@*****.**"); msg.IsBodyHtml = true; msg.Subject = "Healthcare Provider Signup from REMSLogic Webite"; msg.Body = sb.ToString(); var client = new System.Net.Mail.SmtpClient("relay-hosting.secureserver.net"); client.Send(msg); sb = new System.Text.StringBuilder(); sb.AppendLine("<html><body>"); sb.AppendLine("Dear " + fname + " " + lname + ",<br /><br />"); sb.AppendLine("Thank you for your interest and for registering with us.<br /><br />"); sb.AppendLine("<b>We will contact you soon with more information or to schedule a demonstration.</b><br />This website is in final development stages.<br /><br />"); sb.AppendLine("</body></html>"); msg = new System.Net.Mail.MailMessage("*****@*****.**", email); msg.IsBodyHtml = true; msg.Subject = "Thank you for contacting REMSLogic"; msg.Body = sb.ToString(); client.Send(msg); */ var ret = new ReturnObject() { Error = false, StatusCode = 200, Message = "Message sent successfully", Redirect = new ReturnRedirectObject() { Url = "/Signup-HealthCare-Complete.aspx" } }; return ret; }
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; }