예제 #1
0
        public FrmShowBidEntry(List <ArtShowItem> items)
        {
            InitializeComponent();
            Items        = items;
            Current      = null;
            CurrentIndex = -1;

            LstItems.BeginUpdate();
            foreach (var showItem in items)
            {
                var item = new ListViewItem {
                    Text = showItem.ShowNumber.ToString()
                };
                item.SubItems.Add(showItem.Title);
                item.SubItems.Add(showItem.PurchaserNumber.ToString());
                item.SubItems.Add(showItem.FinalSalePrice != null ? ((decimal)showItem.FinalSalePrice).ToString("C") : "");
                item.BackColor = showItem.Auctioned ? Color.LightGreen : Color.White;
                item.Tag       = showItem;
                LstItems.Items.Add(item);
            }
            LstItems.ListViewItemSorter = new ListViewItemComparer(0, true);
            LstItems.Sort();
            LstItems.EndUpdate();
            LstItems.Items[0].Selected = true;
        }
예제 #2
0
        private void txtSearch_TextChanged(object sender, EventArgs e)
        {
            LstItems.BeginUpdate();
            LstItems.Items.Clear();
            var filtered = txtSearch.TextLength > 0 ?
                           Items.Where(i => i.Title.ToLower().Contains(txtSearch.Text.ToLower())).ToList() :
                           Items;

            foreach (var shopItem in filtered)
            {
                var item = new ListViewItem
                {
                    Text = shopItem.ShowNumber.ToString()
                };
                item.SubItems.Add(shopItem.Title);
                item.SubItems.Add(shopItem.ArtistName);
                item.SubItems.Add(shopItem.Price.ToString("C"));
                item.SubItems.Add((shopItem.QuantitySent - shopItem.QuantitySold).ToString());
                if (shopItem.QuantitySent - shopItem.QuantitySold == 0)
                {
                    item.ForeColor = Color.Red;
                    item.BackColor = Color.LightGray;
                }
                item.Tag = shopItem;
                LstItems.Items.Add(item);
            }
            LstItems.EndUpdate();
        }
예제 #3
0
        public FrmSellItems(Person purchaser)
        {
            InitializeComponent();
            Purchaser      = purchaser;
            StripeFirstTry = true;

            TotalPrice = 0;
            TotalTax   = 0;
            TotalDue   = 0;

            LblTaxes.Text = "Taxes @ " + decimal.Round(Program.TaxRate * 100, 1) + "%";

            var data    = Encoding.ASCII.GetBytes("action=GetPrintShopList&year=" + Program.Year.ToString());
            var request = WebRequest.Create(Program.URL + "/functions/artQuery.php");

            request.ContentLength = data.Length;
            request.ContentType   = "application/x-www-form-urlencoded";
            request.Method        = "POST";
            using (var stream = request.GetRequestStream())
                stream.Write(data, 0, data.Length);

            var response = (HttpWebResponse)request.GetResponse();
            var results  = new StreamReader(response.GetResponseStream()).ReadToEnd();

            Items = JsonConvert.DeserializeObject <List <PrintShopItem> >(results);

            LstItems.BeginUpdate();
            foreach (var shopItem in Items)
            {
                var item = new ListViewItem
                {
                    Text = shopItem.ShowNumber.ToString()
                };
                item.SubItems.Add(shopItem.Title);
                item.SubItems.Add(shopItem.ArtistName);
                item.SubItems.Add(shopItem.Price.ToString("C"));
                item.SubItems.Add((shopItem.QuantitySent - shopItem.QuantitySold).ToString());
                if (shopItem.QuantitySent - shopItem.QuantitySold == 0)
                {
                    item.ForeColor = Color.Red;
                    item.BackColor = Color.LightGray;
                }
                else if (shopItem.IsCharity)
                {
                    item.BackColor = Color.LightGreen;
                }
                item.Tag = shopItem;
                LstItems.Items.Add(item);
            }
            LstItems.EndUpdate();
        }
예제 #4
0
        public FrmSellItems(Person recipient)
        {
            InitializeComponent();
            StripeFirstTry = true;

            OneTimeRecipients = new Dictionary <int, Person>();
            Recipients        = new Dictionary <int, Person>();
            if (recipient.PeopleID != null)
            {
                Recipients.Add((int)recipient.PeopleID, recipient);
            }
            else if (recipient.OneTimeID != null)
            {
                Recipients.Add((int)recipient.OneTimeID, recipient);
            }

            Purchaser = recipient;
            CmbRecipient.Items.Add(recipient);
            CmbRecipient.Items.Add("Someone Else...");
            CmbRecipient.SelectedIndex = 0;

            var data    = Encoding.ASCII.GetBytes("action=AvailableItems");
            var request = WebRequest.Create(Program.URL + "/functions/salesQuery.php");

            request.ContentLength = data.Length;
            request.ContentType   = "application/x-www-form-urlencoded";
            request.Method        = "POST";
            using (var stream = request.GetRequestStream())
                stream.Write(data, 0, data.Length);

            var response = (HttpWebResponse)request.GetResponse();
            var results  = new StreamReader(response.GetResponseStream()).ReadToEnd();

            Items = JsonConvert.DeserializeObject <List <SaleItem> >(results);

            LstItems.BeginUpdate();
            foreach (var saleItem in Items)
            {
                var item = new ListViewItem
                {
                    Text = saleItem.Year + " " + saleItem.Description
                };
                item.SubItems.Add(saleItem.Category);
                item.SubItems.Add(saleItem.Price.ToString("C"));
                item.SubItems.Add(saleItem.AvailableUntil.ToShortDateString());
                item.Tag = saleItem;
                LstItems.Items.Add(item);
            }
            LstItems.EndUpdate();
        }
예제 #5
0
        private void LstItems_ColumnClick(object sender, ColumnClickEventArgs e)
        {
            if (Math.Abs(ItemsSortColumn) == Math.Abs(e.Column))
            {
                ItemsSortAscend = !ItemsSortAscend;
                LstItems.Columns[e.Column].ImageIndex = ItemsSortAscend ? 0 : 1;
            }
            else
            {
                LstItems.Columns[ItemsSortColumn].ImageIndex = -1;
                LstItems.Columns[ItemsSortColumn].TextAlign  = LstItems.Columns[ItemsSortColumn].TextAlign;
                ItemsSortAscend = true;
                ItemsSortColumn = e.Column;
                LstItems.Columns[e.Column].ImageIndex = 0;
            }

            LstItems.BeginUpdate();
            LstItems.ListViewItemSorter = new ListViewItemComparer(e.Column, ItemsSortAscend);
            LstItems.Sort();
            LstItems.EndUpdate();
        }