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 gvLocation_RowEditing(object sender, GridViewEditEventArgs e) { unlockControls(); Int32 code = Convert.ToInt32(gvLocation.Rows[e.NewEditIndex].Cells[0].Text); Entities.Location oLocation = LocationBLL.getInstance().getLocation(code); txtCode.Text = oLocation.code.ToString(); cboHeadquarters.SelectedValue = oLocation.oHeadquarters.code.ToString(); txtBuilding.Text = oLocation.building; txtModule.Text = oLocation.module; cboState.SelectedValue = oLocation.State.ToString(); ScriptManager.RegisterStartupScript(this, this.GetType(), "redirect", "$('html, body').animate({ scrollTop: $('body').offset().top });", true); }
protected void btnSaveConfirmed_Click(object sender, EventArgs e) { try { Entities.Location location = new Entities.Location(); location.ID = Convert.ToInt32(hdLocationId.Value); location.Name = txtName.Text.Trim(); location.Address1 = txtAddress1.Text.Trim(); location.Address2 = txtAddress2.Text.Trim(); location.Contact = txtContact.Text.Trim(); location.ContactPerson = txtContactPerson.Text.Trim(); location.RegId1 = txtRegId1.Text.Trim(); location.RegId2 = txtRegId2.Text.Trim(); location.Status = Convert.ToInt32(ddlStatus.SelectedValue); location.CompanyId = CPublic.GetCompanyID(); location.CreatedBy = CPublic.GetuserID(); location.ModifiedBy = CPublic.GetuserID(); OutputMessage result = null; if (location.ID == 0) { result = location.Save(); if (result.Success) { Reset(); ClientScript.RegisterStartupScript(this.GetType(), "message", "successAlert('" + result.Message + "');", true); } else { ClientScript.RegisterStartupScript(this.GetType(), "message", "$('#add-item-portlet').addClass('in');errorAlert('" + result.Message + "')", true); } } else { result = location.Update(); if (result.Success) { Reset(); ClientScript.RegisterStartupScript(this.GetType(), "message", "successAlert('" + result.Message + "');", true); } else { ClientScript.RegisterStartupScript(this.GetType(), "message", "$('#add-item-portlet').addClass('in');errorAlert('" + result.Message + "')", true); } } } catch (Exception ex) { ClientScript.RegisterStartupScript(this.GetType(), "message", "$('#add-item-portlet').addClass('in');errorAlert('" + ex.Message + "')", true); } }
public Person CreatePerson(string name, string email, string bio, Location location, ICollection<CategoryField> categories = null, ICollection<LinkField> links = null) { var person = new Person { Bio = bio, Email = email, Joined = SystemClock.UtcNow, Location = location, Name = name, Slug = name.ToSlug(), }; if (categories != null && categories.Count > 0) { person.AddCategories(categories); } if (links != null && links.Count > 0) { person.AddLinks(links); } return person; }
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"; } } }