private void FormGenerateLicense_Load(object sender, EventArgs e) { try { parent = this.ParentForm as FormMain; cboTake.SelectedIndex = 9; cboUser.SelectedIndex = 0; cboFollowUpBy.SelectedIndex = 0; dateTimePickerLicenseGenerate.MinDate = DateTime.Today; using (TBL_SEASON_DATA_ACCESS sda = new TBL_SEASON_DATA_ACCESS()) { var season_name = sda.ShowSeasonNameByID(ControlWork.SEASON_ID); foreach (var item in season_name) { txtSeason.Text = item.SEASON_NAME.ToString(); SEASON_ID = item.SEASON_ID; } } using (TBL_USER_DATA_ACCESS uda = new TBL_USER_DATA_ACCESS()) { cboUser.DataSource = uda.ShowUserActive(); cboUser.DisplayMember = "USERNAME"; cboUser.ValueMember = "USER_ID"; cboFollowUpBy.DataSource = uda.ShowUserActive(); cboFollowUpBy.DisplayMember = "USERNAME"; cboFollowUpBy.ValueMember = "USER_ID"; } GC.Collect(); } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OKCancel, MessageBoxIcon.Error); } }
private void FormUpdateSeason_Load(object sender, EventArgs e) { using (TBL_SEASON_DATA_ACCESS sda = new TBL_SEASON_DATA_ACCESS()) { foreach (var item in sda.CheckSeasonWithoutExisting(txtSeasonName.Text)) { SEASON_NAME = item.SEASON_NAME; MessageBox.Show(SEASON_NAME); } } try { using (TBL_SEASON_DATA_ACCESS sda = new TBL_SEASON_DATA_ACCESS()) { foreach (var item in sda.ShowSeasonNameByID(Convert.ToInt32(ControlSeason.SEASON_ID))) { txtSeasonName.Text = item.SEASON_NAME; txtNote.Text = item.NOTE; txtCreateBy.Text = item.CREATE_BY; SEASON_ID = item.SEASON_ID; } } } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OKCancel, MessageBoxIcon.Error); } GC.Collect(); }