private void dataGridView2_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            // EditDependent();
            DependentUser du = new DependentUser(this.dataGridView2.CurrentRow);

            mem.EditDependentForm(du);
        }
Ejemplo n.º 2
0
        public void EditDependentForm(DependentUser du)
        {
            try
            {
                Dependent de = new Dependent(du.Type);
                de.TDID.Text   = du.Id;
                de.TDName.Text = du.Name;

                de.TDREID.Text = du.RelatedEmployee;
                de.TDAge.Text  = du.Age.ToString();
                de.Show();
                de.TypeSelect();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Ejemplo n.º 3
0
        public bool UpdateDependent(DependentUser du)
        {
            try
            {
                DataTable dt = new DataTable();
                dt.Columns.Add();
                dt.Columns.Add();
                dt.Columns.Add();
                dt.Columns.Add();
                dt.Columns.Add();

                dt.Rows.Add(new object[] { du.Id, du.Name, du.Type, du.RelatedEmployee, du.Age });
                return(mem.UpdateDependent(dt));
            }
            catch (Exception ee) {
                MessageBox.Show(ee.ToString());
                return(false);
            }
        }
Ejemplo n.º 4
0
        public void EditDependentForm(DependentUser du)
        {
            try
            {
                Dependent de = new Dependent(du.Type);
                de.TDID.Text   = du.Id;
                de.TDName.Text = du.Name;

                de.TDREID.Text           = du.RelatedEmployee;
                de.TDOB.Value            = du.DOB1;
                de.Validity.SelectedItem = du.Status.ToString();
                de.Show();
                de.TypeSelect();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
        private void Submit_Click(object sender, EventArgs e)
        {
            DependentUser dp = new DependentUser(TDID.Text.ToString(), TDName.Text.ToString(), Convert.ToInt32(DType.SelectedValue.ToString()), CEID.SelectedValue.ToString(), TDOB.Value);

            if (mem.RegisterDependent(dp))
            {
                MessageBox.Show("Update Successful");
            }
            else
            {
                MessageBox.Show("Update Failed");
            }
            dataGridView2.Refresh();
            TDID.Clear();
            TDName.Clear();
            //TDOB.Clear();

            cb.FillDataGrid(dataGridView2, "Dependent");
            //ViewDependent();
        }
        public void UpdateDependent()
        {
            try
            {
                DependentUser dp = new DependentUser(TDID.Text.ToString(), TDName.Text.ToString(), Convert.ToInt32(CDType.SelectedValue.ToString()), TDREID.Text.ToString(), TDOB.Value, Convert.ToBoolean(Validity.SelectedItem.ToString()));
                if (mem.UpdateDependent(dp))
                {
                    MessageBox.Show("Update Successful");
                }
                else
                {
                    MessageBox.Show("Update Failed");
                }
            }


            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Ejemplo n.º 7
0
        public bool RegisterDependent(DependentUser d)
        {
            try
            {
                DataTable dt = new DataTable();
                dt.Columns.Add();
                dt.Columns.Add();
                dt.Columns.Add();
                dt.Columns.Add();
                dt.Columns.Add();


                dt.Rows.Add(new Object[] { d.Id, d.Name, d.Type, d.RelatedEmployee, d.Age });

                return(mem.InsertDependent(dt));
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                return(false);
            }
        }