예제 #1
0
파일: User.cs 프로젝트: radtek/canon
        /// <summary>
        /// Change email with the password to the user.
        /// </summary>
        /// <param name="email"></param>
        public static bool SendRemindPasswordEmail(string email)
        {
            Canon.Data.User user = GetUserByEmail(email);

            if (user != null)
            {
                string password = ((CanonMembershipProvider)Membership.Provider).ChangePassword(user.UserId);

                string changePasswordUrl = String.Concat(
                    HttpContext.Current.Request.Url.Scheme,
                    "://",
                    HttpContext.Current.Request.Url.Host,
                    ":",
                    HttpContext.Current.Request.Url.Port,
                    HttpContext.Current.Request.ApplicationPath,
                    "/Default.aspx?changepassword=yes");

                try
                {
                    EmailGateway.Send(
                        String.Empty,
                        email,
                        Utilities.GetResourceString("Common", "EmailRemindEmailSubject"),
                        String.Format(Utilities.GetResourceString("Common", "EmailRemindEmailText"), password, changePasswordUrl, user.UserName),
                        new List <Attachment>(),
                        true);
                }
                catch
                {
                    return(false);
                }

                return(true);
            }

            return(false);
        }
예제 #2
0
 protected void Localize()
 {
     deStartDate.CalendarProperties.TodayButtonText  = Utilities.GetResourceString("Common", "Today");
     deFinishDate.CalendarProperties.TodayButtonText = Utilities.GetResourceString("Common", "Today");
 }
예제 #3
0
        public void Bind()
        {
            List <int>         channels = this.Channels;
            List <int>         products = this.Products;
            CanonDataContext   db       = Cdb.Instance;
            List <MainMonitor> list     = CanonMainMonitor.GetValuesForChart(deStartDate.Date,
                                                                             deFinishDate.Date, channels, products);

            foreach (int productId in products)
            {
                Product product = db.Products.Where(p => p.ProductId == productId).FirstOrDefault();
                if (product == null)
                {
                    continue;
                }
                WebChartControl chart = new WebChartControl();
                chart.EnableViewState = false;
                ChartTitle title = new ChartTitle();
                title.Text = string.Format(Utilities.GetResourceString("Common", "ChartHeader"),
                                           product.ProductName, deStartDate.Date.ToString("dd.MM.yyyy"),
                                           deFinishDate.Date.ToString("dd.MM.yyyy"));
                title.Font = new System.Drawing.Font("Tahoma", 10);
                chart.Titles.Add(title);
                chart.FillStyle.FillMode = FillMode.Solid;
                Dictionary <int, Series> series = new Dictionary <int, Series>();
                Series s0 = new Series("Recommended price", ViewType.Line);
                s0.ValueScaleType    = ScaleType.Numerical;
                s0.ArgumentScaleType = ScaleType.DateTime;
                series.Add(0, s0);
                foreach (int channelId in channels)
                {
                    Channel channel = db.Channels.Where(c => c.ChannelId == channelId).FirstOrDefault();
                    if (channel == null)
                    {
                        continue;
                    }
                    Series s = new Series(channel.ChannelName, ViewType.Line);
                    s.ValueScaleType    = ScaleType.Numerical;
                    s.ArgumentScaleType = ScaleType.DateTime;
                    series.Add(channelId, s);
                }
                foreach (MainMonitor mm in list)
                {
                    if (mm.ProductId != productId)
                    {
                        continue;
                    }
                    series[mm.ChannelId].Points.Add(new SeriesPoint(mm.CalcDate, new double[] { (double)mm.ChannelPrice }));
                    series[0].Points.Add(new SeriesPoint(mm.CalcDate, new double[] { (double)mm.RecommendedPrice }));
                }
                foreach (KeyValuePair <int, Series> serie in series)
                {
                    chart.Series.Add(serie.Value);
                }
                //diagram
                DevExpress.XtraCharts.XYDiagram xyDiagram = new XYDiagram();
                xyDiagram.AxisY.Title.Font               = new System.Drawing.Font("Tahoma", 8);
                xyDiagram.AxisY.Title.Text               = "CZK";
                xyDiagram.AxisY.Label.Staggered          = false;
                xyDiagram.AxisY.Title.Visible            = true;
                xyDiagram.AxisY.Range.SideMarginsEnabled = true;
                xyDiagram.AxisY.Interlaced               = true;

                xyDiagram.AxisX.Title.Font               = new System.Drawing.Font("Tahoma", 8);
                xyDiagram.AxisX.Label.Staggered          = true;
                xyDiagram.AxisX.Range.SideMarginsEnabled = true;
                xyDiagram.AxisX.Tickmarks.MinorVisible   = false;
                chart.Diagram = xyDiagram;
                chart.Width   = 700;
                chart.Height  = 500;
                chart.DataBind();
                panelPics.Controls.Add(chart);

                this.FilesToSave.Add(this.SaveChartIntoFile(product.ProductName, chart));
            }
        }