protected void btnSave_Click(object sender, ImageClickEventArgs e) { Int32 records = 0; if (validateData()) { Entities.PeriodType oPeriodType = new Entities.PeriodType(); oPeriodType.code = Convert.ToInt32(txtCode.Text); oPeriodType.description = txtName.Text; oPeriodType.state = Convert.ToInt16(cboState.SelectedValue); if (PeriodTypeBLL.getInstance().exists(oPeriodType.code)) { records = PeriodTypeBLL.getInstance().modify(oPeriodType); } else { records = PeriodTypeBLL.getInstance().insert(oPeriodType); } blockControls(); loadData(); if (records > 0) { lblMessage.Text = "Datos almacenados correactamente"; } } }
/// <summary> /// Creates a new instance of a PeriodType. /// </summary> /// <returns>The new PeriodType instance. </returns> public static Entities.PeriodType Factory() { OnCreating(); Entities.PeriodType periodType = new Entities.PeriodType(); OnCreated(periodType); return(periodType); }
protected void gvPeriodType_RowEditing(object sender, GridViewEditEventArgs e) { unlockControls(); Int32 code = Convert.ToInt32(gvPeriodType.Rows[e.NewEditIndex].Cells[0].Text); Entities.PeriodType oPeriodType = PeriodTypeBLL.getInstance().getPeriod(code); txtCode.Text = oPeriodType.code.ToString(); txtName.Text = oPeriodType.description.ToString(); try { cboState.SelectedValue = oPeriodType.state.ToString(); } catch (Exception) { cboState.SelectedValue = "1"; } 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.Period oPeriod = new Entities.Period(); Entities.PeriodType oPeriodType = new Entities.PeriodType(); oPeriod.code = Convert.ToInt32(txtCode.Text); oPeriod.name = txtDescription.Text; oPeriod.startDate = DateTime.Parse(txtStartDate.Text); oPeriod.finalDate = DateTime.Parse(txtFinishDate.Text); oPeriod.state = Convert.ToInt16(cboState.SelectedValue); oPeriodType.code = Convert.ToInt32(cboModality.SelectedValue); oPeriod.oPeriodType = oPeriodType; if (PeriodBLL.getInstance().exists(oPeriod.code)) { records = PeriodBLL.getInstance().modify(oPeriod); } else { records = PeriodBLL.getInstance().insert(oPeriod); } blockControls(); loadData(); if (records > 0) { lblMessage.Text = "Datos almacenados correactamente"; } } else { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "comboBox", "comboBox();", true); } }
// This partial method gives us a way to access an object after it has been added to the system. static partial void OnCreated(Entities.PeriodType periodType);