コード例 #1
0
        //private static readonly string _autoCompleteUserNameInRoles = MimosaSettings.GetValue<string>(MimosaSettings.Setting.AutoCompleteUserNamesInRole);

        #endregion

        #region Overrides

        protected override void OnInit(EventArgs e)
        {
            this.Login1.LoginError += new EventHandler(Login1_LoginError);
            base.OnInit(e);

            // Determine the configuration setting so we know which username control is visible and for validation
            bool enableAutoLoginComplete = MimosaSettings.IsEnableAutoLoginComplete();

            AssignLocalPointersToControls();

            // Assign the handlers as not exposed by login control.
            _updateButton.Click += new EventHandler(UpdateButton_Click);
            _changeButton.Click += new EventHandler(ChangeButton_Click);
            _cancelButton.Click += new EventHandler(CancelButton_Click);

            // If an authentication timeout occurs, and the user performs an action that results in an AJAX callback
            // the browser hangs or errors.  To deal with this, we have to force the browser to properly reload the page
            // However, as we also have AJAX and postbacks on this page itself, we have to allow this and not force a redirect
            // Hence the check before setting redirect location.
            if (!_userNameCombo.IsCallBack && !IsPostBack)
            {
                Response.RedirectLocation = Request.Url.OriginalString;
            }

            _userNameCombo.Visible           = enableAutoLoginComplete;
            _userNameText.Visible            = !enableAutoLoginComplete;
            _userValidator.ControlToValidate = enableAutoLoginComplete ? "UserNameComboBox" : "UserName";

            if (enableAutoLoginComplete)
            {
                _userNameCombo.ItemsRequested += new RadComboBoxItemsRequestedEventHandler(UserNameCombo_ItemsRequested);
                Login1.LoggingIn += new LoginCancelEventHandler(Login1_LoggingIn);
            }
        }
コード例 #2
0
        private void SendOnePaymentMail(SmtpClient smtpClient, BookingPayment paymentItem)
        {
            MailMessage     message   = new MailMessage();
            List <Customer> customers = ApartmentMethods.ListCustomer(null, paymentItem.CustomerId, null, null, null, false, null, null, true);
            string          email     = string.Empty;

            if (customers.Count > 0 && customers[0].ContactInformation != null && !string.IsNullOrEmpty(customers[0].ContactInformation.Email))
            {
                email = customers[0].ContactInformation.Email;
            }

            if (!string.IsNullOrEmpty(email))
            {
                string dateFormat  = "dd-MMM-yyyy";
                string moneyFormat = "C0";
                message.To.Add(new MailAddress(email));
                string subject = string.Format("Payment Details from {0} to {1}", paymentItem.DateStart.ToString(dateFormat), paymentItem.DateEnd.ToString(dateFormat));
                message.Subject    = subject;
                message.IsBodyHtml = true;

                using (FileStream stream = File.OpenRead(HttpContext.Current.Server.MapPath("/EmailTemplates/MonthlyPayment.htm")))
                {
                    StringBuilder strb = new StringBuilder();
                    byte[]        b    = new byte[stream.Length];
                    UTF8Encoding  temp = new UTF8Encoding(true);
                    while (stream.Read(b, 0, b.Length) > 0)
                    {
                        strb.Append(temp.GetString(b));
                    }
                    string content = strb.ToString();

                    CultureInfo customCultureInfo = new CultureInfo(MimosaSettings.GloblaCulture());
                    customCultureInfo.NumberFormat   = (new CultureInfo(MimosaSettings.NumberFormatCulture())).NumberFormat;
                    customCultureInfo.DateTimeFormat = (new CultureInfo(MimosaSettings.DateTimeFormatCulture())).DateTimeFormat;

                    Thread.CurrentThread.CurrentCulture = customCultureInfo;

                    content = string.Format(content, paymentItem.CustomerName, subject, paymentItem.SiteName, paymentItem.RoomName,
                                            paymentItem.DateStart.ToString(dateFormat), paymentItem.DateEnd.ToString(dateFormat),
                                            paymentItem.RoomPrice.ToString(moneyFormat),
                                            paymentItem.EquipmentPrice.ToString(moneyFormat),
                                            paymentItem.ServicePrice.ToString(moneyFormat),
                                            paymentItem.TotalPrice.ToString(moneyFormat),
                                            paymentItem.CustomerPaid.ToString(moneyFormat),
                                            paymentItem.MoneyLeft.ToString(moneyFormat));
                    message.Body = content;

                    smtpClient.Send(message);
                }
            }
        }
コード例 #3
0
        public AppSettings GetAppSettings()
        {
            AppSettings appSettings = new AppSettings();

            appSettings.GloblaCulture         = MimosaSettings.GloblaCulture();
            appSettings.NumberFormatCulture   = MimosaSettings.NumberFormatCulture();
            appSettings.DateTimeFormatCulture = MimosaSettings.DateTimeFormatCulture();
            appSettings.MainCurrency          = MimosaSettings.MainCurrency();
            appSettings.SecondCurrency        = MimosaSettings.SecondCurrency();
            appSettings.VirtualDirectory      = MimosaSettings.VirtualDirectory();
            decimal rate = ConvertCurrency(appSettings.SecondCurrency, appSettings.MainCurrency);

            appSettings.ExchangeRate = rate;
            return(appSettings);
        }