private void tabControl1_Selected(object sender, TabControlEventArgs e) { _currentTab = e.TabPage.Tag.ToString(); switch (_currentTab) { case "GENERAL": butSave.Enabled = true; butSave.Text = "Save General Info"; break; case "CONSUMPTION": butSave.Enabled = true; butSave.Text = "Save Service"; if (!_contabSelected) { DataUsageEnum duenum = (DataUsageEnum)Enum.Parse(typeof(DataUsageEnum), _forecastInfo.DataUsage); switch (duenum) { case DataUsageEnum.DATA_USAGE1: SDataUsage ctr = new SDataUsage(_forecastInfo); // ctr.OnDataUsageEdit += new EventHandler(ctr_OnDataUsageEdit); ctr.ForecastInfoDataChanged += new EventHandler <EventArgs>(ctr_ForecastInfoDataChanged); ctr.Dock = DockStyle.Fill; tabConsumption.Controls.Add(ctr); break; case DataUsageEnum.DATA_USAGE2: SReported ctr1 = new SReported(_forecastInfo); // ctr1.ForecastInfoDataChanged += new EventHandler<EventArgs>(ctr_ForecastInfoDataChanged); ctr1.ForecastInfoDataChanged += new EventHandler <EventArgs>(ctr_ForecastInfoDataChanged); ctr1.Dock = DockStyle.Fill; tabConsumption.Controls.Add(ctr1); break; case DataUsageEnum.DATA_USAGE3: SCategory ctr2 = new SCategory(_forecastInfo); // ctr2.ForecastInfoDataChanged += new EventHandler<EventArgs>(ctr_ForecastInfoDataChanged); ctr2.ForecastInfoDataChanged += new EventHandler <EventArgs>(ctr_ForecastInfoDataChanged); ctr2.Dock = DockStyle.Fill; tabConsumption.Controls.Add(ctr2); break; } _contabSelected = true; } break; case "REPORT": butSave.Enabled = false; break; } }
public static string GetDatausageDescription(string dusage) { string description = ""; DataUsageEnum du = (DataUsageEnum)Enum.Parse(typeof(DataUsageEnum), dusage); switch (du) { case DataUsageEnum.DATA_USAGE1: description = DataUsage1_Description; break; case DataUsageEnum.DATA_USAGE2: description = DataUsage2_Description; break; case DataUsageEnum.DATA_USAGE3: description = DataUsage3_Description; break; } return(description); }