/// <summary> /// Converts <see cref="System.Data.DataRow"/> to <see cref="lkpResponsibleOfficeRow"/>. /// </summary> /// <param name="row">The <see cref="System.Data.DataRow"/> object to be mapped.</param> /// <returns>A reference to the <see cref="lkpResponsibleOfficeRow"/> object.</returns> protected virtual lkpResponsibleOfficeRow MapRow(DataRow row) { lkpResponsibleOfficeRow mappedObject = new lkpResponsibleOfficeRow(); DataTable dataTable = row.Table; DataColumn dataColumn; // Column "Resp_OfficeID" dataColumn = dataTable.Columns["Resp_OfficeID"]; if (!row.IsNull(dataColumn)) { mappedObject.Resp_OfficeID = (int)row[dataColumn]; } // Column "Resp_OfficeName" dataColumn = dataTable.Columns["Resp_OfficeName"]; if (!row.IsNull(dataColumn)) { mappedObject.Resp_OfficeName = (string)row[dataColumn]; } // Column "Active" dataColumn = dataTable.Columns["Active"]; if (!row.IsNull(dataColumn)) { mappedObject.Active = (bool)row[dataColumn]; } return(mappedObject); }
/// <summary> /// Updates a record in the <c>lkpResponsibleOffice</c> table. /// </summary> /// <param name="value">The <see cref="lkpResponsibleOfficeRow"/> /// object used to update the table record.</param> /// <returns>true if the record was updated; otherwise, false.</returns> public virtual bool Update(lkpResponsibleOfficeRow value) { IDbCommand cmd = _db.CreateCommand("dbo._lkpResponsibleOffice_Update", true); AddParameter(cmd, "Resp_OfficeName", value.Resp_OfficeName); AddParameter(cmd, "Active", value.IsActiveNull ? DBNull.Value : (object)value.Active); AddParameter(cmd, "Resp_OfficeID", value.Resp_OfficeID); return(0 != cmd.ExecuteNonQuery()); }
/// <summary> /// Adds a new record into the <c>lkpResponsibleOffice</c> table. /// </summary> /// <param name="value">The <see cref="lkpResponsibleOfficeRow"/> object to be inserted.</param> public virtual void Insert(lkpResponsibleOfficeRow value) { IDbCommand cmd = _db.CreateCommand("dbo._lkpResponsibleOffice_Insert", true); AddParameter(cmd, "Resp_OfficeID", value.Resp_OfficeID); AddParameter(cmd, "Resp_OfficeName", value.Resp_OfficeName); AddParameter(cmd, "Active", value.IsActiveNull ? DBNull.Value : (object)value.Active); cmd.ExecuteNonQuery(); }
/// <summary> /// Reads data from the provided data reader and returns /// an array of mapped objects. /// </summary> /// <param name="reader">The <see cref="System.Data.IDataReader"/> object to read data from the table.</param> /// <param name="startIndex">The index of the first record to map.</param> /// <param name="length">The number of records to map.</param> /// <param name="totalRecordCount">A reference parameter that returns the total number /// of records in the reader object if 0 was passed into the method; otherwise it returns -1.</param> /// <returns>An array of <see cref="lkpResponsibleOfficeRow"/> objects.</returns> protected virtual lkpResponsibleOfficeRow[] MapRecords(IDataReader reader, int startIndex, int length, ref int totalRecordCount) { if (0 > startIndex) { throw new ArgumentOutOfRangeException("startIndex", startIndex, "StartIndex cannot be less than zero."); } if (0 > length) { throw new ArgumentOutOfRangeException("length", length, "Length cannot be less than zero."); } int resp_OfficeIDColumnIndex = reader.GetOrdinal("Resp_OfficeID"); int resp_OfficeNameColumnIndex = reader.GetOrdinal("Resp_OfficeName"); int activeColumnIndex = reader.GetOrdinal("Active"); System.Collections.ArrayList recordList = new System.Collections.ArrayList(); int ri = -startIndex; while (reader.Read()) { ri++; if (ri > 0 && ri <= length) { lkpResponsibleOfficeRow record = new lkpResponsibleOfficeRow(); recordList.Add(record); record.Resp_OfficeID = Convert.ToInt32(reader.GetValue(resp_OfficeIDColumnIndex)); if (!reader.IsDBNull(resp_OfficeNameColumnIndex)) { record.Resp_OfficeName = Convert.ToString(reader.GetValue(resp_OfficeNameColumnIndex)); } if (!reader.IsDBNull(activeColumnIndex)) { record.Active = Convert.ToBoolean(reader.GetValue(activeColumnIndex)); } if (ri == length && 0 != totalRecordCount) { break; } } } totalRecordCount = 0 == totalRecordCount ? ri + startIndex : -1; return((lkpResponsibleOfficeRow[])(recordList.ToArray(typeof(lkpResponsibleOfficeRow)))); }
/// <summary> /// Deletes the specified object from the <c>lkpResponsibleOffice</c> table. /// </summary> /// <param name="value">The <see cref="lkpResponsibleOfficeRow"/> object to delete.</param> /// <returns>true if the record was deleted; otherwise, false.</returns> public bool Delete(lkpResponsibleOfficeRow value) { return(DeleteByPrimaryKey(value.Resp_OfficeID)); }
private void showData() { ECCMS _objDetail = new ECCMS(); try { tblComplainRow _objRow = new tblComplainRow(); lkpProvinceRow _objProvRow = new lkpProvinceRow(); lkpDistrictRow _objDistRow = new lkpDistrictRow(); lkpPollingCenterRow _objPCRow = new lkpPollingCenterRow(); lkpBitRow _objBitRow = new lkpBitRow(); lkpCasepriorityRow _objCasePro = new lkpCasepriorityRow(); lkpGendersRow _objGenderRow = new lkpGendersRow(); lkpCandidateRow _objCandRow = new lkpCandidateRow(); lkpComplainanttypeRow _objComp_Type = new lkpComplainanttypeRow(); lkpRespondanttypeRow _objResp_Type = new lkpRespondanttypeRow(); lkpAllegationtypeRow _objAllega_Type = new lkpAllegationtypeRow(); lkpResponsibleOfficeRow _objResp_Office = new lkpResponsibleOfficeRow(); lkpSanctionRow _objSanc = new lkpSanctionRow(); lkpStatusRow _objStatusRow = new lkpStatusRow(); _objRow = _objDetail.tblComplainCollection.GetRow("CaseID=" + CaseID + ""); txtCaseNo.Text = _objRow.CaseNo.ToString(); txtSubDate.Text = _objRow.Sub_Date.ToShortDateString(); txtTriDate.Text = _objRow.Tri_Date.ToShortDateString(); txtPS.Text = _objRow.PS.ToString(); txtSummary.Text = _objRow.AllegationSummary.ToString().Trim(); txtDecision.Text = _objRow.Decision.ToString().Trim(); txtEccHQDecision.Text = _objRow.Ecc_HQ_Decision.ToString().Trim(); _objBitRow = _objDetail.lkpBitCollection.GetRow("BitID=" + _objRow.Kuchi); txtKuchi.Text = _objBitRow.BitName.ToString().Trim(); _objBitRow = _objDetail.lkpBitCollection.GetRow("BitID=" + _objRow.Appeal); txtAppeal.Text = _objBitRow.BitName.ToString().Trim(); _objCasePro = _objDetail.lkpCasepriorityCollection.GetRow("CaseProID=" + _objRow.CaseProID); txtCasePro.Text = _objCasePro.CaseProName.ToString().Trim(); _objCandRow = _objDetail.lkpCandidateCollection.GetRow("Cand_ID=" + _objRow.Comp_Cand_ID); txtCandidateNo.Text = _objCandRow.Cand_No.ToString().Trim(); // _objProvRow = _objDetail.lkpProvinceCollection.GetRow("ProvID=" + _objCandRow.Prov_ID); _objPCRow = _objDetail.lkpPollingCenterCollection.GetRow("PolCen_ID=" + _objRow.PolCen_ID); txtPC.Text = _objPCRow.PolCen_Code; _objDistRow = _objDetail.lkpDistrictCollection.GetRow("District_Code=" + _objPCRow.District_Code); txtDistrict.Text = _objDistRow.District_Name.ToString().Trim(); // _objProvRow = _objDetail.lkpProvinceCollection.GetRow("Provid=" + _objDistRow.Province_Id + ""); // txtProvince.Text = _objProvRow.ProvNameEng.ToString().Trim(); _objProvRow = _objDetail.lkpProvinceCollection.GetRow("ProvID=" + _objRow.ProvID + ""); txtProvince.Text = _objProvRow.ProvNameEng.ToString(); _objGenderRow = _objDetail.lkpGendersCollection.GetRow("GenderID=" + _objRow.Comp_GenderID); txtGender1.Text = _objGenderRow.GenderName.ToString().Trim(); _objGenderRow = _objDetail.lkpGendersCollection.GetRow("GenderID=" + _objRow.Resp_GenderID); txtGender2.Text = _objGenderRow.GenderName.ToString().Trim(); _objComp_Type = _objDetail.lkpComplainanttypeCollection.GetRow("Comp_typeID=" + _objRow.Comp_TypeID); txtComp_Type.Text = _objComp_Type.Comp_Name.ToString().Trim(); _objResp_Type = _objDetail.lkpRespondanttypeCollection.GetRow("RespType_ID=" + _objRow.Resp_TypeID); txtResp_Type.Text = _objResp_Type.RespType_Name.ToString().Trim(); _objAllega_Type = _objDetail.lkpAllegationtypeCollection.GetRow("AllagType_ID=" + _objRow.AllagType_ID); txtAllage_Type.Text = _objAllega_Type.AllagType_Name.ToString().Trim(); _objResp_Office = _objDetail.lkpResponsibleOfficeCollection.GetRow("Resp_OfficeID=" + _objRow.Resp_OfficeID); txtResp_Office.Text = _objResp_Office.Resp_OfficeName.ToString().Trim(); _objStatusRow = _objDetail.lkpStatusCollection.GetRow("StatusID=" + _objRow.StatusID); txtStatus.Text = _objStatusRow.StatusName.ToString().Trim(); _objSanc = _objDetail.lkpSanctionCollection.GetRow("SacntionID=" + _objRow.SanctionID); txtSanction.Text = _objSanc.SacntionName.ToString().Trim(); } finally { _objDetail.Dispose(); } }