コード例 #1
0
ファイル: GiftCertificateRedeem.cs プロジェクト: lickey10/POS
        private void populateGiftCertificateInfo(GiftCertificate giftCertificate)
        {
            currentGiftCertificate = giftCertificate;

            txtName.Text   = giftCertificate.Name;
            txtAmount.Text = giftCertificate.Amount.ToString("N");
            txtUpc.Text    = giftCertificate.UPC;
            lblStatus.Text = giftCertificate.Status;

            switch (giftCertificate.Status)
            {
            case "Active":
                this.BackColor   = Color.LightGreen;
                btnActivate.Text = "Deactivate";
                btnApply.Enabled = true;
                break;

            case "NotActivated":
                btnActivate.Text = "Activate";
                btnApply.Enabled = false;
                this.BackColor   = Color.LightBlue;
                break;

            case "Deactivated":
            default:
                this.BackColor   = Color.LightSalmon;
                btnActivate.Text = "Activate";
                btnApply.Enabled = false;
                break;
            }
        }
コード例 #2
0
ファイル: GiftCertificateRedeem.cs プロジェクト: lickey10/POS
        private void ddGiftCertificates_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (ddGiftCertificates.SelectedItem is GiftCertificate)
            {
                currentGiftCertificate = (GiftCertificate)ddGiftCertificates.SelectedItem;

                populateGiftCertificateInfo(currentGiftCertificate);
            }
        }
コード例 #3
0
ファイル: GiftCertificateRedeem.cs プロジェクト: lickey10/POS
        public GiftCertificateFormRedeem(GiftCertificate giftCertificate)
        {
            populateGiftCertificateInfo(currentGiftCertificate);

            startUp();

            if (giftCertificate.Amount > 0)
            {
                this.BackColor = Color.LightGreen;
            }
            else
            {
                this.BackColor = Color.Red;
            }
        }
コード例 #4
0
ファイル: GiftCertificateRedeem.cs プロジェクト: lickey10/POS
        private void populateGiftCertificates()
        {
            ddGiftCertificates.Items.Clear();

            DataTable dtGiftCertificates = xmlData.Select("*", "datecreated asc", XmlData.Tables.GiftCertificates);
            DateTime  tempDate;
            double    price = 0;

            if (dtGiftCertificates != null)
            {
                foreach (DataRow dr in dtGiftCertificates.Rows)
                {
                    if (DateTime.TryParse(dr["DateCreated"].ToString(), out tempDate))
                    {
                        double.TryParse(dr["amount"].ToString(), out price);

                        GiftCertificate newGiftCertificate = new GiftCertificate();
                        newGiftCertificate = (GiftCertificate)Common.CreateObjects.FromDataRow(dr, newGiftCertificate);
                        //newGiftCertificate.ID = int.Parse(dr["id"].ToString());
                        //newGiftCertificate.Name = dr["name"].ToString();
                        //newGiftCertificate.Amount = price;
                        //newGiftCertificate.DateCreated = DateTime.Parse(dr["dateCreated"].ToString());

                        //if (dr["displayName"] != null && dr["displayName"].ToString().Length > 0)
                        //    newGiftCertificate.DisplayName = dr["displayName"].ToString();
                        //else
                        //    newGiftCertificate.DisplayName = dr["name"].ToString();

                        //ddGiftCertificates.Items.Add(tempDate.ToShortTimeString() + " " + price.ToString("C"));
                        ddGiftCertificates.Items.Add(newGiftCertificate);
                    }
                }
            }

            ddGiftCertificates.Items.Insert(0, "Choose Gift Certificate To View");
            ddGiftCertificates.SelectedIndex = 0;
        }