public void RetrieveTypeAnalysis() { try { InitData(); // --- recuperate head if (IDTemplate_Method != null && IDTemplate_Method > 0) { CTemplate_method_ah oTemplate_method_ah = new CTemplate_method_ah(); CTemplate_method_ahFactory faTemplate_method_aa = new CTemplate_method_ahFactory(); oTemplate_method_ah = faTemplate_method_aa.GetByPrimaryKey(new CTemplate_method_ahKeys(Convert.ToInt32(IDTemplate_Method))); if (oTemplate_method_ah != null) { oTemplate_method_ah.Idtemplate_method = oTemplate_Method.Idtemplate_method; cbUnit_result.EditValue = oTemplate_method_ah.Idunit_result; tbSymbol.Text = oTemplate_method_ah.Symbol; cbUnit_result.EditValue = oTemplate_method_ah.Idunit_result; } } else { } } catch (Exception ex) { ComunForm.Send_message(this.Text, TypeMsg.error, ex.Message); } }
public void RetrieveTypeAnalysis() { try { InitData(); // --- recuperate head if (IDTemplate_Method != null && IDTemplate_Method > 0) { CTemplate_method_ah oTemplate_method_ah = new CTemplate_method_ah(); CTemplate_method_ahFactory faTemplate_method_aa = new CTemplate_method_ahFactory(); oTemplate_method_ah = faTemplate_method_aa.GetByPrimaryKey(new CTemplate_method_ahKeys(Convert.ToInt32(IDTemplate_Method))); if (oTemplate_method_ah != null) { oTemplate_method_ah.Idtemplate_method = oTemplate_Method.Idtemplate_method; cbUnit_result.EditValue = oTemplate_method_ah.Idunit_result; tbSymbol.Text = oTemplate_method_ah.Symbol; cbUnit_result.EditValue = oTemplate_method_ah.Idunit_result; } } else { } } catch (Exception ex) { ComunForm.Send_message(this.Text, TypeMsg.error, ex.Message); } }
/// <summary> /// Populate business objects from the data reader /// </summary> /// <param name="dataReader">data reader</param> /// <returns>list of CTemplate_method_ah</returns> internal List <CTemplate_method_ah> PopulateObjectsFromReader(IDataReader dataReader) { List <CTemplate_method_ah> list = new List <CTemplate_method_ah>(); while (dataReader.Read()) { CTemplate_method_ah businessObject = new CTemplate_method_ah(); PopulateBusinessObjectFromReader(businessObject, dataReader); list.Add(businessObject); } return(list); }
/// <summary> /// update row in the table /// </summary> /// <param name="businessObject">business object</param> /// <returns>true for successfully updated</returns> public bool Update(CTemplate_method_ah businessObject) { NpgsqlCommand sqlCommand = new NpgsqlCommand(); sqlCommand.CommandText = "public.sp_template_method_ah_Update"; sqlCommand.CommandType = CommandType.StoredProcedure; // Use connection object of base class sqlCommand.Connection = MainConnection; try { sqlCommand.Parameters.AddWithValue("p_idtemplate_method", businessObject.Idtemplate_method); sqlCommand.Parameters["p_idtemplate_method"].NpgsqlDbType = NpgsqlDbType.Integer; sqlCommand.Parameters.AddWithValue("p_symbol", businessObject.Symbol); sqlCommand.Parameters["p_symbol"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_idunit_result", businessObject.Idunit_result); sqlCommand.Parameters["p_idunit_result"].NpgsqlDbType = NpgsqlDbType.Smallint; sqlCommand.Parameters.AddWithValue("p_usernew", businessObject.Usernew); sqlCommand.Parameters["p_usernew"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_datenew", businessObject.Datenew); sqlCommand.Parameters["p_datenew"].NpgsqlDbType = NpgsqlDbType.Date; sqlCommand.Parameters.AddWithValue("p_useredit", businessObject.Useredit); sqlCommand.Parameters["p_useredit"].NpgsqlDbType = NpgsqlDbType.Varchar; sqlCommand.Parameters.AddWithValue("p_dateedit", businessObject.Dateedit); sqlCommand.Parameters["p_dateedit"].NpgsqlDbType = NpgsqlDbType.Date; sqlCommand.Parameters.AddWithValue("p_status", businessObject.Status); sqlCommand.Parameters["p_status"].NpgsqlDbType = NpgsqlDbType.Boolean; MainConnection.Open(); if (Convert.ToInt32(sqlCommand.ExecuteScalar()) > 0) { return(true); } return(false); } catch (Exception ex) { throw new Exception("CTemplate_method_ah::Update::Error occured.", ex); } finally { MainConnection.Close(); sqlCommand.Dispose(); } }
/// <summary> /// Select by primary key /// </summary> /// <param name="keys">primary keys</param> /// <returns>CTemplate_method_ah business object</returns> public CTemplate_method_ah SelectByPrimaryKey(CTemplate_method_ahKeys keys) { NpgsqlCommand sqlCommand = new NpgsqlCommand(); sqlCommand.CommandText = "public.sp_template_method_ah_SelectByPrimaryKey"; sqlCommand.CommandType = CommandType.StoredProcedure; // Use connection object of base class sqlCommand.Connection = MainConnection; try { sqlCommand.Parameters.Add(new NpgsqlParameter("p_idtemplate_method", NpgsqlDbType.Integer, 4, "", ParameterDirection.Input, false, 0, 0, DataRowVersion.Proposed, keys.Idtemplate_method)); MainConnection.Open(); NpgsqlDataReader dataReader = sqlCommand.ExecuteReader(); if (dataReader.Read()) { CTemplate_method_ah businessObject = new CTemplate_method_ah(); PopulateBusinessObjectFromReader(businessObject, dataReader); return(businessObject); } else { return(null); } } catch (Exception ex) { throw new Exception("CTemplate_method_ah::SelectByPrimaryKey::Error occured.", ex); } finally { MainConnection.Close(); sqlCommand.Dispose(); } }
public bool SaveTypeAnalysis(int?pIdtemplate_method) { IDTemplate_Method = pIdtemplate_method; if (IDTemplate_Method != null && IDTemplate_Method > 0) { CTemplate_method_ah template_method_ah = new CTemplate_method_ah(); template_method_ah.Idtemplate_method = Convert.ToInt32(IDTemplate_Method); template_method_ah.Idunit_result = Convert.ToInt16(cbUnit_result.EditValue); template_method_ah.Symbol = tbSymbol.Text; bool result; if (!(result = new CTemplate_method_ahFactory().Update(template_method_ah))) { result = new CTemplate_method_ahFactory().Insert(template_method_ah); } return(result); } return(false); }
/// <summary> /// Populate business object from data reader /// </summary> /// <param name="businessObject">business object</param> /// <param name="dataReader">data reader</param> internal void PopulateBusinessObjectFromReader(CTemplate_method_ah businessObject, IDataReader dataReader) { businessObject.Idtemplate_method = dataReader.GetInt32(dataReader.GetOrdinal(CTemplate_method_ah.CTemplate_method_ahFields.Idtemplate_method.ToString())); if (!dataReader.IsDBNull(dataReader.GetOrdinal(CTemplate_method_ah.CTemplate_method_ahFields.Symbol.ToString()))) { businessObject.Symbol = dataReader.GetString(dataReader.GetOrdinal(CTemplate_method_ah.CTemplate_method_ahFields.Symbol.ToString())); } if (!dataReader.IsDBNull(dataReader.GetOrdinal(CTemplate_method_ah.CTemplate_method_ahFields.Idunit_result.ToString()))) { businessObject.Idunit_result = (short?)dataReader.GetInt16(dataReader.GetOrdinal(CTemplate_method_ah.CTemplate_method_ahFields.Idunit_result.ToString())); } if (!dataReader.IsDBNull(dataReader.GetOrdinal(CTemplate_method_ah.CTemplate_method_ahFields.Usernew.ToString()))) { businessObject.Usernew = dataReader.GetString(dataReader.GetOrdinal(CTemplate_method_ah.CTemplate_method_ahFields.Usernew.ToString())); } if (!dataReader.IsDBNull(dataReader.GetOrdinal(CTemplate_method_ah.CTemplate_method_ahFields.Datenew.ToString()))) { businessObject.Datenew = dataReader.GetDateTime(dataReader.GetOrdinal(CTemplate_method_ah.CTemplate_method_ahFields.Datenew.ToString())); } if (!dataReader.IsDBNull(dataReader.GetOrdinal(CTemplate_method_ah.CTemplate_method_ahFields.Useredit.ToString()))) { businessObject.Useredit = dataReader.GetString(dataReader.GetOrdinal(CTemplate_method_ah.CTemplate_method_ahFields.Useredit.ToString())); } if (!dataReader.IsDBNull(dataReader.GetOrdinal(CTemplate_method_ah.CTemplate_method_ahFields.Dateedit.ToString()))) { businessObject.Dateedit = dataReader.GetDateTime(dataReader.GetOrdinal(CTemplate_method_ah.CTemplate_method_ahFields.Dateedit.ToString())); } if (!dataReader.IsDBNull(dataReader.GetOrdinal(CTemplate_method_ah.CTemplate_method_ahFields.Status.ToString()))) { businessObject.Status = dataReader.GetBoolean(dataReader.GetOrdinal(CTemplate_method_ah.CTemplate_method_ahFields.Status.ToString())); } }
public bool SaveTypeAnalysis(int? pIdtemplate_method) { IDTemplate_Method = pIdtemplate_method; if (IDTemplate_Method != null && IDTemplate_Method > 0) { CTemplate_method_ah template_method_ah = new CTemplate_method_ah(); template_method_ah.Idtemplate_method = Convert.ToInt32(IDTemplate_Method); template_method_ah.Idunit_result = Convert.ToInt16(cbUnit_result.EditValue); template_method_ah.Symbol = tbSymbol.Text; bool result; if (!(result = new CTemplate_method_ahFactory().Update(template_method_ah))) result = new CTemplate_method_ahFactory().Insert(template_method_ah); return result; } return false; }