private void btnSave_Click(object sender, EventArgs e) { if (ValidateEntries()) { int intResults = 0; using (clsEmployeeDependent ed = new clsEmployeeDependent()) { ed.Username = _strUsername; ed.Name = txtName.Text; ed.Birthdate = dtpBirthDate.Value; ed.Relation = txtRelation.Text; intResults = ed.Add(); } if (intResults > 0) { _frmEmployeeDetails.LoadDependentsList(); if (MessageBox.Show(clsMessageBox.MessageBoxSuccessAddAskNew, clsMessageBox.MessageBoxText, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { ClearFields(); } else { this.Close(); } } } }
protected void btnDependentAdd_Click(object sender, EventArgs e) { clsEmployeeDependent ed = new clsEmployeeDependent(); ed.Username = Request.Cookies["Speedo"]["UserName"].ToString(); ed.Name = txtDpndName.Text; ed.Birthdate = dtpDpndBirthdate.Date; ed.Relation = txtDpndRelation.Text; ed.Add(); txtDpndName.Text = ""; txtDpndRelation.Text = ""; dtpDpndBirthdate.Date = DateTime.Now; BindDependentList(); }