Example #1
0
        /*public static string GetAccountCreationHTML(string customerUID, string verificationCode,string html)
        {
            string url = HttpContext.Current.Request.Url.ToString();
            string[] paths = url.Split('/');
            url = url.Replace(paths[paths.Length - 1], "VerifyEmail.aspx");
            url += "?" + WebConstants.Request.USER_UID + "=" + customerUID;
            url += "&" + WebConstants.Request.VERIFICATION_CODE + "=" + Utility.GetMd5Sum(verificationCode);
            EmailTemplateFactory.Instance.Paramters.Add("##URL##", url);
            EmailTemplates.EmailTemplateEntityRow emailTemplate = EmailTemplateFactory.Instance.GetEmailContents(WebConstants.TemplateNames.ACTIVATION);
            if (emailTemplate != null)
            {
                html = emailTemplate.html.Replace(
                html = ReplaceAttributes(html);
            }
            else
            {
                html = "Thank you for registering with Simplicity4Business. <br/> <br/>"
                            + " Please click the following URL to activate your account. <br/><br/>"
                            + " <a href='" + url + "'>" + url + "</a>";
            }
            return html;
        }

        public static string GetAccountCreationHTML(string password, string html)
        {
            string url = HttpContext.Current.Request.Url.ToString();
            string[] paths = url.Split('/');
            url = url.Replace(paths[paths.Length - 1], "VerifyEmail.aspx");
            url += "?" + WebConstants.Request.USER_UID + "=" + customerUID;
            url += "&" + WebConstants.Request.VERIFICATION_CODE + "=" + Utility.GetMd5Sum(verificationCode);
            html = html.Replace("##URL##", url);
            html = ReplaceAttributes(html);
            return html;
        }*/
        public static void SendAccountCreationEmail(User customer, string password)
        {
            if (customer != null)
            {
                MailMessage message = new MailMessage();
                message.To.Add(new MailAddress(customer.Email));
                string url = HttpContext.Current.Request.Url.ToString();
                string[] paths = url.Split('/');
                url = url.Replace(paths[paths.Length - 1], "VerifyEmail.aspx");
                url += "?" + WebConstants.Request.USER_UID + "=" + customer.UserUID;
                url += "&" + WebConstants.Request.VERIFICATION_CODE + "=" + Utility.GetMd5Sum(customer.VerificationCode);
                EmailTemplateFactory templateFactory = new EmailTemplateFactory(customer);
                templateFactory.Paramters.Add("##PASSWORD##", password);
                templateFactory.Paramters.Add("##URL##", url);
                string Imageurl = HttpContext.Current.Request.Url.ToString();
                templateFactory.Paramters.Add("##ImageUrl##", Imageurl);
                EmailTemplate emailTemplate = templateFactory.GetEmailContents(WebConstants.TemplateNames.ACTIVATION);
                if (emailTemplate != null)
                {
                    message.Body = emailTemplate.HTML;
                    message.Subject = emailTemplate.Subject;
                }
                else
                {
                    message.Body = "Thank you for registering with Simplicity4Business. <br/> <br/>"
                                + " Please click the following URL to activate your account. <br/><br/>"
                                + " <a href=' " + url + "'>" + url + "</a>" + "Username: "******"<br/>Password: "******"Activation Code for Simplicity for Business";
                }
                message.IsBodyHtml = true;
                SendEmail(message);
            }
        }
        protected void AddAdminPopUpButton_Click(object source, EventArgs e)
        {
            AddAdminPopUP_Button.Visible = false;
            AddCompanyAdminButton.Visible = true;

            if (ValidateFields())
            {
                String CompanyType = Enum.GetName(typeof(Enums.ENTITY_TYPE), Enums.ENTITY_TYPE.ADMIN);
                if (!companyNameAlreadyExistsUsingName())
                {
                    SetErrorMessage("Error in adding New Admin.");
                }
                else
                {
                    SetErrorMessage("");

                    User user = new User
                    {
                        ReceiveEmails = false,
                        FullName = GetFullName(),
                        Surname = surname.Text,
                        Forename = firstname.Text,
                        JobTitle = jobtitle.Text,
                        Email = emailfield.Text,
                        Password = Utility.GetMd5Sum(passwordfield.Text),
                        ReminderQuestionID = byte.Parse(listForgotPasswordQuestion.SelectedValue),
                        ReminderQuestion = listForgotPasswordQuestion.SelectedItem.Text,
                        ReminderAnswer = Utility.GetMd5Sum(txtForgotPasswordAnswer.Text),
                        CreationDate = DateTime.Now,
                        LastAmendmentDate = DateTime.Now,
                        Type = CompanyType,
                        Deleted = false,
                        OnHold = false,
                        Verified = true,
                        Enabled = true,
                        UserUID = Guid.NewGuid().ToString(),
                        VerificationCode = Guid.NewGuid().ToString(),
                        Approved = 0,
                        PaymentType = 0,
                        LoginAttempts = 0
                    };

                    Address address = fillAddressUser(user, Enums.ADDRESS_TYPE.PERSONAL);
                    user.Addresses.Add(address);
                    Simplicity.Data.Company company = (from c in DatabaseContext.Companies where c.Name == WebConstants.Config.ADMIN_COMPANY_NAME select c).FirstOrDefault();
                    user.CompanyID = company.CompanyID;
                    user.Company = company;
                    DatabaseContext.Users.AddObject(user);
                    DatabaseContext.SaveChanges();

                    //call health and safety stored procedure over here to insert company there as well
                    DatabaseUtility.addCompanyToHS(user);
            //                    EmailUtility.SendAccountCreationEmail(user, passwordfield.Text);
                    SetSuccessMessage("Admin added successfully.");
                    Response.Redirect("~/Admin/ManageCompanies.aspx");
                }
            }
        }
 private void Initialize(User customer)
 {
     parameters = new Dictionary<string, string>();
     parameters.Add("##IMAGE_URL##", GetImagesUrl());
     if (customer != null)
     {
         parameters.Add("##CUSTOMER_NAME##", customer.Forename + ", " + customer.Surname);
         parameters.Add("##USER_NAME##", customer.Email);
         //parameters.Add("##PASSWORD##", customer.Password);
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["FORGOT_PASSWORD_USER"]==null)
     {
         Response.Redirect("~/ForgotPassword.aspx");
     }
     String username = (String)Session["FORGOT_PASSWORD_USER"];
     List<User> users = (from User in DatabaseContext.Users where (User.Email == username) select User).ToList();
     if (users.Any())
     {
         user = users.FirstOrDefault();
         listForgotPasswordQuestionText.Text = user.ReminderQuestion;
     }
 }
Example #5
0
        public Boolean CreateAccount(String nEmail,String nPassword,String nType)
        {
            if (!this.UserExist(nEmail))
            {
                using (var context = new SimplicityEntities())
                {
                    var user = new User { UserUID=Guid.NewGuid().ToString(),ReceiveEmails=false,Deleted=false,OnHold=false ,Email = nEmail,Password=nPassword,Verified=false, Enabled=false, Locked=false, CreationDate=DateTime.Now,Type=nType };
                    context.AddToUsers(user);
                    context.SaveChanges();
                }
                return true;
            }
            else {

                return false;
            }
        }
    protected override void OnLoad(EventArgs e)
    {
        Response.Cache.SetCacheability(HttpCacheability.NoCache);
        SetErrorMessage("");
        SetInfoMessage("");

        Simplicity.Data.SimplicityEntities DatabaseContext = new Simplicity.Data.SimplicityEntities();
        if (User.Identity.IsAuthenticated)
        {
            Simplicity.Data.Session session = (from s in DatabaseContext.Sessions where s.SessionUID == User.Identity.Name select s).FirstOrDefault();
            if (session != null && session.User != null)
            {
                loggedInUser = session.User;
                session.LastActivityTime = DateTime.Now;
                session.EndTime = DateTime.Now.AddMinutes(30);
                session.IP = Request.UserHostAddress;
                session.ProductID = int.Parse(AppSettings["EAProductIDInSimplicity"]);
                DatabaseContext.SaveChanges();
            }
        }
    }
 public static void addCompanyToHS(User user)
 {
     NameValueCollection AppSettings = System.Configuration.ConfigurationManager.AppSettings;
     SqlConnection conn = new SqlConnection(AppSettings["HSDB"]);
     try
     {
         conn.Open();
         SqlCommand command = new SqlCommand(AppSettings["CopyDataToHSProcedure"], conn);
         command.CommandType = System.Data.CommandType.StoredProcedure;
         command.Parameters.AddWithValue("@co_name_short", user.Company.Name.Length > 16 ? user.Company.Name.Substring(0, 16) : user.Company.Name);
         command.Parameters.AddWithValue("@co_name_long", user.Company.Name.Length > 60 ? user.Company.Name.Substring(0, 60) : user.Company.Name);
         command.Parameters.AddWithValue("@contact_forename", user.Forename);
         command.Parameters.AddWithValue("@contact_surname", user.Surname);
         command.Parameters.AddWithValue("@address_no", user.Company.Address.AddressNo == null ? "" : user.Company.Address.AddressNo);
         command.Parameters.AddWithValue("@address_line1", user.Company.Address.AddressLine1 == null ? "" : user.Company.Address.AddressLine1);
         command.Parameters.AddWithValue("@address_line2", user.Company.Address.AddressLine2 == null ? "" : user.Company.Address.AddressLine2);
         command.Parameters.AddWithValue("@address_line3", user.Company.Address.AddressLine3 == null ? "" : user.Company.Address.AddressLine3);
         command.Parameters.AddWithValue("@address_line4", user.Company.Address.AddressLine4 == null ? "" : user.Company.Address.AddressLine4);
         command.Parameters.AddWithValue("@address_line5", user.Company.Address.AddressLine5 == null ? "" : user.Company.Address.AddressLine5);
         command.Parameters.AddWithValue("@address_post_code", user.Company.Address.PostalCode == null ? "" : user.Company.Address.PostalCode);
         command.Parameters.AddWithValue("@address_full", user.Company.Address.AddressFull == null ? "" : user.Company.Address.AddressFull);
         command.Parameters.AddWithValue("@tel_1", user.Company.Address.Telephone1 == null ? "" : user.Company.Address.Telephone1);
         command.Parameters.AddWithValue("@tel_2", user.Company.Address.Telephone2 == null ? "" : user.Company.Address.Telephone2);
         command.Parameters.AddWithValue("@tel_fax", user.Company.Address.Fax == null ? "" : user.Company.Address.Fax);
         command.Parameters.AddWithValue("@created_by", user.UserID);
         command.Parameters.AddWithValue("@date_created", DateTime.Now);
         command.Parameters.AddWithValue("@simplicity_company_id", user.Company.CompanyID);
         command.Parameters.AddWithValue("@simplicity_user_id", user.UserID);
         command.Parameters.AddWithValue("@user_email", user.Email);
         command.Parameters.AddWithValue("@user_password", user.Password);
         command.ExecuteReader();
     }
     finally
     {
         if (conn != null) conn.Close();
     }
 }
Example #8
0
        protected void userSubmitButton_Click(object sender, ImageClickEventArgs e)
        {
            //var allUsersofCompany = (from UserTable in DatabaseContext.Users where UserTable.CompanyID == LoggedIsUser.CompanyID && UserTable.Enabled == true select UserTable);
            //int totalEnabledUsers = allUsersofCompany.Count();
            //if(totalEnabledUsers == allUsersofCompany.)

            SelectedTabElement = 4;
            newUserPanel.Visible = false;
            addUser.Visible = true;
            List<User> checkuser = (from UserTable in DatabaseContext.Users where UserTable.Email == userEmailField.Text select UserTable).ToList();
            if (checkuser.Any())
            {
                SetErrorMessage("Email address already resgistered with Simplicity");
            }
            else
            {
                Address Companyaddress = (from addr in LoggedIsUser.Addresses where addr.MultiAddressType == "COMPANY" select addr).FirstOrDefault();
                User user = new User
                {
                    FullName = userSurNameField.Text + ", " + userFirstNameField.Text,
                    Surname = userSurNameField.Text,
                    Forename = userFirstNameField.Text,
                    JobTitle = userJobTitle.Text,
                    Email = userEmailField.Text,
                    Password = Utility.GetMd5Sum(userPasswordField.Text),
                    ReminderQuestionID = byte.Parse(userlistForgotPasswordQuestion.SelectedValue),
                    ReminderQuestion = userlistForgotPasswordQuestion.SelectedItem.Text,
                    ReminderAnswer = Utility.GetMd5Sum(usertxtForgotPasswordAnswer.Text),
                    CreationDate = DateTime.Now,
                    LastAmendmentDate = DateTime.Now,
                    Type = Enum.GetName(typeof(Enums.ENTITY_TYPE), Enums.ENTITY_TYPE.USER),
                    Deleted = false,
                    OnHold = false,
                    Verified = false,
                    Enabled = true,
                    UserUID = Guid.NewGuid().ToString(),
                    VerificationCode = Guid.NewGuid().ToString(),
                    Approved = 0,
                    PaymentType = 0,
                    LoginAttempts = 0
                };

                Address address = new Address
                {
                    Deleted = Companyaddress.Deleted,
                    AddressFull = Companyaddress.AddressFull,
                    AddressNo = Companyaddress.AddressNo,
                    AddressLine1 = Companyaddress.AddressLine1,
                    AddressLine2 = Companyaddress.AddressLine2,
                    AddressLine3 = Companyaddress.AddressLine3,
                    AddressLine4 = Companyaddress.AddressLine4,
                    AddressLine5 = Companyaddress.AddressLine5,
                    PostalCode = Companyaddress.PostalCode,
                    Telephone1 = Companyaddress.Telephone1,
                    Telephone2 = Companyaddress.Telephone2,
                    Fax = Companyaddress.Fax,
                    Mobile = Companyaddress.Mobile,
                    Town = Companyaddress.Town,
                    County = Companyaddress.County,
                    Country = Companyaddress.Country,
                    UserId = user.UserID,
                    SameAsCustomer = Companyaddress.SameAsCustomer,
                    SameAsBilling = Companyaddress.SameAsBilling,
                    MultiAddressType = Enum.GetName(typeof(Enums.ADDRESS_TYPE), Enums.ADDRESS_TYPE.PERSONAL),
                    CreationDate = DateTime.Now,
                    LastAmendmentDate = DateTime.Now,
                    AddressName = Companyaddress.AddressName,
                    CreatedBy = LoggedIsUser.UserID,
                    LastAmendedBy = Companyaddress.LastAmendedBy
                };

                Address companyAddress = new Address
                {
                    Deleted = Companyaddress.Deleted,
                    AddressFull = Companyaddress.AddressFull,
                    AddressNo = Companyaddress.AddressNo,
                    AddressLine1 = Companyaddress.AddressLine1,
                    AddressLine2 = Companyaddress.AddressLine2,
                    AddressLine3 = Companyaddress.AddressLine3,
                    AddressLine4 = Companyaddress.AddressLine4,
                    AddressLine5 = Companyaddress.AddressLine5,
                    PostalCode = Companyaddress.PostalCode,
                    Telephone1 = Companyaddress.Telephone1,
                    Telephone2 = Companyaddress.Telephone2,
                    Fax = Companyaddress.Fax,
                    Mobile = Companyaddress.Mobile,
                    Town = Companyaddress.Town,
                    County = Companyaddress.County,
                    Country = Companyaddress.Country,
                    UserId = user.UserID,
                    SameAsCustomer = Companyaddress.SameAsCustomer,
                    SameAsBilling = Companyaddress.SameAsBilling,
                    MultiAddressType = Enum.GetName(typeof(Enums.ADDRESS_TYPE), Enums.ADDRESS_TYPE.COMPANY),
                    CreationDate = DateTime.Now,
                    LastAmendmentDate = DateTime.Now,
                    AddressName = Companyaddress.AddressName,
                    CreatedBy = LoggedIsUser.UserID,
                    LastAmendedBy = Companyaddress.LastAmendedBy
                };

                user.Addresses.Add(address);
                user.Addresses.Add(companyAddress);
                user.CompanyID = LoggedIsUser.CompanyID;
                DatabaseContext.AddToUsers(user);
                DatabaseContext.SaveChanges();

                //call health and safety stored procedure over here to insert company there as well
                addCompanyToHS(user);
                EmailUtility.SendUserAccountCreationEmail(user, userPasswordField.Text,usertxtForgotPasswordAnswer.Text);
                Response.Redirect("~/SignUp.aspx?SelectedTabElement="+SelectedTabElement);
            }
        }
Example #9
0
        protected void btnSave_Click(object sender, ImageClickEventArgs e)
        {
            SelectedTabElement = 1;
            if (LoggedIsUser == null)//means its sign-up process
            {

                if (ValidateFields() && !companyNameAlreadyExists())
                {
                    User user = new User
                    {
                        ReceiveEmails = checkbox.Checked,
                        FullName = GetFullName(),
                        Surname = surname.Text,
                        Forename = firstname.Text,
                        JobTitle = jobtitle.Text,
                        Email = emailfield.Text,
                        Password = Utility.GetMd5Sum(passwordfield.Text),
                        ReminderQuestionID = byte.Parse(listForgotPasswordQuestion.SelectedValue),
                        ReminderQuestion = listForgotPasswordQuestion.SelectedItem.Text,
                        ReminderAnswer = Utility.GetMd5Sum(txtForgotPasswordAnswer.Text),
                        CreationDate = DateTime.Now,
                        LastAmendmentDate = DateTime.Now,
                        Type = Enum.GetName(typeof(Enums.ENTITY_TYPE), Enums.ENTITY_TYPE.COMPANY_ADMIN),
                        Deleted = false,
                        OnHold = false,
                        Verified = false,
                        Enabled = true,
                        UserUID = Guid.NewGuid().ToString(),
                        VerificationCode = Guid.NewGuid().ToString(),
                        Approved = 0,
                        PaymentType = 0,
                        LoginAttempts = 0
                    };

                    Address address = fillAddress(user, Enums.ADDRESS_TYPE.PERSONAL);
                    Address companyAddress = fillAddress(user, Enums.ADDRESS_TYPE.COMPANY);
                    user.Addresses.Add(address);
                    user.Addresses.Add(companyAddress);

                    Simplicity.Data.Company company = new Simplicity.Data.Company();
                    company.Name = companyname.Text;
                    company.Address = companyAddress;
                    DatabaseContext.AddToCompanies(company);
                    DatabaseContext.SaveChanges();

                    user.CompanyID = company.CompanyID;
                    DatabaseContext.SaveChanges();

                    //call health and safety stored procedure over here to insert company there as well
                    addCompanyToHS(user);
                    EmailUtility.SendAccountCreationEmail(user, passwordfield.Text);
                    Response.Redirect("~/ConfirmMail.aspx");
                }
            }
            else
            {
                if (companyNameAlreadyExists())
                {
                    return;
                }
                bool newCompanyAdded = false;
                User user = (from c in DatabaseContext.Users where c.UserID == LoggedIsUser.UserID select c).FirstOrDefault();

                user.FullName = GetFullName();
                user.Surname = surname.Text;
                user.Forename = firstname.Text;
                user.JobTitle = jobtitle.Text;
                if (user.Company == null)//it means i am an old user and i dont have any company attached yet
                {
                    Simplicity.Data.Company company = new Simplicity.Data.Company();
                    company.Name = companyname.Text;
                    Address companyAddr = fillAddress(user, Enums.ADDRESS_TYPE.COMPANY);
                    company.Address = companyAddr;
                    user.Company = company;
                    newCompanyAdded = true;
                }
                user.Company.Name = companyname.Text;
                user.LastAmendmentDate = DateTime.Now;

                foreach (Address address in user.Addresses)
                {
                    if (address.MultiAddressType == "PERSONAL")
                    {
                        address.AddressFull = GetFullAddress();
                        address.AddressNo = addressno.Text;
                        address.AddressLine1 = addressline1.Text;
                        address.AddressLine2 = addressline2.Text;
                        address.AddressLine3 = addressline3.Text;
                        address.AddressLine4 = addressline4.Text;
                        address.AddressLine5 = addressline5.Text;
                        address.PostalCode = postalcode.Text;
                        address.Telephone1 = telephone1.Text;
                        address.Telephone2 = telephone2.Text;
                        address.Fax = fax.Text;
                        address.Mobile = mobile.Text;
                        address.Town = town.Text;
                        address.County = County.Text;
                        address.Country = country.Text;
                        address.LastAmendmentDate = DateTime.Now;
                        address.AddressName = null;
                        address.LastAmendedBy = null;
                    }
                }
                DatabaseContext.SaveChanges();
                SetSuccessMessage("Save information successfully.");
                if (newCompanyAdded) addCompanyToHS(user);
            }
        }
 public EmailTemplateFactory(User customer)
 {
     Initialize(customer);
 }
Example #11
0
 public static void SendPaymentEmailtoClient(User customer,string firstName, string lastName, string cardNumber, string expiryMonth, string expiryYear, string cardType, string amountText, string userEmail)
 {
     MailMessage message = new MailMessage();
     message.To.Add(new MailAddress(userEmail));
     EmailTemplateFactory templateFactory = new EmailTemplateFactory(customer);
     templateFactory.Paramters.Add("##FIRSTNAME##", firstName);
     templateFactory.Paramters.Add("##LASTNAME##", lastName);
     templateFactory.Paramters.Add("##CARDNUMBER##", cardNumber);
     templateFactory.Paramters.Add("##EXPIRYMONTH##", expiryMonth);
     templateFactory.Paramters.Add("##EXPIRYYEAR##", expiryYear);
     templateFactory.Paramters.Add("##CARDTYPE##", cardType);
     templateFactory.Paramters.Add("##AMOUNTTEXT##", amountText);
     EmailTemplate emailTemplate = templateFactory.GetEmailContents(WebConstants.TemplateNames.PAYMENT);
     if (emailTemplate != null)
     {
         message.Body = emailTemplate.HTML;
         message.Subject = emailTemplate.Subject;
     }
     else
     {
         message.Subject = "Simplicity Payment Receipt";
         message.Body = "<b>Card holder's name:</b>" + firstName + "&nbsp;" + lastName + "<br/>";
         message.Body += "<b>Card Number:</b>" + cardNumber + "<br/>";
         message.Body += "<b>Card Expiry:</b>" + expiryMonth + "/" + expiryYear + "<br/>";
         message.Body += "<b>Cart Type:</b>" + cardType + "<br/>";
         message.Body += "<b>Amount Charged:</b>" + amountText + "<br/>";
     }
     message.IsBodyHtml = true;
     SendEmail(message);
 }
Example #12
0
 public static void SendPasswordEmail(User customer, string emailAddress, string password)
 {
     MailMessage message = new MailMessage();
     message.To.Add(new MailAddress(emailAddress));
     EmailTemplateFactory templateFactory = new EmailTemplateFactory(customer);
     templateFactory.Paramters.Add("##PASSWORD##", password);
     EmailTemplate emailTemplate = templateFactory.GetEmailContents(WebConstants.TemplateNames.PASSWORD);
     if (emailTemplate != null)
     {
         message.Body = emailTemplate.HTML;
         message.Subject = emailTemplate.Subject;
     }
     else
     {
         message.Subject = "Simplicity Account Password";
         message.Body = "Your password is " + password;
     }
     message.IsBodyHtml = true;
     //+ " Or click on the following link: <br/>" + url;
     SendEmail(message);
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the Users EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToUsers(User user)
 {
     base.AddObject("Users", user);
 }
 /// <summary>
 /// Create a new User object.
 /// </summary>
 /// <param name="userID">Initial value of the UserID property.</param>
 /// <param name="userUID">Initial value of the UserUID property.</param>
 /// <param name="receiveEmails">Initial value of the ReceiveEmails property.</param>
 /// <param name="deleted">Initial value of the Deleted property.</param>
 /// <param name="onHold">Initial value of the OnHold property.</param>
 /// <param name="verified">Initial value of the Verified property.</param>
 /// <param name="enabled">Initial value of the Enabled property.</param>
 /// <param name="locked">Initial value of the Locked property.</param>
 /// <param name="creationDate">Initial value of the CreationDate property.</param>
 /// <param name="type">Initial value of the Type property.</param>
 public static User CreateUser(global::System.Int32 userID, global::System.String userUID, global::System.Boolean receiveEmails, global::System.Boolean deleted, global::System.Boolean onHold, global::System.Boolean verified, global::System.Boolean enabled, global::System.Boolean locked, global::System.DateTime creationDate, global::System.String type)
 {
     User user = new User();
     user.UserID = userID;
     user.UserUID = userUID;
     user.ReceiveEmails = receiveEmails;
     user.Deleted = deleted;
     user.OnHold = onHold;
     user.Verified = verified;
     user.Enabled = enabled;
     user.Locked = locked;
     user.CreationDate = creationDate;
     user.Type = type;
     return user;
 }
 private Address fillAddressUser(User user, Enums.ADDRESS_TYPE addrType)
 {
     Address addr = new Address
     {
         Deleted = false,
         AddressFull = GetFullAddressCompanyTab(),
         AddressNo = CompanyTabAddressNo.Text,
         AddressLine1 = CompanyTabAddressLine1.Text,
         AddressLine2 = CompanyTabAddressLine2.Text,
         AddressLine3 = CompanyTabAddressLine3.Text,
         AddressLine4 = CompanyTabAddressLine4.Text,
         AddressLine5 = CompanyTabAddressLine5.Text,
         PostalCode = CompanyTabPostalCode.Text,
         Telephone1 = CompanyTabTelephone1.Text,
         Telephone2 = CompanyTabTelephone2.Text,
         Fax = CompanyTabFax.Text,
         Mobile = CompanyTabMobile.Text,
         Town = CompanyTabTown.Text,
         County = CompanyTabCounty.Text,
         Country = CompanyTabCountry.Text,
         UserId = user.UserID,
         SameAsCustomer = false,
         SameAsBilling = false,
         MultiAddressType = Enum.GetName(typeof(Enums.ADDRESS_TYPE), addrType),
         CreationDate = DateTime.Now,
         LastAmendmentDate = DateTime.Now,
         AddressName = null,
         CreatedBy = LoggedIsAdmin.UserID,
         LastAmendedBy = LoggedIsAdmin.UserID
     };
     return addr;
 }
Example #16
0
 private Address fillAddress(User user, Enums.ADDRESS_TYPE addrType)
 {
     Address addr = new Address
     {
         Deleted = false,
         AddressFull = GetFullAddress(),
         AddressNo = addressno.Text,
         AddressLine1 = addressline1.Text,
         AddressLine2 = addressline2.Text,
         AddressLine3 = addressline3.Text,
         AddressLine4 = addressline4.Text,
         AddressLine5 = addressline5.Text,
         PostalCode = postalcode.Text,
         Telephone1 = telephone1.Text,
         Telephone2 = telephone2.Text,
         Fax = fax.Text,
         Mobile = mobile.Text,
         Town = town.Text,
         County = County.Text,
         Country = country.Text,
         UserId = user.UserID,
         SameAsCustomer = false,
         SameAsBilling = false,
         MultiAddressType = Enum.GetName(typeof(Enums.ADDRESS_TYPE), addrType),
         CreationDate = DateTime.Now,
         LastAmendmentDate = DateTime.Now,
         AddressName = null,
         CreatedBy = user.UserID,
         LastAmendedBy = null
     };
     return addr;
 }
Example #17
0
 public static void SendPaymentEmailtoAdmin(User customer, string firstName, string lastName, string cardNumber, string expiryMonth, string expiryYear, string cardType, string amountText, string userEmail)
 {
     MailMessage message = new MailMessage();
     string[] adminEmailAddresses = ConfigurationSettings.AppSettings[WebConstants.Config.ADMIN_EMAIL_ADDRESSES].Split(',');
     foreach (string adminEmailAddress in adminEmailAddresses)
     {
         message.To.Add(new MailAddress(adminEmailAddress));
     }
     EmailTemplateFactory templateFactory = new EmailTemplateFactory(customer);
     templateFactory.Paramters.Add("##FIRSTNAME##", firstName);
     templateFactory.Paramters.Add("##LASTNAME##", lastName);
     templateFactory.Paramters.Add("##CARDNUMBER##", cardNumber);
     templateFactory.Paramters.Add("##EXPIRYMONTH##", expiryMonth);
     templateFactory.Paramters.Add("##EXPIRYYEAR##", expiryYear);
     templateFactory.Paramters.Add("##CARDTYPE##", cardType);
     templateFactory.Paramters.Add("##AMOUNTTEXT##", amountText);
     EmailTemplate emailTemplate = templateFactory.GetEmailContents(WebConstants.TemplateNames.PAYMENT);
     if (emailTemplate != null)
     {
         message.Body = emailTemplate.HTML;
         message.Subject = "Copy of Customer "+emailTemplate.Subject;
     }
     else
     {
         message.Subject = "Copy of Customer Simplicity Payment Receipt";
         message.Body = "<b>Card holder's name:</b>" + firstName + "&nbsp;" + lastName + "<br/>";
         message.Body += "<b>Card Number:</b>" + cardNumber + "<br/>";
         message.Body += "<b>Card Expiry:</b>" + expiryMonth + "/" + expiryYear + "<br/>";
         message.Body += "<b>Cart Type:</b>" + cardType + "<br/>";
         message.Body += "<b>Amount Charged:</b>" + amountText + "<br/>";
     }
     message.IsBodyHtml = true;
     SendEmail(message);
 }
Example #18
0
 protected override void OnLoad(EventArgs e)
 {
     SetMessage("error", "", false);
     SetMessage("success", "", false);
     if (User.Identity.IsAuthenticated)
     {
         Data.Session session = (from s in DatabaseContext.Sessions where s.SessionUID == User.Identity.Name select s).FirstOrDefault();
         if (session != null && session.User != null)
         {
             loggedInUser = session.User;
             if (session.User.Type.Equals("ADMIN")) {
                 loggedInAdmin = session.User;
             }
             LoggedUserCompanyProduct =loggedInUser.Company.CompanyProducts.Count;
             LoggedUserProduct =loggedInUser.UserProducts.Count;
             session.LastActivityTime = DateTime.Now;
             session.EndTime = DateTime.Now.AddMinutes(30);
             session.IP = Request.UserHostAddress;
             session.ProductID = null;
             DatabaseContext.SaveChanges();
         }
     }
     base.OnLoad(e);
 }