/// <summary> /// Load Data from boxes to the model object /// </summary> /// <returns>BioReg object</returns> private BioReg LoadDataFromBoxes() { BioReg aBioReg = new BioReg(); aBioReg.bioRegID = Convert.ToInt64(txtBioRegID.Text); aBioReg.bioRegTypeID = Convert.ToInt64(txtBioRegTypeID.Text); aBioReg.bioRegDate = Convert.ToDateTime(dtpBioRegDate.Value); try { aBioReg.value = Convert.ToDouble(txtValue.Text); } catch { aBioReg.value = 0; } aBioReg.memo = Convert.ToString(txtMemo.Text); aBioReg.userID = Convert.ToInt64(txtUserID.Text); return aBioReg; }
/// <summary> /// Load data from the grid to the object model /// </summary> /// <returns>BioReg Object</returns> private BioReg LoadDataFromGrid() { BioReg aBioReg = new BioReg(); aBioReg.bioRegID = Convert.ToInt64(dgvBioRegs["BioRegID", dgvBioRegs.CurrentRow.Index].Value); aBioReg.bioRegTypeID = Convert.ToInt64(dgvBioRegs["BioRegTypeID", dgvBioRegs.CurrentRow.Index].Value); aBioReg.bioRegDate = Convert.ToDateTime(dgvBioRegs["BioRegdate", dgvBioRegs.CurrentRow.Index].Value); aBioReg.value = Convert.ToDouble(dgvBioRegs["Value", dgvBioRegs.CurrentRow.Index].Value); aBioReg.memo = Convert.ToString(dgvBioRegs["Memo", dgvBioRegs.CurrentRow.Index].Value); aBioReg.userID = Convert.ToInt64(dgvBioRegs["UserID", dgvBioRegs.CurrentRow.Index].Value); return aBioReg; }
/// <summary> /// Load data from the object model to the grid /// </summary> private void LoadDataIntoGrid(BioReg aBioReg) { dgvBioRegs["BioRegTypeID", dgvBioRegs.CurrentRow.Index].Value = aBioReg.bioRegTypeID; dgvBioRegs["BioRegdate", dgvBioRegs.CurrentRow.Index].Value = aBioReg.bioRegDate; dgvBioRegs["Value", dgvBioRegs.CurrentRow.Index].Value = aBioReg.value; dgvBioRegs["Memo", dgvBioRegs.CurrentRow.Index].Value = aBioReg.memo; dgvBioRegs["UserID", dgvBioRegs.CurrentRow.Index].Value = aBioReg.userID; }
/// <summary> /// Load data from the object model to the boxes in display /// </summary> /// <param name="aBioReg">A BioReg object</param> private void LoadDataIntoBoxes(BioReg aBioReg) { txtBioRegID.Text = aBioReg.bioRegID.ToString(); txtUserID.Text = aBioReg.userID.ToString(); if ((txtBioRegTypeID.Text != "") && (txtBioRegTypeID.Text != "-1")) txtBioRegName.Text = this.bioRegTypesTableAdapter1.GetBioRegTypeName(Convert.ToInt64(txtBioRegTypeID.Text)); txtBioRegTypeID.Text = aBioReg.bioRegTypeID.ToString(); dtpBioRegDate.Value = aBioReg.bioRegDate; txtValue.Text = aBioReg.value.ToString(); txtMemo.Text = aBioReg.memo.ToString(); }