protected void btnSave_Click(object sender, ImageClickEventArgs e) { Int32 records = 0; if (validateData()) { Entities.ClassRoomsType oClassRoomsType = new Entities.ClassRoomsType(); oClassRoomsType.code = Convert.ToInt32(txtCode.Text); oClassRoomsType.description = txtDescription.Text; oClassRoomsType.state = Convert.ToInt16(cboState.SelectedValue); if (ClassRoomsTypeBLL.getInstance().exists(oClassRoomsType.code)) { records = ClassRoomsTypeBLL.getInstance().modify(oClassRoomsType); } else { records = ClassRoomsTypeBLL.getInstance().insert(oClassRoomsType); } blockControls(); loadData(); if (records > 0) { lblMessage.Text = "Datos almacenados correctamente"; } } }
protected void gvClassRoomType_RowEditing(object sender, GridViewEditEventArgs e) { unlockControls(); Int32 code = Convert.ToInt32(gvClassRoomType.Rows[e.NewEditIndex].Cells[0].Text); Entities.ClassRoomsType oClassRoomsType = ClassRoomsTypeBLL.getInstance().getClassRoomsType(code); txtCode.Text = oClassRoomsType.code.ToString(); txtDescription.Text = oClassRoomsType.description; cboState.SelectedValue = oClassRoomsType.state.ToString(); ScriptManager.RegisterStartupScript(this, this.GetType(), "redirect", "$('html, body').animate({ scrollTop: $('body').offset().top });", true); }
protected void btnSave_Click(object sender, ImageClickEventArgs e) { Int32 records = 0; if (validateData()) { Entities.ClassRoom oClassRoom = new Entities.ClassRoom(); Entities.ClassRoomsType oClassRoomsType = new Entities.ClassRoomsType(); Entities.Location oLocation = new Entities.Location(); Entities.Program oProgram = new Entities.Program(); oClassRoom.code = Convert.ToInt32(txtCode.Text); oClassRoom.num_room = txtDescription.Text; oClassRoomsType.code = Convert.ToInt32(cboClassRoomType.SelectedValue); oLocation.code = Convert.ToInt32(cboLocation.SelectedValue); oClassRoom.size = Convert.ToInt32(txtSize.Text); oProgram.code = Convert.ToInt32(cboprogram.SelectedValue); oClassRoom.state = Convert.ToInt16(cboState.SelectedValue); oClassRoom.oClassRoomsType = oClassRoomsType; oClassRoom.oLocation = oLocation; oClassRoom.oProgram = oProgram; if (ClassRoomBLL.getInstance().exists(oClassRoom.code)) { records = ClassRoomBLL.getInstance().modify(oClassRoom); } else { records = ClassRoomBLL.getInstance().insert(oClassRoom); } blockControls(); loadData(); if (records > 0) { lblMessage.Text = "Datos almacenados correctamente"; } } }