public void UpdateEmployee() { string strSQL = ""; clsGeneral General = new clsGeneral(); int intEmployeeID = Convert.ToInt32(Request.Params["EmployeeId"]); strSQL = "UPDATE tblEmployees "; strSQL += "SET UserName = '******' "; strSQL += "WHERE intEmployeeID = " + intEmployeeID; General.UpdateRecord(strSQL); lblError.Text = "Employee Updated!"; lblError.Visible = true; }
private void UpdateEmployee(int intEmployeeID) { clsGeneral General = new clsGeneral(); int intActive = 0; int pmFiscalSummaryInt = 0; int picFiscalSummaryInt = 0; if (rbtnActiveEmployeeYes.Checked == true) { intActive = 1; } else { intActive = 0; } if (pmFiscalSummary.Checked) { pmFiscalSummaryInt = 1; } if (picFiscalSummary.Checked) { picFiscalSummaryInt = 1; } strSQL = "UPDATE tblEmployees "; strSQL += "SET "; strSQL += "EmployeeCode = '" + txtEmployeeCode.Text.GetValueOrDefault<string>() + "', "; strSQL += "EmployeeFirst = '" + txtFirstName.Text.GetValueOrDefault<string>() + "', "; strSQL += "EmployeeLast = '" + txtLastName.Text.GetValueOrDefault<string>() + "', "; strSQL += "EmployeeName = '" + txtLastName.Text.GetValueOrDefault<string>() + ", " + txtFirstName.Text + "', "; strSQL += "EmployeeTypeID = " + cboEmployeeType.SelectedValue + ", "; strSQL += "Address = '" + txtAddress.Text + "', "; strSQL += "City = '" + txtCity.Text + "', "; strSQL += "State = '" + txtState.Text + "', "; strSQL += "Zip = '" + txtZip.Text + "', "; strSQL += "HomePhone = '" + txtHomePhone.Text + "', "; strSQL += "CellPhone = '" + txtCellPhone.Text + "', "; strSQL += "PhoneExtension = '" + txtPhoneExtension.Text + "', "; strSQL += "EmailAddress = '" + txtEmail.Text + "', "; strSQL += "Title = '" + txtTitle.Text + "', "; if (string.IsNullOrEmpty(txtEmployeeStartDate.Text)) { strSQL += "EmploymentStartDate = NULL, "; } else { strSQL += "EmploymentStartDate = '" + txtEmployeeStartDate.Text + "', "; } if (string.IsNullOrEmpty(txtEmployeeEndDate.Text)) { strSQL += "EmploymentEndDate = NULL, "; } else { strSQL += "EmploymentEndDate = '" + txtEmployeeEndDate.Text + "', "; } strSQL += "YearsOfExperience = '" + txtYearsOfExperience.Text + "', "; strSQL += "Education = '" + txtEducation.Text + "', "; strSQL += "Licenses = '" + txtLicenses.Text + "', "; strSQL += "ProfessionalMemberships = '" + txtProfMemberships.Text + "', "; strSQL += "ProfessionalCommittees = '" + txtProfCommittees.Text + "', "; strSQL += "HoursPerWeek = " + txtHoursPerWeek.Text + ", "; strSQL += "Comments = '" + txtComments.Text + "', "; strSQL += "Active = " + intActive + ", "; strSQL += "PMFiscalSummary = " + pmFiscalSummaryInt + ", "; strSQL += "PICFiscalSummary = " + picFiscalSummaryInt + " "; strSQL += "WHERE EmployeeID = " + intEmployeeID; General.UpdateRecord(strSQL); }
private void AddUpdateUser(int intEmployeeID) { clsGeneral General = new clsGeneral(); bool blnUserExists = false; //Check to see if User Account Exists strSQL = "SELECT ID "; strSQL += "FROM tblUsers "; strSQL += "WHERE EmployeeID = " + intEmployeeID; DataSet ds = General.FillDataset(strSQL); DataTable dt = ds.Tables[0]; if (dt.Rows.Count > 0) { blnUserExists = true; } else { blnUserExists = false; } ds.Dispose(); ds = null; dt.Dispose(); dt = null; if (blnUserExists == true) { strSQL = "UPDATE tblUsers "; strSQL += "SET "; strSQL += "UserName = '******', "; strSQL += "Password = '******' "; strSQL += "WHERE EmployeeID = " + intEmployeeID; General.UpdateRecord(strSQL); } else { strSQL = "INSERT INTO tblUsers "; strSQL += "(UserName, Password, UserLevel, EmployeeID) "; strSQL += "VALUES ( "; strSQL += "'" + txtUserName.Text + "', "; strSQL += "'" + txtPassword.Text + "', "; strSQL += "'User', "; strSQL += intEmployeeID + ")"; General.AddRecord(strSQL); } }
private void UpdateClient(int intClientID) { clsGeneral General = new clsGeneral(); string strSQL = ""; strSQL = "UPDATE tblClients "; strSQL += "SET ClientName = '" + txtClientName.Text + "', "; strSQL += "ClientTypeID = " + cboClientType.SelectedValue + ", "; strSQL += "Address = '" + txtAddress.Text + "', "; strSQL += "City = '" + txtCity.Text + "', "; strSQL += "State = '" + txtState.Text + "', "; strSQL += "Zip = '" + txtZip.Text + "', "; strSQL += "OfficePhone = '" + txtOfficePhone.Text + "', "; strSQL += "Fax = '" + txtFax.Text + "', "; strSQL += "Comments = '" + txtComments.Text + "' "; strSQL += "WHERE ID = " + intClientID; General.UpdateRecord(strSQL); }