Ejemplo n.º 1
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            for (int i = 0; i < globals.stacksize; i++)
            {
                upload.mystackx.Pop();
                upload.mystacky.Pop();
            }
            MessageBox.Show("Size for x: " + upload.mystackx.Count + Environment.NewLine + "Size for y: " + upload.mystacky.Count);
            upload redofrm = new upload();

            Dispose();
            redofrm.ShowDialog();
        }
        /* public  void Control_KeyUp(object sender, KeyEventArgs e)
         * {
         *   if ((e.KeyCode == Keys.Enter) || (e.KeyCode == Keys.Return))
         *   {
         *       this.SelectNextControl((Control)sender, true, true, true, true);
         *   }
         *
         * }*/
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                if (get_indices())
                {
                    if (radioApendNo.Checked == true)
                    {
                        string season  = comboBox1.SelectedText.ToString();
                        int    chartno = int.Parse(textBox1.Text);
                        // int chartduration = int.Parse(textBox4.Text);
                        var dateon       = dateTimePicker1.Value.ToString("yyyy/MM/dd");
                        var dateoff      = dateTimePicker2.Value.ToString("yyyy/MM/dd");
                        var datedigitzed = System.DateTime.Now;
                        // var range = comboBox2.SelectedText;

                        con_db newentry = new con_db();
                        string sql      = "INSERT INTO charts (chart_number,date_digitized,date_on,date_off,season,st_code) VALUES ('" + chartno + "','" + datedigitzed + "','" + dateon + "','" + dateoff + "','" + season + "','" + globals.stationcode + "')";
                        if (newentry.Insert(sql))
                        {
                            globals.chartnumber = chartno;
                            globals.x_date      = dateon;
                            Hide();

                            upload newform = new upload();
                            newform.ShowDialog();
                            Show();
                            globals.Clearallboxes(this);
                        }
                        else
                        {
                            MessageBox.Show("data not updated");
                        }
                    }

                    else if (radioApendYes.Checked == true)
                    {
                        int    chartno  = int.Parse(textBox3.Text);
                        string sql      = "SELECT * FROM charts WHERE chart_number ='" + chartno + "'AND st_code ='" + globals.stationcode + "'";
                        con_db newentry = new con_db();
                        if (newentry.SelectVerifyStation(sql))
                        {
                            globals.chartnumber = chartno;
                            Hide();
                            upload newform = new upload();
                            newform.ShowDialog();
                            Show();
                        }
                        else
                        {
                            labelcantappend.Text    = "Can not find chart to append";
                            labelcantappend.Visible = true;
                            textBox3.Focus();
                            textBox3.SelectAll();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("" + ex.Message);
            }
        }