示例#1
0
 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();
 }
示例#2
0
        public bool Invalid()
        {
            bool flag = false;

            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);
                    if (txtSeasonName.Text == SEASON_NAME)
                    {
                        this.txtSeasonName.SetValidation(string.Format(Properties.Resources.SEASON_AREADY, this.label1.Text));
                        flag = true;
                        txtSeasonName.Focus();
                    }
                }
            }

            return(flag);
        }