protected void btnupd_Click(object sender, EventArgs e) { Label6.Text = ""; if (validateinput()) { try { tblJob_Title upd = db.tblJob_Titles.Single(x => x.Job_id == Convert.ToInt32(dropjop.SelectedValue)); upd.Job_name = txtname.Text; upd.Nakfa_per_hr = Convert.ToDecimal(txthour.Text); upd.Remark = txtremark.Text; Response.Write("<script>alert ('Record Updated Successfully');</script>"); db.SubmitChanges(); clear(); } catch (Exception ex) { Response.Write("<script>alert ('Please try again ');</script>"); } } else { return; } }
protected void btnadd_Click(object sender, EventArgs e) { Label6.Text = ""; if (validateinput()) { tblJob_Title newjob = new tblJob_Title(); newjob.Job_name = txtname.Text; newjob.Nakfa_per_hr = Convert.ToDecimal(txthour.Text); newjob.Remark = txtremark.Text; try { db.tblJob_Titles.InsertOnSubmit(newjob); db.SubmitChanges(); Response.Write("<script>alert ('Record Added Successfully');</script>"); clear(); } catch (Exception ex) { Response.Write("<script>alert ('Please try again ');</script>"); } } else { return; } }
protected void dropjop_SelectedIndexChanged(object sender, EventArgs e) { tblJob_Title upd = db.tblJob_Titles.Single(x => x.Job_id == Convert.ToInt32(dropjop.SelectedValue)); txtname.Text = upd.Job_name; txthour.Text = upd.Nakfa_per_hr.ToString(); txtremark.Text = upd.Remark; }
partial void DeletetblJob_Title(tblJob_Title instance);
partial void UpdatetblJob_Title(tblJob_Title instance);
partial void InserttblJob_Title(tblJob_Title instance);