Example #1
0
        private void cmdSave_Click(object sender, EventArgs e)
        {
            if (lv.SelectedItems.Count == 0)
            {
                MessageBox.Show("Please Choose the Prize");
                return;
            }
            string fileName = lv.SelectedItems[0].Tag.ToString();

            fileName = fileName + ".csv";

            string currentNo = txtCar_1.Text.Trim() + txtCar_2.Text.Trim() + txtCar_3.Text.Trim() + txtCar_4.Text.Trim() + txtCar_5.Text.Trim() + txtCar_6.Text.Trim();

            BackEnd.SaveAll(currentNo, "AllPrizes.csv", lv.SelectedItems[0].Tag.ToString());//Save for all prizes
            BackEnd.Save(currentNo, fileName);


            foreach (Control c in this.Controls)
            {
                if (c is IRefreshable && c is WinnerBox)
                {
                    WinnerBox wb = (WinnerBox)c;
                    wb.FileName = wb.Tag.ToString() + ".csv";
                    IRefreshable iRefresh = (IRefreshable)wb;
                    iRefresh.IRefresh();
                }
            }
            this.frmDraw.LoadWinningNos();
            MessageBox.Show("Saving Successfull");
            Clear();
        }
Example #2
0
 private void LoadWinningNos()
 {
     foreach (Control c in this.Controls)
     {
         if (c is IRefreshable && c is WinnerBox)
         {
             WinnerBox wb = (WinnerBox)c;
             wb.FileName = wb.Tag.ToString() + ".csv";
             IRefreshable iRefresh = (IRefreshable)wb;
             iRefresh.IRefresh();
         }
     }
 }