protected void Save_or_update_guard_salary_scale() { for (int i = 0; i < this.gdv_guard_salaries.Rows.Count; i++) { if (Convert.ToBoolean(this.gdv_guard_salaries.Rows[i].Cells[0].Value)) { int previous_scale_id = 0; int guard_auto_id = Convert.ToInt32(this.gdv_guard_salaries.Rows[i].Cells[1].Value.ToString()); string guard_number = this.gdv_guard_salaries.Rows[i].Cells[3].Value.ToString(); if (this.gdv_guard_salaries.Rows[i].Cells[7].Value.ToString() == string.Empty) { previous_scale_id = Convert.ToInt32(this.txt_auto_id.Text); } else { previous_scale_id = Convert.ToInt32(this.gdv_guard_salaries.Rows[i].Cells[7].Value.ToString()); } int scale_id = Convert.ToInt32(this.txt_auto_id.Text); Salary_scales.Salary_scale_manual_assigment_query("salary_scale_manual_assigment_query", guard_auto_id, guard_number, scale_id, SystemConst._username, previous_scale_id); } } MessageBox.Show("All selected guards salary scales succesfully updated", "save scales", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); }
//function below does assign salary scale to selected guards protected void Save_or_update_guard_salary_scale() { for (int i = 0; i < gdv_guard_salaries.Rows.Count; i++) { if ((Convert.ToBoolean(gdv_guard_salaries.Rows[i].Cells[0].Value)) == true) { int guard_auto_id = Convert.ToInt32(gdv_guard_salaries.Rows[i].Cells[1].Value.ToString()); //guard auto id string guard_number = gdv_guard_salaries.Rows[i].Cells[3].Value.ToString(); //guard number int previous_scale_id = Convert.ToInt32(gdv_guard_salaries.Rows[i].Cells[7].Value.ToString()); int scale_id = Convert.ToInt32(txt_auto_id.Text); //call function to assign scale from app code Salary_scales.Salary_scale_manual_assigment_query("salary_scale_manual_assigment_query", guard_auto_id, guard_number, scale_id, SystemConst._username, previous_scale_id); } } //display success message after all tasks executed succesfully MessageBox.Show("All selected guards salary scales succesfully updated", "save scales", MessageBoxButtons.OK, MessageBoxIcon.Information); }