Пример #1
0
        public static ReturnObject Edit(HttpContext context, string url, string token, string expiration_date, string created_for)
        {
            IRestrictedLinkRepository linkRepo = ObjectFactory.GetInstance<IRestrictedLinkRepository>();

            linkRepo.Save(new RestrictedLink
            {
                Url = url,
                Token = Guid.Parse(token),
                ExpirationDate = DateTime.Parse(expiration_date),
                CreatedFor = created_for
            });

            var ret = new ReturnObject {
                Growl = new ReturnGrowlObject {
                    Type = "default",
                    Vars = new ReturnGrowlVarsObject {
                        text = "You have successfully created a new video link.",
                        title = "File Uploaded"
                    }
                },
                Redirect = new ReturnRedirectObject {
                    Hash = "admin/video-links/list"
                }
            };

            return ret;
        }
Пример #2
0
        public static ReturnObject Prefs(HttpContext context, long? id = null, /*int email_frequency,*/ bool email_notifications = false)
        {
            var item = new UserPreferences(id);

            User currentUser = Framework.Security.Manager.GetUser();

            if(currentUser == null || currentUser.ID == null)
                return new ReturnObject { Error = true, Message = "Invalid user specified." };

            item.UserId = currentUser.ID.Value;
            item.EmailNotifications = email_notifications;
            item.Save();

            var ret = new ReturnObject()
            {
                Result = null,
                Growl = new ReturnGrowlObject()
                {
                    Type = "default",
                    Vars = new ReturnGrowlVarsObject()
                    {
                        text = "You have successfully updated your preferences.",
                        title = "Preferences Saved"
                    }
                }
            };

            return ret;
        }
Пример #3
0
        public static ReturnObject Submit(HttpContext context, string name, string email, string subject, string message)
        {
            var sb = new System.Text.StringBuilder();

            sb.AppendLine("<html><body>");
            sb.AppendLine("<b>Name</b>: " + name + "<br />");
            sb.AppendLine("<b>Email</b>: " + email + "<br />");
            sb.AppendLine("<b>Subject</b>: " + subject + "<br />");
            sb.AppendLine("<b>Message</b>:<br />" + message + "<br />");
            sb.AppendLine("</body></html>");

            //var msg = new System.Net.Mail.MailMessage("*****@*****.**", "*****@*****.**");
            var msg = new System.Net.Mail.MailMessage("*****@*****.**", "*****@*****.**");
            //var msg = new System.Net.Mail.MailMessage("*****@*****.**", "*****@*****.**");
            msg.IsBodyHtml = true;
            msg.Subject = "Contact Message from REMSLogic Webite";
            msg.Body = sb.ToString();

            var client = new System.Net.Mail.SmtpClient("relay-hosting.secureserver.net");
            //var client = new System.Net.Mail.SmtpClient("smtpout.secureserver.net");
            //client.Credentials = new System.Net.NetworkCredential("*****@*****.**", "Safety1");
            //client.EnableSsl = false;
            client.Send(msg);

            sb = new System.Text.StringBuilder();

            sb.AppendLine("<html><body>");
            sb.AppendLine("Dear " + name + ",<br /><br />");
            sb.AppendLine("Thank you for your interest and for contacting us.<br /><br />");
            sb.AppendLine("<b>We will respond as soon as possible.</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"
            };

            return ret;
        }
Пример #4
0
        public static ReturnObject Upload(HttpContext context, string parent_type, long parent_id)
        {
            var file = context.Request.Files["file"];
            string path = context.Server.MapPath("~/upload/" + parent_type + "/" + parent_id.ToString() + "/");

            if( !Directory.Exists(path) )
                Directory.CreateDirectory(path);

            string ext = Path.GetExtension(file.FileName);

            string fn = Guid.NewGuid().ToString()+ext;

            while( File.Exists(Path.Combine(path,fn)) )
                fn = Guid.NewGuid().ToString() + ext;

            fn = Path.Combine(path,fn);

            file.SaveAs( fn );

            var item = new Data.File();
            item.ParentType = parent_type;
            item.ParentID = parent_id;
            item.Path = fn;
            item.Name = file.FileName;
            item.ContentType = file.ContentType;
            item.Save();

            var ret = new ReturnObject() {
                Result = MapPathReverse(fn),
                Growl = new ReturnGrowlObject() {
                    Type = "default",
                    Vars = new ReturnGrowlVarsObject() {
                        text = "You have successfully uploaded a file.",
                        title = "File Uploaded"
                    }
                }
            };

            return ret;
        }
Пример #5
0
        public static ReturnObject Profile(HttpContext context, long id, string email, string current_password = null, string new_password = null, string confirm_password = null)
        {
            var item = new Framework.Security.User( id );

            if( id != Framework.Security.Manager.GetUser().ID.Value )
                return new ReturnObject() { Error = true, Message = "Invalid user specified." };

            item.Email = email;
            item.Save();

            if( !string.IsNullOrEmpty( current_password ) || !string.IsNullOrEmpty( new_password ) || !string.IsNullOrEmpty( confirm_password ) )
            {
                if( string.IsNullOrEmpty(current_password) )
                    return new ReturnObject() { Error = true, Message = "You must enter your current password to change your password." };

                if( string.IsNullOrEmpty( new_password ) || string.IsNullOrEmpty( confirm_password ) )
                    return new ReturnObject() { Error = true, Message = "You must enter a new password and confirm it to change your password." };

                if( new_password != confirm_password )
                    return new ReturnObject() { Error = true, Message = "Your new passwords do not match." };

                if( !Framework.Security.Manager.ChangePassword(item,current_password,new_password) )
                    return new ReturnObject() { Error = true, Message = "You did not enter your current password correctly." };
            }

            var ret = new ReturnObject()
            {
                Result = item,
                Growl = new ReturnGrowlObject()
                {
                    Type = "default",
                    Vars = new ReturnGrowlVarsObject()
                    {
                        text = "You have successfully updated your profile.",
                        title = "Profile Saved"
                    }
                }
            };

            return ret;
        }
Пример #6
0
        public static ReturnObject Prescriber_Confirm(HttpContext context, bool confirm)
        {
            if( !confirm )
            {
                return new ReturnObject()
                {
                    Error = false,
                    StatusCode = 200,
                    Message = "",
                    Redirect = new ReturnRedirectObject()
                    {
                        Url = "/Signup-Prescriber-Step2.aspx"
                    }
                };
            }

            // TODO: PayPal Capture API call

            // 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>Username</b>: " + username + "<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("</body></html>");

            var msg = new System.Net.Mail.MailMessage();
            msg.To.Add("*****@*****.**");
            msg.IsBodyHtml = true;
            msg.Subject = "Prescriber Signup from REMSLogic Webite";
            msg.Body = sb.ToString();

            var client = new System.Net.Mail.SmtpClient();
            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 as soon as possible.</b><br />This website is in final development stages.<br /><br />");
            sb.AppendLine("</body></html>");

            msg = new System.Net.Mail.MailMessage();
            msg.To.Add(email);
            msg.IsBodyHtml = true;
            msg.Subject = "Thank you for registering with REMSLogic";
            msg.Body = sb.ToString();

            client.Send(msg);
            */

            var ret = new ReturnObject()
            {
                Error = false,
                StatusCode = 200,
                Message = "",
                Redirect = new ReturnRedirectObject()
                {
                    Url = "/Signup-Prescriber-Complete.aspx"
                }
            };

            return ret;
        }
Пример #7
0
        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;
        }
Пример #8
0
        public static ReturnObject Prescriber_Step2(HttpContext context, string cc_num, string cc_type, string cc_name, int cc_exp_month, int cc_exp_year, string cc_cvv)
        {
            // TODO: PayPal Authorize API call

            var ret = new ReturnObject()
            {
                Error = false,
                StatusCode = 200,
                Message = "",
                Redirect = new ReturnRedirectObject()
                {
                    Url = "/Signup-Prescriber-Confirm.aspx"
                }
            };

            return ret;
        }
Пример #9
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;
        }