protected void btnUpdate2_Click(object sender, EventArgs e) { PayScaleStepItemEntity step = new PayScaleStepItemEntity(); step.StepId = StepLabel.Text; step.StepEntry = Convert.ToDouble(StepEntryTextBox.Text); new PayScaleMapper().UpdateStep(step, Convert.ToInt32(Request.QueryString["ContractTemplateId"].ToString()), Session["jobCode"].ToString(), Session["gradeId"].ToString()); Response.Redirect("PayScale.aspx?ContractTemplateId=" + Request.QueryString["ContractTemplateId"]); }
public List<PayScaleStepItemEntity> ListStepsFromPayScale(int contractTemplateId, string jobCode, string gradeId) { SqlConnection conn = null; SqlCommand cmd = null; try { conn = DALHelper.CreateSqlDbConnection(); cmd = new SqlCommand("usp_ListStepsByContractTemplateIdAndJobCodeAndGradeFromPayScale", conn); cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@ContractTemplateId", contractTemplateId); cmd.Parameters.AddWithValue("@JobCode", jobCode); cmd.Parameters.AddWithValue("@GradeId", gradeId); SqlDataReader rdr = cmd.ExecuteReader(); List<PayScaleStepItemEntity> list = new List<PayScaleStepItemEntity>(); while (rdr.Read()) { PayScaleStepItemEntity view = new PayScaleStepItemEntity(); view.StepId = Convert.ToString(rdr["StepId"]); view.StepEntry = Convert.ToDouble(rdr["StepEntry"]); list.Add(view); } return list; } catch (Exception) { throw; } finally { conn.Close(); cmd.Dispose(); conn.Dispose(); } }
public void UpdateStep(PayScaleStepItemEntity t, int contractTemplateId, string jobCode, string gradeId) { SqlConnection conn = null; SqlCommand cmd = null; try { conn = DALHelper.CreateSqlDbConnection(); cmd = new SqlCommand("usp_UpdatePayScaleStepItem", conn); cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@ContractTemplateId", contractTemplateId); cmd.Parameters.AddWithValue("@JobCode", jobCode); cmd.Parameters.AddWithValue("@GradeId", gradeId); cmd.Parameters.AddWithValue("@StepId", t.StepId); cmd.Parameters.AddWithValue("@StepEntry", t.StepEntry); cmd.ExecuteNonQuery(); } catch (Exception) { throw; } finally { conn.Close(); cmd.Dispose(); conn.Dispose(); } }