private void btnSave_Click(object sender, EventArgs e) { if (IsCorrectEntries()) { int intResults = 0; using (clsEmployeeAffiliation ef = new clsEmployeeAffiliation()) { ef.Username = _strUsername; ef.Organization = txtOrganization.Text; ef.Position = txtPosition.Text; ef.InclusiveDates = txtInclusiveDates.Text; ef.Remarks = txtRemarks.Text; intResults = ef.Add(); } if (intResults > 0) { _frmEmployeeDetails.LoadAffiliationList(); if (MessageBox.Show(clsMessageBox.MessageBoxSuccessAddAskNew, clsMessageBox.MessageBoxText, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { ClearFields(); } else { this.Close(); } } } }
protected void dgAffiliation_DeleteCommand(object source, DataGridCommandEventArgs e) { HiddenField phdnAffiCode = (HiddenField)e.Item.FindControl("hdnAffiCode"); clsEmployeeAffiliation er = new clsEmployeeAffiliation(phdnAffiCode.Value); er.Delete(); BindAffiliationList(); }
/////////////////////////// ///////// Methods ///////// /////////////////////////// private void LoadDetails() { using (clsEmployeeAffiliation ea = new clsEmployeeAffiliation(_strAffiliationCode)) { ea.Fill(); txtOrganization.Text = ea.Organization; txtPosition.Text = ea.Position; txtInclusiveDates.Text = ea.InclusiveDates; txtRemarks.Text = ea.Remarks; } txtOrganization.Focus(); }
protected void btnAdd_Click(object sender, EventArgs e) { clsEmployeeAffiliation ea = new clsEmployeeAffiliation(); ea.Username = Request.Cookies["Speedo"]["UserName"].ToString(); ea.Organization = txtOrganization.Text; ea.Position = txtPosition.Text; ea.InclusiveDates = txtInclusiveDate.Text; ea.Remarks = (txtDetails.Text.Length > 255 ? txtDetails.Text.Substring(0, 255) : txtDetails.Text); ea.Add(); ClearFields(); BindAffiliationList(); }
private void btnSave_Click(object sender, EventArgs e) { if (IsCorrectEntries()) { int intResults = 0; clsEmployeeAffiliation ea = new clsEmployeeAffiliation(); ea.AffiliationCode = _strAffiliationCode; ea.Organization = txtOrganization.Text; ea.Position = txtPosition.Text; ea.InclusiveDates = txtInclusiveDates.Text; ea.Remarks = txtRemarks.Text; intResults = ea.Edit(); if (intResults > 0) { _frmEmployeeDetails.LoadAffiliationList(); this.Close(); } } }
protected void btnSave_Click(object sender, EventArgs e) { foreach (DataGridItem itm in dgAffiliation.Items) { HiddenField phdnAffiCode = (HiddenField)itm.FindControl("hdnAffiCode"); TextBox ptxtOrganization = (TextBox)itm.FindControl("txtOrganization"); TextBox ptxtPosition = (TextBox)itm.FindControl("txtPosition"); TextBox ptxtDetails = (TextBox)itm.FindControl("txtDetails"); TextBox ptxtInclusiveDate = (TextBox)itm.FindControl("txtInclusiveDate"); clsEmployeeAffiliation ea = new clsEmployeeAffiliation(); ea.AffiliationCode = phdnAffiCode.Value; ea.Organization = ptxtOrganization.Text; ea.Position = ptxtInclusiveDate.Text; ea.InclusiveDates = ptxtInclusiveDate.Text; ea.Remarks = (ptxtDetails.Text.Length > 255 ? ptxtDetails.Text.Substring(0, 255) : ptxtDetails.Text); ea.Edit(); } BindAffiliationList(); }