Ejemplo n.º 1
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            if (cboDirect.SelectedIndex > 0 && cboContra.SelectedIndex > 0)
            {
                foreach (DataGridViewRow row in dataGridView1.Rows)
                {
                    // do something with the row..
                    if (row.Selected == true)
                    {
                        //int nID = Convert.ToInt32(row.Cells["Id_Vault_HCM"].Value);
                        int    nID           = Convert.ToInt32(row.Cells[row.Cells.Count - 1].Value);
                        string sDirectGUID   = cboDirect.SelectedValue.ToString();
                        string sContraGUID   = cboContra.SelectedValue.ToString();
                        string sFunctionGUID = cboFunction.SelectedValue.ToString();
                        string sCostingGUID  = string.Empty;//cboCosting.SelectedValue.ToString();
                        string sFundGUID     = cboFund.SelectedValue.ToString();
                        string sProjectGUID  = cboProject.SelectedValue.ToString();
                        string sRegionGUID   = cboRegion.SelectedValue.ToString();


                        using (Lookup_Vault_HCMTableAdapter ta = new Lookup_Vault_HCMTableAdapter())
                        {
                            ta.UpdateQuery(sProjectGUID, sFundGUID, sDirectGUID, sContraGUID, sRegionGUID, sFunctionGUID, nID);
                        }
                    }
                }
                LoadData();
            }
            else
            {
                MessageBox.Show("Please select a value first in dropdown", "Update Item", MessageBoxButtons.OK);
            }
        }
Ejemplo n.º 2
0
 private void RefreshGrid()
 {
     try
     {
         Lookup_Vault_HCMTableAdapter ta = new Lookup_Vault_HCMTableAdapter();
         ta.Fill(this.mSCOA_VaultDataSet1.Lookup_Vault_HCM);
         BeginInvoke((MethodInvoker) delegate
         {
             BindingSource bs         = new BindingSource();
             bs.DataSource            = this.mSCOA_VaultDataSet1.Lookup_Vault_HCM;
             dataGridView1.DataSource = bs;
             bs.ResetBindings(false);
             //dataGridView1.DataSource = this.mSCOA_VaultDataSet1.Lookup_Vault_HCM;
             dataGridView1.Refresh();
         });
     }
     catch (Exception ex)
     {
     }
 }