private void btnSave_Click(object sender, EventArgs e) { if (IsCorrectEntries()) { int intResults = 0; using (clsEmployeeAchievement ea = new clsEmployeeAchievement()) { ea.Username = _strUsername; ea.Achievement = txtAchievement.Text; ea.AchievementDate = txtAchieveDate.Text; ea.Details = txtDetails.Text; intResults = ea.Insert(); } if (intResults > 0) { _frmEmployeeDetails.LoadAchievementList(); if (MessageBox.Show(clsMessageBox.MessageBoxSuccessAddAskNew, clsMessageBox.MessageBoxText, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { ClearFields(); } else { this.Close(); } } } }
protected void dgEducation_DeleteCommand(object source, DataGridCommandEventArgs e) { HiddenField phdnAchvCode = (HiddenField)e.Item.FindControl("hdnAchvCode"); clsEmployeeAchievement ea = new clsEmployeeAchievement(phdnAchvCode.Value); ea.Delete(); BindAchievementList(); }
/////////////////////////// ///////// Methods ///////// /////////////////////////// private void LoadDetails() { using (clsEmployeeAchievement ea = new clsEmployeeAchievement(_strAchievementCode)) { ea.Fill(); txtAchievement.Text = ea.Achievement; txtAchieveDate.Text = ea.AchievementDate; txtDetails.Text = ea.Details; } txtAchievement.Focus(); }
protected void btnAdd_Click(object sender, EventArgs e) { clsEmployeeAchievement ea = new clsEmployeeAchievement(); ea.Username = Request.Cookies["Speedo"]["UserName"].ToString(); ea.Achievement = txtAchievement.Text; ea.AchievementDate = txtDateAchieved.Text; ea.Details = (txtDetails.Text.Length > 255 ? txtDetails.Text.Substring(0, 255) : txtDetails.Text); ea.Add(); ClearFields(); BindAchievementList(); }
private void btnSave_Click(object sender, EventArgs e) { if (IsCorrectEntries()) { int intResults = 0; clsEmployeeAchievement ea = new clsEmployeeAchievement(); ea.AchievementCode = _strAchievementCode; ea.Achievement = txtAchievement.Text; ea.AchievementDate = txtAchieveDate.Text; ea.Details = txtDetails.Text; intResults = ea.Update(); if (intResults > 0) { _frmEmployeeDetails.LoadAchievementList(); this.Close(); } } }
protected void btnSave_Click(object sender, EventArgs e) { foreach (DataGridItem itm in dgAchievement.Items) { HiddenField phdnAchvCode = (HiddenField)itm.FindControl("hdnAchvCode"); TextBox ptxtAchievement = (TextBox)itm.FindControl("txtAchievement"); TextBox ptxtDetails = (TextBox)itm.FindControl("txtRemarks"); TextBox ptxtAchiveDate = (TextBox)itm.FindControl("txtAchiveDate"); clsEmployeeAchievement ea = new clsEmployeeAchievement(); ea.AchievementCode = phdnAchvCode.Value; ea.Achievement = ptxtAchievement.Text; ea.AchievementDate = ptxtAchiveDate.Text; ea.Details = (ptxtDetails.Text.Length > 255 ? ptxtDetails.Text.Substring(0, 255) : ptxtDetails.Text); ea.Edit(); } BindAchievementList(); }