private void btnSave_Click(object sender, EventArgs e) { if (IsCorrectEntries()) { int intResults = 0; using (clsEmployeeResearch er = new clsEmployeeResearch()) { er.Username = _strUsername; er.Title = txtTitle.Text; er.DateCompleted = txtDateCompleted.Text; er.Remarks = txtRemarks.Text; intResults = er.Add(); } if (intResults > 0) { _frmEmployeeDetails.LoadResearchList(); if (MessageBox.Show(clsMessageBox.MessageBoxSuccessAddAskNew, clsMessageBox.MessageBoxText, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { ClearFields(); } else { this.Close(); } } } }
protected void btnAdd_Click(object sender, EventArgs e) { clsEmployeeResearch er = new clsEmployeeResearch(); er.Username = Request.Cookies["Speedo"]["UserName"].ToString(); er.Title = (txtTitle.Text.Length > 100 ? txtTitle.Text.Substring(0, 100) : txtTitle.Text); er.DateCompleted = (txtDateCompleted.Text.Length > 50 ? txtDateCompleted.Text.Substring(0, 50) : txtDateCompleted.Text); er.Remarks = (txtDetails.Text.Length > 255 ? txtDetails.Text.Substring(0, 255) : txtDetails.Text); er.Add(); ClearFields(); BindResearchList(); }