Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Net.AllowOnly("customer");

            Customer             cust   = (Customer)Session["customer"];
            Order                order  = (Order)Net.GetSession("order");
            List <Order_Artwork> oaList = (List <Order_Artwork>)Net.GetSession("oaList");

            // if order is empty, redirect to cart
            if (order == null || oaList == null)
            {
                Net.Redirect("~/Pages/Cart.aspx");
            }

            if (!IsPostBack)
            {
                if (cust.CreditCardNo != null)
                {
                    txtCardNo.Text = cust.CreditCardNo;
                }

                lblTotalItems.Text = "" + oaList.Count;
                lblTotalPrice.Text = "RM " + Quick.FormatPrice(order.TotalPrice);
            }

            // Initiate error msg label
            FormatLbl = new FormatLabel(lblErrorMsg);
        }
Esempio n. 2
0
        public void Refresh(
            bool flipLabels,
            FormatLabel formatLabel,
            MeasureTextLength measureTextLength)
        {
            Labels         = new List <LabelInfo>();
            MaxLabelLength = 0f;
            float xValue    = flipLabels ? MaxValue : MinValue;
            float xValueInc = (MaxValue - MinValue) / (float)(NumberOfLabels - 1);

            if (flipLabels)
            {
                xValueInc = -xValueInc;
            }
            for (int i = 0; i < NumberOfLabels; ++i, xValue += xValueInc)
            {
                string text   = formatLabel(xValue);
                float  length = measureTextLength(text);
                if (length > MaxLabelLength)
                {
                    MaxLabelLength = length;
                }
                Labels.Add(new LabelInfo()
                {
                    Text = text, Length = length
                });
            }
        }
Esempio n. 3
0
 public async Task <ActionResult <FormatLabel> > PostFormat(FormatLabel format)
 {
     return(await Task.Run(() =>
     {
         var output = _formatLabelsService.Add(format);
         return new ActionResult <FormatLabel>(output);
     }));
 }
Esempio n. 4
0
        public static AxisLabels Build(
            float minValue,
            float maxValue,
            int numberOfLabels,
            bool flipLabels,
            FormatLabel formatLabel,
            MeasureTextLength measureTextLength)
        {
            AxisLabels axisLabels = new AxisLabels();

            axisLabels.Labels         = new List <LabelInfo>();
            axisLabels.MinValue       = minValue;
            axisLabels.MaxValue       = maxValue;
            axisLabels.NumberOfLabels = numberOfLabels;
            axisLabels.MaxLabelLength = 0f;
            axisLabels.Refresh(flipLabels, formatLabel, measureTextLength);
            return(axisLabels);
        }
Esempio n. 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // load the label
            FormatLbl = new FormatLabel(lblUploadError);

            // Check if logged in as Artist or not
            if (Session["artist"] == null)
            {
                Response.Redirect("~/Pages/LoginRegister.aspx");
            }

            // Set form default values
            if (!IsPostBack)
            {
                rblIsPublic.Items[0].Selected = true;
                rblForSale.Items[0].Selected  = true;
            }
        }
Esempio n. 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // Initialize
            FormatLbl = new FormatLabel(lblEditError);

            if (Session["customer"] == null)
            {
                Response.Redirect("~/Pages/LoginRegister.aspx");
            }
            else
            {
                // Clear error message
                lblEditError.Text = "";

                if (!IsPostBack)
                {
                    CustomerDao dao      = new CustomerDao();
                    Customer    customer = (Customer)Session["customer"];

                    // Update the one in the session and page
                    customer            = dao.Get("CUSTID", customer.Id);
                    Session["customer"] = customer;

                    //nameLbl.Text = customer.Username + " " + customer.DisplayName;
                    //usernameLbl.Text = customer.Id;
                    lblName.Text     = customer.DisplayName;
                    lblUsername.Text = "@" + customer.Username;

                    username.Text    = customer.Username;
                    displayName.Text = customer.DisplayName;
                    email.Text       = customer.Email;
                    cardNo.Text      = customer.CreditCardNo;
                }
            }

            if (Request.QueryString["Edit"] != null)
            {
                lblEditError = FormatLbl.Success("Account successfully updated");
            }

            lblEditError.ID = "lblEditError";
        }
Esempio n. 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            FormatLbl = new FormatLabel(lblEditError);

            if (Session["artist"] == null)
            {
                Response.Redirect("~/Pages/LoginRegister.aspx");
            }
            else
            {
                // Clear error message
                lblEditError.Text = "";

                if (!IsPostBack)
                {
                    ArtistDao dao    = new ArtistDao();
                    Artist    artist = (Artist)Session["artist"];

                    // Update the one in the session and page
                    artist            = dao.Get("ARTISTID", artist.Id);
                    Session["artist"] = artist;

                    //nameLbl.Text = artist.Username + " " + artist.DisplayName;
                    //usernameLbl.Text = artist.Id;
                    lblName.Text     = artist.DisplayName;
                    lblUsername.Text = "@" + artist.Username;
                    lblBio.Text      = artist.Bio;

                    username.Text    = artist.Username;
                    displayName.Text = artist.DisplayName;
                    email.Text       = artist.Email;
                    bio.Text         = artist.Bio;
                }
            }

            if (Request.QueryString["Edit"] != null)
            {
                lblEditError = FormatLbl.Success("Account successfully updated");
            }
        }
Esempio n. 8
0
        Label getLabelFor(Classes.Message message, ref int y)
        {
            int y_offset = y - gbMessages.VerticalScroll.Value;
            var lbl      = new FormatLabel(message, gbMessages);

            lbl.Text            = $"{message.Author.DisplayName}: {message.Content}";
            lbl.Tag             = message;
            lbl.AutoSize        = true;
            lbl.MaximumSize     = new Size(gbMessages.Size.Width - 45, 0);
            lbl.Location        = new Point(5, y_offset);
            lbl.ContextMenu     = new ContextMenu();
            lbl.ContextMenu.Tag = message;
            lbl.ContextMenu.MenuItems.Add($"Id: {message.Id}", putTextToClipboard);
            lbl.ContextMenu.MenuItems.Add($"Author: {message.Author.UserName} ({message.Author.Id})", putTextToClipboard);
            if (message.Id > 0)
            {
                lbl.ContextMenu.MenuItems.Add($"[Delete]", deleteMessage);
                lbl.ContextMenu.MenuItems.Add($"[Edit]", editMessage);
            }
            y += 5;
            return(lbl);
        }
Esempio n. 9
0
        public async Task <ActionResult <IEnumerable <FormatLabel> > > GetFormats()
        {
            var x = _formatLabelsService.GetAll().ToList().Count();

            if (x == 0)
            {
                var a = new FormatLabel
                {
                    Id   = Guid.Parse("5d92c825-6671-42a1-8852-df35f9280cc7"),
                    Name = "Temperatura",
                };

                var b = new FormatLabel
                {
                    Id   = Guid.Parse("bfd48d51-ba58-4f68-a610-753067d9aa5e"),
                    Name = "Presión",
                };
                _formatLabelsService.Add(a);
                _formatLabelsService.Add(b);
            }

            return(await _formatLabelsService.GetAll().ToListAsync());
        }
Esempio n. 10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // Initialize
            FormatLbl = new FormatLabel(lblEditError);

            artpiece = new Classes.Artpiece();

            // To ensure that a valid username is entered
            string artpieceId = "";

            try
            {
                artpieceId = Request.QueryString["id"].ToString();
            }
            catch (Exception ex)
            {
                //Show error msg
            }

            // Get from DB
            ArtpieceDao dao = new ArtpieceDao();

            artpiece = dao.Get("ARTPIECEID", artpieceId);

            // Validate artpiece ID
            if (artpiece == null)
            {
                Net.Redirect("Artpiece.aspx?id=UNKNOWN");
            }
            else
            {
                // Get Artist info
                ArtistDao artistDao = new ArtistDao();
                artist = artistDao.Get("ARTISTID", artpiece.ArtistId);

                // Will be null if currently logged in user is not an artist
                Artist currentArtist = (Artist)Session["Artist"];

                // Redirect if not original artist
                if (currentArtist == null || artpiece.ArtistId != currentArtist.Id)
                {
                    Net.Redirect("Artpiece.aspx?id=" + artpiece.ArtpieceId);
                }
                else
                {
                    // Show private artpiece to the original artist
                    if (!artpiece.IsPublic && currentArtist.Id == artist.Id)
                    {
                        if (!IsPostBack)
                        {
                            //Display artpiece details
                            lblArtist.Text        = artist.DisplayName;
                            lblDescription.Text   = artpiece.About;
                            lblTitle.Text         = artpiece.Title + "(PRIVATE ARTPIECE)";
                            txtStocks.Text        = artpiece.Stocks + "";
                            artpieceImg.ImageUrl  = artpiece.ImageLink;
                            lblArtpiecePrice.Text = Quick.FormatPrice(artpiece.Price);

                            if (!artpiece.IsForSale)
                            {
                                lblForSale.Text     = "NOT FOR SALE";
                                lblForSale.CssClass = "notforsale";
                            }
                        }
                    }
                    else                     // Show public artpiece
                    {
                        if (!IsPostBack)
                        {
                            //Display artpiece details
                            lblArtist.Text        = artist.DisplayName;
                            lblDescription.Text   = artpiece.About;
                            lblTitle.Text         = artpiece.Title;
                            txtStocks.Text        = artpiece.Stocks + "";
                            lblArtpiecePrice.Text = Quick.FormatPrice(artpiece.Price);
                            artpieceImg.ImageUrl  = artpiece.ImageLink;


                            if (!artpiece.IsForSale)
                            {
                                lblForSale.Text     = "NOT FOR SALE";
                                lblForSale.CssClass = "notforsale";
                            }
                        }
                    }
                }
            }
        }