protected void btnSave_Click(object sender, ImageClickEventArgs e) { Int32 records = 0; if (validateData()) { Entities.Location oLocation = new Entities.Location(); Entities.Headquarters oHeadquarters = new Entities.Headquarters(); oLocation.code = Convert.ToInt32(txtCode.Text); oHeadquarters.code = Convert.ToInt32(cboHeadquarters.SelectedValue); oLocation.oHeadquarters = oHeadquarters; oLocation.building = txtBuilding.Text; oLocation.module = txtModule.Text; oLocation.State = Convert.ToInt16(cboState.SelectedValue); if (LocationBLL.getInstance().exists(oLocation.code)) { records = LocationBLL.getInstance().modify(oLocation); } else { records = LocationBLL.getInstance().insert(oLocation); } blockControls(); loadData(); if (records > 0) { lblMessage.Text = "Datos almacenados correctamente"; } } }
protected void gvHeadquarters_RowEditing(object sender, GridViewEditEventArgs e) { unlockControls(); Int32 code = Convert.ToInt32(gvHeadquarters.Rows[e.NewEditIndex].Cells[0].Text); Entities.Headquarters oHeadquarters = HeadquartersBLL.getInstance().getHeadquarters(code); txtCode.Text = oHeadquarters.code.ToString(); txtDescription.Text = oHeadquarters.description; cboState.SelectedValue = oHeadquarters.state.ToString(); ScriptManager.RegisterStartupScript(this, this.GetType(), "redirect", "$('html, body').animate({ scrollTop: $('body').offset().top });", true); }