protected void btnSave_Click(object sender, EventArgs e) { foreach (DataGridItem itm in dgHistory.Items) { HiddenField phdnEmhsCode = (HiddenField)itm.FindControl("hdnEmhsCode"); HiddenField phdnEsttCode = (HiddenField)itm.FindControl("hdnEsttCode"); TextBox ptxtPosition = (TextBox)itm.FindControl("txtPosition"); TextBox ptxtResponsibility = (TextBox)itm.FindControl("txtResponsibility"); TextBox ptxtInclusiveDates = (TextBox)itm.FindControl("txtInclusiveDates"); TextBox ptxtCompany = (TextBox)itm.FindControl("txtCompany"); TextBox ptxtContact = (TextBox)itm.FindControl("txtContact"); TextBox ptxtAddress = (TextBox)itm.FindControl("txtAddress"); DropDownList pddlStatus = (DropDownList)itm.FindControl("ddlStatus"); ptxtAddress.MaxLength = 100; clsEmployeeEmploymentHistory eh = new clsEmployeeEmploymentHistory(); eh.EmploymentHistoryCode = phdnEmhsCode.Value; eh.Position = ptxtPosition.Text; eh.Responsibility = ptxtResponsibility.Text; eh.InclusiveDates = ptxtInclusiveDates.Text; eh.CompanyName = ptxtCompany.Text; eh.CompanyContactNumber = (ptxtContact.Text.Length > 50 ? ptxtContact.Text.Substring(0, 50) : ptxtContact.Text); eh.CompanyAddress = ptxtAddress.Text; eh.EmploymentStatusCode = pddlStatus.SelectedValue; eh.Edit(); } BindHistoryList(); }
private void btnSave_Click(object sender, EventArgs e) { if (IsCorrectEntries()) { int intResults = 0; using (clsEmployeeEmploymentHistory eeh = new clsEmployeeEmploymentHistory()) { eeh.Username = _strUsername; eeh.InclusiveDates = txtInclusiveDates.Text; eeh.Position = txtPosition.Text; eeh.Responsibility = txtResponsibility.Text; eeh.EmploymentStatusCode = cmbEmploymentStatus.SelectedValue.ToString(); eeh.CompanyName = txtCompanyName.Text; eeh.CompanyAddress = txtCompanyAddress.Text; eeh.CompanyContactNumber = txtContactNumber.Text; intResults = eeh.Add(); } if (intResults > 0) { _frmEmployeeDetails.BindEmploymentHistoryList(); if (MessageBox.Show(clsMessageBox.MessageBoxSuccessAddAskNew, clsMessageBox.MessageBoxText, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { ClearFields(); } else { this.Close(); } } } }
protected void dgHistory_DeleteCommand(object source, DataGridCommandEventArgs e) { HiddenField phdnEmhsCode = (HiddenField)e.Item.FindControl("hdnEmhsCode"); clsEmployeeEmploymentHistory eh = new clsEmployeeEmploymentHistory(phdnEmhsCode.Value); eh.Delete(); BindHistoryList(); }
protected void btnAdd_Click(object sender, EventArgs e) { clsEmployeeEmploymentHistory eh = new clsEmployeeEmploymentHistory(); eh.Username = Request.Cookies["Speedo"]["UserName"].ToString(); eh.Position = txtPosition.Text; eh.Responsibility = txtResponsibility.Text; eh.InclusiveDates = txtInclusiveDates.Text; eh.CompanyName = txtCompanyName.Text; eh.CompanyContactNumber = (txtCompanyContact.Text.Length > 50 ? txtCompanyContact.Text.Substring(0, 50) : txtCompanyContact.Text); eh.CompanyAddress = txtCompanyAddress.Text; eh.EmploymentStatusCode = ddlStatus.SelectedValue; eh.Add(); ClearFields(); BindHistoryList(); }
private void LoadDetails() { cmbEmploymentStatus.DataSource = clsEmploymentStatus.DSLEmploymentStatus(); cmbEmploymentStatus.ValueMember = "pvalue"; cmbEmploymentStatus.DisplayMember = "ptext"; using (clsEmployeeEmploymentHistory eeh = new clsEmployeeEmploymentHistory(_strEmploymentHistoryCode)) { eeh.Fill(); txtInclusiveDates.Text = eeh.InclusiveDates; txtPosition.Text = eeh.Position; txtResponsibility.Text = eeh.Responsibility; cmbEmploymentStatus.SelectedValue = eeh.EmploymentStatusCode; txtCompanyName.Text = eeh.CompanyName; txtCompanyAddress.Text = eeh.CompanyAddress; txtContactNumber.Text = eeh.CompanyContactNumber; } }
private void btnSave_Click(object sender, EventArgs e) { if (IsCorrectEntries()) { clsEmployeeEmploymentHistory eeh = new clsEmployeeEmploymentHistory(_strEmploymentHistoryCode); eeh.InclusiveDates = txtInclusiveDates.Text; eeh.Position = txtPosition.Text; eeh.Responsibility = txtResponsibility.Text; eeh.EmploymentStatusCode = cmbEmploymentStatus.SelectedValue.ToString(); eeh.CompanyName = txtCompanyName.Text; eeh.CompanyAddress = txtCompanyAddress.Text; eeh.CompanyContactNumber = txtContactNumber.Text; if (eeh.Edit() > 0) { _frmEmployeeDetails.BindEmploymentHistoryList(); this.Close(); } } }