private void updateCustom_Click(object sender, EventArgs e) { ConditionUpdateSdi conditionUpdateSdi = new ConditionUpdateSdi(); conditionUpdateSdi.Grade = gradeTextBox.Text; conditionUpdateSdi.Percent = Convert.ToInt32(percentTextBox.Text); Condition condition = conditionService.updateCondition(conditionUpdateSdi); if (condition != null) { this.Close(); conditionForm.updateDataToTable(condition); } }
public Condition updateCondition(ConditionUpdateSdi conditionUpdateSdi) { con = SqlServerConnection.getConnnection(); con.Open(); StringBuilder sql = new StringBuilder(); sql.Append(" update Condition set " + " cost_percentage = @percent "); sql.Append(" where grade = @grade"); SqlCommand command = new SqlCommand(sql.ToString(), con); command.Parameters.AddWithValue("percent", conditionUpdateSdi.Percent); command.Parameters.AddWithValue("grade", conditionUpdateSdi.Grade); command.ExecuteNonQuery(); con.Close(); return(this.getConditionByGrade(conditionUpdateSdi.Grade)); }
public Condition updateCondition(ConditionUpdateSdi conditionUpdateSdi) { return(conditionRepoService.updateCondition(conditionUpdateSdi)); }