private void UpdateRecord() { dbo_DimEmployeeClass oclsdbo_DimEmployee = new dbo_DimEmployeeClass(); dbo_DimEmployeeClass clsdbo_DimEmployee = new dbo_DimEmployeeClass(); oclsdbo_DimEmployee.EmployeeKey = System.Convert.ToInt32(Session["EmployeeKey"]); oclsdbo_DimEmployee = dbo_DimEmployeeDataClass.Select_Record(oclsdbo_DimEmployee); if (VerifyData() == true) { SetData(clsdbo_DimEmployee); bool bSucess = false; bSucess = dbo_DimEmployeeDataClass.Update(oclsdbo_DimEmployee, clsdbo_DimEmployee); if (bSucess == true) { pnlForm.Visible = false; pnlSave.Visible = false; pnlGrid.Visible = true; lblMode.InnerText = ""; Session.Remove("dvdbo_DimEmployee"); LoadGriddbo_DimEmployee(); } else { ec.ShowMessage(" Update failed. ", " Dbo. Dim Employee "); } } }
private void InsertRecord() { dbo_DimEmployeeClass clsdbo_DimEmployee = new dbo_DimEmployeeClass(); if (VerifyData() == true) { SetData(clsdbo_DimEmployee); bool bSucess = false; bSucess = dbo_DimEmployeeDataClass.Add(clsdbo_DimEmployee); if (bSucess == true) { pnlForm.Visible = false; pnlSave.Visible = false; pnlGrid.Visible = true; lblMode.InnerText = ""; Session.Remove("dvdbo_DimEmployee"); LoadGriddbo_DimEmployee(); } else { ec.ShowMessage(" Insert failed. ", " Dbo. Dim Employee "); } } }
private void SetData(dbo_DimEmployeeClass clsdbo_DimEmployee) { if (string.IsNullOrEmpty(txtParentEmployeeKey.SelectedValue)) { clsdbo_DimEmployee.ParentEmployeeKey = null; } else { clsdbo_DimEmployee.ParentEmployeeKey = System.Convert.ToInt32(txtParentEmployeeKey.SelectedValue); } if (string.IsNullOrEmpty(txtEmployeeNationalIDAlternateKey.Text)) { clsdbo_DimEmployee.EmployeeNationalIDAlternateKey = null; } else { clsdbo_DimEmployee.EmployeeNationalIDAlternateKey = txtEmployeeNationalIDAlternateKey.Text; } if (string.IsNullOrEmpty(txtParentEmployeeNationalIDAlternateKey.Text)) { clsdbo_DimEmployee.ParentEmployeeNationalIDAlternateKey = null; } else { clsdbo_DimEmployee.ParentEmployeeNationalIDAlternateKey = txtParentEmployeeNationalIDAlternateKey.Text; } if (string.IsNullOrEmpty(txtSalesTerritoryKey.SelectedValue)) { clsdbo_DimEmployee.SalesTerritoryKey = null; } else { clsdbo_DimEmployee.SalesTerritoryKey = System.Convert.ToInt32(txtSalesTerritoryKey.SelectedValue); } clsdbo_DimEmployee.FirstName = System.Convert.ToString(txtFirstName.Text); clsdbo_DimEmployee.LastName = System.Convert.ToString(txtLastName.Text); if (string.IsNullOrEmpty(txtMiddleName.Text)) { clsdbo_DimEmployee.MiddleName = null; } else { clsdbo_DimEmployee.MiddleName = txtMiddleName.Text; } clsdbo_DimEmployee.NameStyle = System.Convert.ToBoolean(txtNameStyle.Checked ? true : false); if (string.IsNullOrEmpty(txtTitle.Text)) { clsdbo_DimEmployee.Title = null; } else { clsdbo_DimEmployee.Title = txtTitle.Text; } if (string.IsNullOrEmpty(txtHireDate.Text)) { clsdbo_DimEmployee.HireDate = null; } else { clsdbo_DimEmployee.HireDate = System.Convert.ToDateTime(txtHireDate.Text); } if (string.IsNullOrEmpty(txtBirthDate.Text)) { clsdbo_DimEmployee.BirthDate = null; } else { clsdbo_DimEmployee.BirthDate = System.Convert.ToDateTime(txtBirthDate.Text); } if (string.IsNullOrEmpty(txtLoginID.Text)) { clsdbo_DimEmployee.LoginID = null; } else { clsdbo_DimEmployee.LoginID = txtLoginID.Text; } if (string.IsNullOrEmpty(txtEmailAddress.Text)) { clsdbo_DimEmployee.EmailAddress = null; } else { clsdbo_DimEmployee.EmailAddress = txtEmailAddress.Text; } if (string.IsNullOrEmpty(txtPhone.Text)) { clsdbo_DimEmployee.Phone = null; } else { clsdbo_DimEmployee.Phone = txtPhone.Text; } if (string.IsNullOrEmpty(txtMaritalStatus.Text)) { clsdbo_DimEmployee.MaritalStatus = null; } else { clsdbo_DimEmployee.MaritalStatus = txtMaritalStatus.Text; } if (string.IsNullOrEmpty(txtEmergencyContactName.Text)) { clsdbo_DimEmployee.EmergencyContactName = null; } else { clsdbo_DimEmployee.EmergencyContactName = txtEmergencyContactName.Text; } if (string.IsNullOrEmpty(txtEmergencyContactPhone.Text)) { clsdbo_DimEmployee.EmergencyContactPhone = null; } else { clsdbo_DimEmployee.EmergencyContactPhone = txtEmergencyContactPhone.Text; } clsdbo_DimEmployee.SalariedFlag = txtSalariedFlag.Checked ? true : false; if (string.IsNullOrEmpty(txtGender.Text)) { clsdbo_DimEmployee.Gender = null; } else { clsdbo_DimEmployee.Gender = txtGender.Text; } if (string.IsNullOrEmpty(txtPayFrequency.Text)) { clsdbo_DimEmployee.PayFrequency = null; } else { clsdbo_DimEmployee.PayFrequency = System.Convert.ToByte(txtPayFrequency.Text); } if (string.IsNullOrEmpty(txtBaseRate.Text)) { clsdbo_DimEmployee.BaseRate = null; } else { clsdbo_DimEmployee.BaseRate = System.Convert.ToDecimal(txtBaseRate.Text); } if (string.IsNullOrEmpty(txtVacationHours.Text)) { clsdbo_DimEmployee.VacationHours = null; } else { clsdbo_DimEmployee.VacationHours = System.Convert.ToInt16(txtVacationHours.Text); } if (string.IsNullOrEmpty(txtSickLeaveHours.Text)) { clsdbo_DimEmployee.SickLeaveHours = null; } else { clsdbo_DimEmployee.SickLeaveHours = System.Convert.ToInt16(txtSickLeaveHours.Text); } clsdbo_DimEmployee.CurrentFlag = System.Convert.ToBoolean(txtCurrentFlag.Checked ? true : false); clsdbo_DimEmployee.SalesPersonFlag = System.Convert.ToBoolean(txtSalesPersonFlag.Checked ? true : false); if (string.IsNullOrEmpty(txtDepartmentName.Text)) { clsdbo_DimEmployee.DepartmentName = null; } else { clsdbo_DimEmployee.DepartmentName = txtDepartmentName.Text; } if (string.IsNullOrEmpty(txtStartDate.Text)) { clsdbo_DimEmployee.StartDate = null; } else { clsdbo_DimEmployee.StartDate = System.Convert.ToDateTime(txtStartDate.Text); } if (string.IsNullOrEmpty(txtEndDate.Text)) { clsdbo_DimEmployee.EndDate = null; } else { clsdbo_DimEmployee.EndDate = System.Convert.ToDateTime(txtEndDate.Text); } if (string.IsNullOrEmpty(txtStatus.Text)) { clsdbo_DimEmployee.Status = null; } else { clsdbo_DimEmployee.Status = txtStatus.Text; } }
private void GetData() { ClearRecord(); dbo_DimEmployeeClass clsdbo_DimEmployee = new dbo_DimEmployeeClass(); clsdbo_DimEmployee.EmployeeKey = System.Convert.ToInt32(Session["EmployeeKey"]); clsdbo_DimEmployee = dbo_DimEmployeeDataClass.Select_Record(clsdbo_DimEmployee); if ((clsdbo_DimEmployee != null)) { try { txtEmployeeKey.Text = System.Convert.ToString(clsdbo_DimEmployee.EmployeeKey); if (clsdbo_DimEmployee.ParentEmployeeKey == null) { txtParentEmployeeKey.SelectedValue = default(string); } else { txtParentEmployeeKey.SelectedValue = System.Convert.ToString(clsdbo_DimEmployee.ParentEmployeeKey); } if (clsdbo_DimEmployee.EmployeeNationalIDAlternateKey == null) { txtEmployeeNationalIDAlternateKey.Text = default(string); } else { txtEmployeeNationalIDAlternateKey.Text = System.Convert.ToString(clsdbo_DimEmployee.EmployeeNationalIDAlternateKey); } if (clsdbo_DimEmployee.ParentEmployeeNationalIDAlternateKey == null) { txtParentEmployeeNationalIDAlternateKey.Text = default(string); } else { txtParentEmployeeNationalIDAlternateKey.Text = System.Convert.ToString(clsdbo_DimEmployee.ParentEmployeeNationalIDAlternateKey); } if (clsdbo_DimEmployee.SalesTerritoryKey == null) { txtSalesTerritoryKey.SelectedValue = default(string); } else { txtSalesTerritoryKey.SelectedValue = System.Convert.ToString(clsdbo_DimEmployee.SalesTerritoryKey); } txtFirstName.Text = System.Convert.ToString(clsdbo_DimEmployee.FirstName); txtLastName.Text = System.Convert.ToString(clsdbo_DimEmployee.LastName); if (clsdbo_DimEmployee.MiddleName == null) { txtMiddleName.Text = default(string); } else { txtMiddleName.Text = System.Convert.ToString(clsdbo_DimEmployee.MiddleName); } txtNameStyle.Checked = System.Convert.ToBoolean(clsdbo_DimEmployee.NameStyle); if (clsdbo_DimEmployee.Title == null) { txtTitle.Text = default(string); } else { txtTitle.Text = System.Convert.ToString(clsdbo_DimEmployee.Title); } if (clsdbo_DimEmployee.HireDate == null) { txtHireDate.Text = DateTime.Now.ToString(); } else { txtHireDate.Text = System.Convert.ToDateTime(clsdbo_DimEmployee.HireDate).ToShortDateString(); } if (clsdbo_DimEmployee.BirthDate == null) { txtBirthDate.Text = DateTime.Now.ToString(); } else { txtBirthDate.Text = System.Convert.ToDateTime(clsdbo_DimEmployee.BirthDate).ToShortDateString(); } if (clsdbo_DimEmployee.LoginID == null) { txtLoginID.Text = default(string); } else { txtLoginID.Text = System.Convert.ToString(clsdbo_DimEmployee.LoginID); } if (clsdbo_DimEmployee.EmailAddress == null) { txtEmailAddress.Text = default(string); } else { txtEmailAddress.Text = System.Convert.ToString(clsdbo_DimEmployee.EmailAddress); } if (clsdbo_DimEmployee.Phone == null) { txtPhone.Text = default(string); } else { txtPhone.Text = System.Convert.ToString(clsdbo_DimEmployee.Phone); } if (clsdbo_DimEmployee.MaritalStatus == null) { txtMaritalStatus.Text = default(string); } else { txtMaritalStatus.Text = System.Convert.ToString(clsdbo_DimEmployee.MaritalStatus); } if (clsdbo_DimEmployee.EmergencyContactName == null) { txtEmergencyContactName.Text = default(string); } else { txtEmergencyContactName.Text = System.Convert.ToString(clsdbo_DimEmployee.EmergencyContactName); } if (clsdbo_DimEmployee.EmergencyContactPhone == null) { txtEmergencyContactPhone.Text = default(string); } else { txtEmergencyContactPhone.Text = System.Convert.ToString(clsdbo_DimEmployee.EmergencyContactPhone); } //if (clsdbo_DimEmployee.SalariedFlag == null) { txtSalariedFlag.Checked = default(string); } else { txtSalariedFlag.Checked = System.Convert.ToBoolean(clsdbo_DimEmployee.SalariedFlag); } if (clsdbo_DimEmployee.Gender == null) { txtGender.Text = default(string); } else { txtGender.Text = System.Convert.ToString(clsdbo_DimEmployee.Gender); } if (clsdbo_DimEmployee.PayFrequency == null) { txtPayFrequency.Text = default(string); } else { txtPayFrequency.Text = System.Convert.ToString(clsdbo_DimEmployee.PayFrequency); } if (clsdbo_DimEmployee.BaseRate == null) { txtBaseRate.Text = default(string); } else { txtBaseRate.Text = System.Convert.ToString(clsdbo_DimEmployee.BaseRate); } if (clsdbo_DimEmployee.VacationHours == null) { txtVacationHours.Text = default(string); } else { txtVacationHours.Text = System.Convert.ToString(clsdbo_DimEmployee.VacationHours); } if (clsdbo_DimEmployee.SickLeaveHours == null) { txtSickLeaveHours.Text = default(string); } else { txtSickLeaveHours.Text = System.Convert.ToString(clsdbo_DimEmployee.SickLeaveHours); } txtCurrentFlag.Checked = System.Convert.ToBoolean(clsdbo_DimEmployee.CurrentFlag); txtSalesPersonFlag.Checked = System.Convert.ToBoolean(clsdbo_DimEmployee.SalesPersonFlag); if (clsdbo_DimEmployee.DepartmentName == null) { txtDepartmentName.Text = default(string); } else { txtDepartmentName.Text = System.Convert.ToString(clsdbo_DimEmployee.DepartmentName); } if (clsdbo_DimEmployee.StartDate == null) { txtStartDate.Text = DateTime.Now.ToString(); } else { txtStartDate.Text = System.Convert.ToDateTime(clsdbo_DimEmployee.StartDate).ToShortDateString(); } if (clsdbo_DimEmployee.EndDate == null) { txtEndDate.Text = DateTime.Now.ToString(); } else { txtEndDate.Text = System.Convert.ToDateTime(clsdbo_DimEmployee.EndDate).ToShortDateString(); } if (clsdbo_DimEmployee.Status == null) { txtStatus.Text = default(string); } else { txtStatus.Text = System.Convert.ToString(clsdbo_DimEmployee.Status); } } catch (Exception ex) { ec.ShowMessage(ex.Message, " Dbo. Dim Employee "); } } }