Пример #1
0
 private void btnLuu_Click(object sender, EventArgs e)
 {
     try
     {
         ThamSoDauVao_class thamSoDauVao = new ThamSoDauVao_class()
         {
             Drift_x     = double.Parse(tbdrift_x.Text),
             Drift_y     = double.Parse(tbdrift_y.Text),
             IdLoaiDau   = gridLookUpEditDau.EditValue.CastTo <int>(),
             Luongdau    = double.Parse(tbluongdau.Text),
             Salinity    = double.Parse(tbsalinity.Text),
             Sign_height = double.Parse(tbsign_height.Text),
             Temperature = double.Parse(tbtemperature.Text),
             Thoigian    = DateTime.Parse(tbthoigian.Text),
             Upward_sea  = double.Parse(tbupward_sea.Text),
             Vitr_y      = int.Parse(tbvitrithatthoat_y.Text),
             Vitri_x     = int.Parse(tbvitrithatthoat_x.Text),
             X_water     = double.Parse(tbx_water.Text),
             Y_water     = double.Parse(tby_water.Text),
             X_wind      = double.Parse(tbx_wind.Text),
             Y_wind      = double.Parse(tby_wind.Text),
             Mathamso    = int.Parse(tbmathamso.Text)
         };
         Program.thamSoDauVaoSql.UpdateThamSoDauVao(thamSoDauVao);
         MessageBox.Show("Cập nhật thành công");
     }
     catch (Exception exception)
     {
         MessageBox.Show("Có Lỗi Xảy Ra");
     }
 }
Пример #2
0
        public bool ThemThamSo(string mathamso, string drift_x, string drift_y, string x_water, string y_water, string x_wind, string y_wind, string thoigian, string sign_height, string salinity, string upward_sea, string temperature,
                               string vitri_x, string vitri_y, string luongdau)
        {
            ThamSoDauVao_class thamSoDauVao = new ThamSoDauVao_class
            {
                Mathamso    = Convert.ToInt32(mathamso),
                Drift_x     = float.Parse(drift_x),
                Drift_y     = float.Parse(drift_y),
                X_water     = float.Parse(x_water),
                Y_water     = float.Parse(y_water),
                X_wind      = float.Parse(x_wind),
                Y_wind      = float.Parse(y_wind),
                Sign_height = float.Parse(sign_height),
                Salinity    = float.Parse(salinity),
                Upward_sea  = float.Parse(upward_sea),
                Temperature = float.Parse(temperature),
                Luongdau    = float.Parse(luongdau),
                Vitri_x     = Convert.ToInt32(vitri_x),
                Vitr_y      = Convert.ToInt32(vitri_y),
                IdLoaiDau   = Convert.ToInt32(Program.maLoaiDau),
                Thoigian    = DateTime.ParseExact(thoigian, "yyyy-MM-dd HH:mm:ss,fff",
                                                  null)
            };

            if (Program.thamSoDauVaoSql.ThemThamSo(thamSoDauVao))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #3
0
 public SuaTDV(ThamSoDauVao_class thamSoDauVao)
 {
     ThamSoDauVaoClass = thamSoDauVao;
     InitializeComponent();
     gridLookUpEditDau.Properties.DataSource    = Program.thamSoDauVaoSql.GetLoaiDau();
     gridLookUpEditDau.Properties.ValueMember   = "idLoaiDau";
     gridLookUpEditDau.Properties.DisplayMember = "TenLoaiDau";
 }
Пример #4
0
        private void buttonSua_Click(object sender, EventArgs e)
        {
            ThamSoDauVao_class thamSoDauVao = Program.thamSoDauVaoSql.LayThamSoDauVaoVoiMaThamSo(Int32.Parse(dataGridViewTSDV.Rows[dataGridViewTSDV.SelectedRows[0].Index].Cells["idThamSo"].Value.ToString()));

            if (thamSoDauVao != null)
            {
                SuaTDV suaTdv = new SuaTDV(thamSoDauVao);
                suaTdv.ShowDialog();
                Program.thamSoDauVaoSql.getDataTSDV(dataGridViewTSDV, searchLookUpEditTSDV);
            }
            else
            {
                MessageBox.Show("Có Lỗi Xảy Ra");
            }
        }
Пример #5
0
        private void dataGridViewTSDV_CellEnter(object sender, DataGridViewCellEventArgs e)
        {
            int numrow;

            numrow = e.RowIndex;
            getDataFromDgvIntoTextBox(tbmathamso, numrow, "idThamSo");
            Program.arr[0] = tbmathamso.Text;
            getDataFromDgvIntoTextBox(tbx_water, numrow, "x_water_velocity");
            Program.arr[1] = tbx_water.Text;
            getDataFromDgvIntoTextBox(tby_water, numrow, "y_water_velocity");
            Program.arr[2] = tby_water.Text;
            getDataFromDgvIntoTextBox(tbx_wind, numrow, "x_wind");
            Program.arr[3] = tbx_wind.Text;
            getDataFromDgvIntoTextBox(tby_wind, numrow, "y_wind");
            Program.arr[4] = tby_wind.Text;
            getDataFromDgvIntoTextBox(tbupward_sea, numrow, "upward_velocity");
            Program.arr[5] = tbupward_sea.Text;
            getDataFromDgvIntoTextBox(tbsign_height, numrow, "significant_height");
            Program.arr[6] = tbsign_height.Text;
            getDataFromDgvIntoTextBox(tbdrift_x, numrow, "stokes_drift_x");
            Program.arr[7] = tbdrift_x.Text;
            getDataFromDgvIntoTextBox(tbdrift_y, numrow, "stokes_drift_y");
            Program.arr[8] = tbdrift_y.Text;
            getDataFromDgvIntoTextBox(tbtemperature, numrow, "temperature");
            Program.arr[9] = tbtemperature.Text;
            getDataFromDgvIntoTextBox(tbsalinity, numrow, "salinity");
            Program.arr[10] = tbsalinity.Text;
            getDataFromDgvIntoTextBox(tbmaloaidau, numrow, "idLoaiDau");
            //Program.arr[11] = tbmaloaidau.Text;
            getDataFromDgvIntoTextBox(tbvitrithatthoat_x, numrow, "vitridauthatthoat_x");
            Program.arr[12] = tbvitrithatthoat_x.Text;
            getDataFromDgvIntoTextBox(tbvitrithatthoat_y, numrow, "vitridauthatthoat_y");
            Program.arr[13] = tbvitrithatthoat_y.Text;
            getDataFromDgvIntoTextBox(tbluongdau, numrow, "khoiluongdau");
            Program.arr[14] = tbluongdau.Text;
            ThamSoDauVao_class thamSoDauVao = Program.thamSoDauVaoSql.LayThamSoDauVaoVoiMaKeHoach(Int32.Parse(dataGridViewTSDV.Rows[e.RowIndex].Cells["idThamSo"].Value.ToString()));

            if (thamSoDauVao != null)
            {
                tbthoigian.Text = thamSoDauVao.Thoigian.ToString("hh:mm:ss dd/MM/yyyy");
            }
        }