private MediaInvestment BuildMediaInvestment(MediaInvestment tmpMediaInvestment) { PlanAMediaViewModel _PlanAMedia = (PlanAMediaViewModel)this.DataContext; if (tmpMediaInvestment == null) { tmpMediaInvestment = new MediaInvestment(); } tmpMediaInvestment.Station = this.txtStation.Text; tmpMediaInvestment.Jan = System.Convert.ToInt32(_PlanAMedia.txtJan); tmpMediaInvestment.Feb = System.Convert.ToInt32(_PlanAMedia.txtFeb); tmpMediaInvestment.Mar = System.Convert.ToInt32(_PlanAMedia.txtMar); tmpMediaInvestment.Apr = System.Convert.ToInt32(_PlanAMedia.txtApr); tmpMediaInvestment.May = System.Convert.ToInt32(_PlanAMedia.txtMay); tmpMediaInvestment.June = System.Convert.ToInt32(_PlanAMedia.txtJune); tmpMediaInvestment.July = System.Convert.ToInt32(_PlanAMedia.txtJuly); tmpMediaInvestment.Aug = System.Convert.ToInt32(_PlanAMedia.txtAug); tmpMediaInvestment.Sept = System.Convert.ToInt32(_PlanAMedia.txtSept); tmpMediaInvestment.Oct = System.Convert.ToInt32(_PlanAMedia.txtOct); tmpMediaInvestment.Nov = System.Convert.ToInt32(_PlanAMedia.txtNov); tmpMediaInvestment.Dec = System.Convert.ToInt32(_PlanAMedia.txtDec); return(tmpMediaInvestment); }
private void NumericTextChanged(object sender, TextChangedEventArgs e) { if (!isInit) { MediaInvestment tmpMediaInvestment = BuildMediaInvestment(null); ResetDisplay(tmpMediaInvestment); } }
private void btnAddNewEmpty_Click(object sender, RoutedEventArgs e) { MediaInvestment tmpMediaInvestment = BuildMediaInvestmentEmpty(); m_MediaInvestmentList.Add(tmpMediaInvestment); //Remove and Add new total this.RemoveTotal(); this.AddTotal(); ResetDisplay(); this.lvMediaInvestment.SelectedItem = this.lvMediaInvestment.Items[this.lvMediaInvestment.Items.Count - 2]; }
private void ResetDisplay(MediaInvestment selectedMediaInvestment) { txtStation.Text = selectedMediaInvestment.Station; txtJan.Text = selectedMediaInvestment.Jan.ToString(); txtFeb.Text = selectedMediaInvestment.Feb.ToString(); txtMar.Text = selectedMediaInvestment.Mar.ToString(); txtApr.Text = selectedMediaInvestment.Apr.ToString(); txtMay.Text = selectedMediaInvestment.May.ToString(); txtJune.Text = selectedMediaInvestment.June.ToString(); txtJuly.Text = selectedMediaInvestment.July.ToString(); txtAug.Text = selectedMediaInvestment.Aug.ToString(); txtSept.Text = selectedMediaInvestment.Sept.ToString(); txtOct.Text = selectedMediaInvestment.Oct.ToString(); txtNov.Text = selectedMediaInvestment.Nov.ToString(); txtDec.Text = selectedMediaInvestment.Dec.ToString(); txtTotal.Text = selectedMediaInvestment.Total.ToString(); }
private void ImportPlanA() { foreach (MediaInvestment sourceMediaInvestment in PlanAMediaInvestmentList) { if (sourceMediaInvestment.Station != "Total") { MediaInvestment tmpMediaInvestment = CopyMediaInvestment(sourceMediaInvestment); MediaInvestmentList.Add(tmpMediaInvestment); //Remove and Add new total this.RemoveTotal(); this.AddTotal(); lvMediaInvestment.Items.Refresh(); lvMediaInvestment.SelectedItem = tmpMediaInvestment; } } }
public void RemoveTotal() { bool _remove = false; MediaInvestment _total = null; foreach (MediaInvestment cMediaInvestment in m_MediaInvestmentList) { if (cMediaInvestment.Station == "Total") { _remove = true; _total = cMediaInvestment; } } if (_remove) { m_MediaInvestmentList.Remove(_total); } }
private MediaInvestment BuildMediaInvestmentEmpty() { MediaInvestment tmpMediaInvestment = new MediaInvestment(); tmpMediaInvestment.Station = "New"; tmpMediaInvestment.Jan = 0; tmpMediaInvestment.Feb = 0; tmpMediaInvestment.Mar = 0; tmpMediaInvestment.Apr = 0; tmpMediaInvestment.May = 0; tmpMediaInvestment.June = 0; tmpMediaInvestment.July = 0; tmpMediaInvestment.Aug = 0; tmpMediaInvestment.Sept = 0; tmpMediaInvestment.Oct = 0; tmpMediaInvestment.Nov = 0; tmpMediaInvestment.Dec = 0; return(tmpMediaInvestment); }
private MediaInvestment CopyMediaInvestment(MediaInvestment sourceMediaInvestment) { MediaInvestment targetMediaInvestment = new MediaInvestment(); targetMediaInvestment.Station = sourceMediaInvestment.Station; targetMediaInvestment.Jan = sourceMediaInvestment.Jan; targetMediaInvestment.Feb = sourceMediaInvestment.Feb; targetMediaInvestment.Mar = sourceMediaInvestment.Mar; targetMediaInvestment.Apr = sourceMediaInvestment.Apr; targetMediaInvestment.May = sourceMediaInvestment.May; targetMediaInvestment.June = sourceMediaInvestment.June; targetMediaInvestment.July = sourceMediaInvestment.July; targetMediaInvestment.Aug = sourceMediaInvestment.Aug; targetMediaInvestment.Sept = sourceMediaInvestment.Sept; targetMediaInvestment.Oct = sourceMediaInvestment.Oct; targetMediaInvestment.Nov = sourceMediaInvestment.Nov; targetMediaInvestment.Dec = sourceMediaInvestment.Dec; return(targetMediaInvestment); }
private void btnSave_Click(object sender, RoutedEventArgs e) { if (txtStation.Text != string.Empty) { //Grab the Current Item fill from displ MediaInvestment tmpMediaInvestment = BuildMediaInvestment((MediaInvestment)lvMediaInvestment.SelectedItem); m_MediaInvestmentList[m_MediaInvestmentList.IndexOf(tmpMediaInvestment)] = tmpMediaInvestment; //Remove and Add new total this.RemoveTotal(); this.AddTotal(); lvMediaInvestment.Items.Refresh(); lvMediaInvestment.SelectedItem = tmpMediaInvestment; } else { Xceed.Wpf.Toolkit.MessageBox.Show("Station name can not be blank.", "Station Name Error"); } }
private void btnAddNew_Click(object sender, RoutedEventArgs e) { //TODO Does Name exist? if (txtStation.Text != string.Empty) { MediaInvestment tmpMediaInvestment = BuildMediaInvestment(null); m_MediaInvestmentList.Add(tmpMediaInvestment); //Remove and Add new total this.RemoveTotal(); this.AddTotal(); ResetDisplay(); this.lvMediaInvestment.SelectedItem = this.lvMediaInvestment.Items[this.lvMediaInvestment.Items.Count - 2]; } else { Xceed.Wpf.Toolkit.MessageBox.Show("Station name can not be blank.", "Station Name Error"); } }
private MediaInvestment TotalMediaInvestment() { MediaInvestment _total = new MediaInvestment(); foreach (MediaInvestment cMediaInvestment in m_MediaInvestmentList) { _total.Station = "Total"; _total.Jan += cMediaInvestment.Jan; _total.Feb += cMediaInvestment.Feb; _total.Mar += cMediaInvestment.Mar; _total.Apr += cMediaInvestment.Apr; _total.May += cMediaInvestment.May; _total.June += cMediaInvestment.June; _total.July += cMediaInvestment.July; _total.Aug += cMediaInvestment.Aug; _total.Sept += cMediaInvestment.Sept; _total.Oct += cMediaInvestment.Oct; _total.Nov += cMediaInvestment.Nov; _total.Dec += cMediaInvestment.Dec; _total.Total += cMediaInvestment.Total; } return(_total); }