/// <summary> /// Select values from TitleAssociation_TitleIdentifier by primary key(s). /// </summary> /// <param name="sqlConnection">Sql connection or null.</param> /// <param name="sqlTransaction">Sql transaction or null.</param> /// <param name="connectionKeyName">Connection key name located in config file.</param> /// <param name="titleAssociation_TitleIdentifierID"></param> /// <returns>Object of type TitleAssociation_TitleIdentifier.</returns> public TitleAssociation_TitleIdentifier TitleAssociation_TitleIdentifierSelectAuto( SqlConnection sqlConnection, SqlTransaction sqlTransaction, string connectionKeyName, int titleAssociation_TitleIdentifierID) { SqlConnection connection = CustomSqlHelper.CreateConnection(CustomSqlHelper.GetConnectionStringFromConnectionStrings(connectionKeyName), sqlConnection); SqlTransaction transaction = sqlTransaction; using (SqlCommand command = CustomSqlHelper.CreateCommand("TitleAssociation_TitleIdentifierSelectAuto", connection, transaction, CustomSqlHelper.CreateInputParameter("TitleAssociation_TitleIdentifierID", SqlDbType.Int, null, false, titleAssociation_TitleIdentifierID))) { using (CustomSqlHelper <TitleAssociation_TitleIdentifier> helper = new CustomSqlHelper <TitleAssociation_TitleIdentifier>()) { CustomGenericList <TitleAssociation_TitleIdentifier> list = helper.ExecuteReader(command); if (list.Count > 0) { TitleAssociation_TitleIdentifier o = list[0]; list = null; return(o); } else { return(null); } } } }
/// <summary> /// Manage TitleAssociation_TitleIdentifier object. /// If the object is of type CustomObjectBase, /// then either insert values into, delete values from, or update values in TitleAssociation_TitleIdentifier. /// </summary> /// <param name="sqlConnection">Sql connection or null.</param> /// <param name="sqlTransaction">Sql transaction or null.</param> /// <param name="value">Object of type TitleAssociation_TitleIdentifier.</param> /// <returns>Object of type CustomDataAccessStatus<TitleAssociation_TitleIdentifier>.</returns> public CustomDataAccessStatus <TitleAssociation_TitleIdentifier> TitleAssociation_TitleIdentifierManageAuto( SqlConnection sqlConnection, SqlTransaction sqlTransaction, TitleAssociation_TitleIdentifier value) { return(TitleAssociation_TitleIdentifierManageAuto(sqlConnection, sqlTransaction, "BHL", value)); }
/// <summary> /// Update values in TitleAssociation_TitleIdentifier. Returns an object of type TitleAssociation_TitleIdentifier. /// </summary> /// <param name="sqlConnection">Sql connection or null.</param> /// <param name="sqlTransaction">Sql transaction or null.</param> /// <param name="value">Object of type TitleAssociation_TitleIdentifier.</param> /// <returns>Object of type TitleAssociation_TitleIdentifier.</returns> public TitleAssociation_TitleIdentifier TitleAssociation_TitleIdentifierUpdateAuto( SqlConnection sqlConnection, SqlTransaction sqlTransaction, TitleAssociation_TitleIdentifier value) { return(TitleAssociation_TitleIdentifierUpdateAuto(sqlConnection, sqlTransaction, "BHL", value)); }
protected void identifiersList_RowUpdating(object sender, GridViewUpdateEventArgs e) { GridViewRow row = identifiersList.Rows[e.RowIndex]; if (row != null) { DropDownList ddlIdentifierName = row.FindControl("ddlIdentifierName") as DropDownList; TextBox txtIdentifierValue = row.FindControl("txtIdentifierValue") as TextBox; if (ddlIdentifierName != null && txtIdentifierValue != null) { //int titleAssociationId = (int)Session["TitleAssociation"]; int titleAssociationId = Convert.ToInt32(hidTitleAssociationID.Value); TitleAssociation association = this.FindTitleAssociation(titleAssociationId); TitleAssociation_TitleIdentifier taTitleIdentifier = FindTitleAssociation_TitleIdentifier( association.TitleAssociationIdentifiers, (int)identifiersList.DataKeys[e.RowIndex].Values[0], (int)identifiersList.DataKeys[e.RowIndex].Values[1], identifiersList.DataKeys[e.RowIndex].Values[2].ToString()); int titleIdentifierId = int.Parse(ddlIdentifierName.SelectedValue); String identifierValue = txtIdentifierValue.Text; taTitleIdentifier.TitleAssociationID = association.TitleAssociationID; taTitleIdentifier.TitleIdentifierID = titleIdentifierId; taTitleIdentifier.IdentifierName = ddlIdentifierName.SelectedItem.Text; taTitleIdentifier.IdentifierValue = identifierValue; } } identifiersList.EditIndex = -1; bindTitleIdentifierData(); }
/// <summary> /// Insert values into TitleAssociation_TitleIdentifier. Returns an object of type TitleAssociation_TitleIdentifier. /// </summary> /// <param name="sqlConnection">Sql connection or null.</param> /// <param name="sqlTransaction">Sql transaction or null.</param> /// <param name="connectionKeyName">Connection key name located in config file.</param> /// <param name="value">Object of type TitleAssociation_TitleIdentifier.</param> /// <returns>Object of type TitleAssociation_TitleIdentifier.</returns> public TitleAssociation_TitleIdentifier TitleAssociation_TitleIdentifierInsertAuto( SqlConnection sqlConnection, SqlTransaction sqlTransaction, string connectionKeyName, TitleAssociation_TitleIdentifier value) { return(TitleAssociation_TitleIdentifierInsertAuto(sqlConnection, sqlTransaction, connectionKeyName, value.TitleAssociationID, value.TitleIdentifierID, value.IdentifierValue)); }
/// <summary> /// Manage TitleAssociation_TitleIdentifier object. /// If the object is of type CustomObjectBase, /// then either insert values into, delete values from, or update values in TitleAssociation_TitleIdentifier. /// </summary> /// <param name="sqlConnection">Sql connection or null.</param> /// <param name="sqlTransaction">Sql transaction or null.</param> /// <param name="connectionKeyName">Connection key name located in config file.</param> /// <param name="value">Object of type TitleAssociation_TitleIdentifier.</param> /// <returns>Object of type CustomDataAccessStatus<TitleAssociation_TitleIdentifier>.</returns> public CustomDataAccessStatus <TitleAssociation_TitleIdentifier> TitleAssociation_TitleIdentifierManageAuto( SqlConnection sqlConnection, SqlTransaction sqlTransaction, string connectionKeyName, TitleAssociation_TitleIdentifier value) { if (value.IsNew && !value.IsDeleted) { TitleAssociation_TitleIdentifier returnValue = TitleAssociation_TitleIdentifierInsertAuto(sqlConnection, sqlTransaction, connectionKeyName, value.TitleAssociationID, value.TitleIdentifierID, value.IdentifierValue); return(new CustomDataAccessStatus <TitleAssociation_TitleIdentifier>( CustomDataAccessContext.Insert, true, returnValue)); } else if (!value.IsNew && value.IsDeleted) { if (TitleAssociation_TitleIdentifierDeleteAuto(sqlConnection, sqlTransaction, connectionKeyName, value.TitleAssociation_TitleIdentifierID)) { return(new CustomDataAccessStatus <TitleAssociation_TitleIdentifier>( CustomDataAccessContext.Delete, true, value)); } else { return(new CustomDataAccessStatus <TitleAssociation_TitleIdentifier>( CustomDataAccessContext.Delete, false, value)); } } else if (value.IsDirty && !value.IsDeleted) { TitleAssociation_TitleIdentifier returnValue = TitleAssociation_TitleIdentifierUpdateAuto(sqlConnection, sqlTransaction, connectionKeyName, value.TitleAssociation_TitleIdentifierID, value.TitleAssociationID, value.TitleIdentifierID, value.IdentifierValue); return(new CustomDataAccessStatus <TitleAssociation_TitleIdentifier>( CustomDataAccessContext.Update, true, returnValue)); } else { return(new CustomDataAccessStatus <TitleAssociation_TitleIdentifier>( CustomDataAccessContext.NA, false, value)); } }
protected void addTitleIdentifierButton_Click(object sender, EventArgs e) { //int titleAssociationId = (int)Session["TitleAssociation"]; int titleAssociationId = Convert.ToInt32(hidTitleAssociationID.Value); TitleAssociation association = this.FindTitleAssociation(titleAssociationId); TitleAssociation_TitleIdentifier ti = new TitleAssociation_TitleIdentifier(); ti.TitleAssociationID = association.TitleAssociationID; association.TitleAssociationIdentifiers.Add(ti); identifiersList.EditIndex = identifiersList.Rows.Count; bindTitleIdentifierData(); }
protected void identifiersList_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName.Equals("RemoveButton")) { int rowNum = int.Parse(e.CommandArgument.ToString()); //int titleAssociationId = (int)Session["TitleAssociation"]; int titleAssociationId = Convert.ToInt32(hidTitleAssociationID.Value); TitleAssociation association = this.FindTitleAssociation(titleAssociationId); TitleAssociation_TitleIdentifier taTitleIdentifier = FindTitleAssociation_TitleIdentifier( association.TitleAssociationIdentifiers, (int)identifiersList.DataKeys[rowNum].Values[0], (int)identifiersList.DataKeys[rowNum].Values[1], identifiersList.DataKeys[rowNum].Values[2].ToString()); taTitleIdentifier.IsDeleted = true; identifiersList.EditIndex = -1; bindTitleIdentifierData(); } }