Пример #1
0
        /// <summary>
        /// Select values from ItemLanguage 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="itemLanguageID"></param>
        /// <returns>Object of type ItemLanguage.</returns>
        public ItemLanguage ItemLanguageSelectAuto(
            SqlConnection sqlConnection,
            SqlTransaction sqlTransaction,
            string connectionKeyName,
            int itemLanguageID)
        {
            SqlConnection  connection  = CustomSqlHelper.CreateConnection(CustomSqlHelper.GetConnectionStringFromConnectionStrings(connectionKeyName), sqlConnection);
            SqlTransaction transaction = sqlTransaction;

            using (SqlCommand command = CustomSqlHelper.CreateCommand("ItemLanguageSelectAuto", connection, transaction,
                                                                      CustomSqlHelper.CreateInputParameter("ItemLanguageID", SqlDbType.Int, null, false, itemLanguageID)))
            {
                using (CustomSqlHelper <ItemLanguage> helper = new CustomSqlHelper <ItemLanguage>())
                {
                    CustomGenericList <ItemLanguage> list = helper.ExecuteReader(command);
                    if (list.Count > 0)
                    {
                        ItemLanguage o = list[0];
                        list = null;
                        return(o);
                    }
                    else
                    {
                        return(null);
                    }
                }
            }
        }
Пример #2
0
 /// <summary>
 /// Manage ItemLanguage object.
 /// If the object is of type CustomObjectBase,
 /// then either insert values into, delete values from, or update values in ItemLanguage.
 /// </summary>
 /// <param name="sqlConnection">Sql connection or null.</param>
 /// <param name="sqlTransaction">Sql transaction or null.</param>
 /// <param name="value">Object of type ItemLanguage.</param>
 /// <returns>Object of type CustomDataAccessStatus<ItemLanguage>.</returns>
 public CustomDataAccessStatus <ItemLanguage> ItemLanguageManageAuto(
     SqlConnection sqlConnection,
     SqlTransaction sqlTransaction,
     ItemLanguage value)
 {
     return(ItemLanguageManageAuto(sqlConnection, sqlTransaction, "BHL", value));
 }
Пример #3
0
 /// <summary>
 /// Update values in ItemLanguage. Returns an object of type ItemLanguage.
 /// </summary>
 /// <param name="sqlConnection">Sql connection or null.</param>
 /// <param name="sqlTransaction">Sql transaction or null.</param>
 /// <param name="value">Object of type ItemLanguage.</param>
 /// <returns>Object of type ItemLanguage.</returns>
 public ItemLanguage ItemLanguageUpdateAuto(
     SqlConnection sqlConnection,
     SqlTransaction sqlTransaction,
     ItemLanguage value)
 {
     return(ItemLanguageUpdateAuto(sqlConnection, sqlTransaction, "BHL", value));
 }
Пример #4
0
        protected void addLanguageButton_Click(object sender, EventArgs e)
        {
            Item         item = (Item)Session["Item" + itemIdTextBox.Text];
            ItemLanguage il   = new ItemLanguage(0, item.ItemID, "", DateTime.Now);

            item.ItemLanguages.Add(il);
            languagesList.EditIndex = languagesList.Rows.Count;
            bindLanguageData();
        }
Пример #5
0
 /// <summary>
 /// Insert values into ItemLanguage. Returns an object of type ItemLanguage.
 /// </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 ItemLanguage.</param>
 /// <returns>Object of type ItemLanguage.</returns>
 public ItemLanguage ItemLanguageInsertAuto(
     SqlConnection sqlConnection,
     SqlTransaction sqlTransaction,
     string connectionKeyName,
     ItemLanguage value)
 {
     return(ItemLanguageInsertAuto(sqlConnection, sqlTransaction, connectionKeyName,
                                   value.ItemID,
                                   value.LanguageCode));
 }
Пример #6
0
        /// <summary>
        /// Manage ItemLanguage object.
        /// If the object is of type CustomObjectBase,
        /// then either insert values into, delete values from, or update values in ItemLanguage.
        /// </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 ItemLanguage.</param>
        /// <returns>Object of type CustomDataAccessStatus<ItemLanguage>.</returns>
        public CustomDataAccessStatus <ItemLanguage> ItemLanguageManageAuto(
            SqlConnection sqlConnection,
            SqlTransaction sqlTransaction,
            string connectionKeyName,
            ItemLanguage value)
        {
            if (value.IsNew && !value.IsDeleted)
            {
                ItemLanguage returnValue = ItemLanguageInsertAuto(sqlConnection, sqlTransaction, connectionKeyName,
                                                                  value.ItemID,
                                                                  value.LanguageCode);

                return(new CustomDataAccessStatus <ItemLanguage>(
                           CustomDataAccessContext.Insert,
                           true, returnValue));
            }
            else if (!value.IsNew && value.IsDeleted)
            {
                if (ItemLanguageDeleteAuto(sqlConnection, sqlTransaction, connectionKeyName,
                                           value.ItemLanguageID))
                {
                    return(new CustomDataAccessStatus <ItemLanguage>(
                               CustomDataAccessContext.Delete,
                               true, value));
                }
                else
                {
                    return(new CustomDataAccessStatus <ItemLanguage>(
                               CustomDataAccessContext.Delete,
                               false, value));
                }
            }
            else if (value.IsDirty && !value.IsDeleted)
            {
                ItemLanguage returnValue = ItemLanguageUpdateAuto(sqlConnection, sqlTransaction, connectionKeyName,
                                                                  value.ItemLanguageID,
                                                                  value.ItemID,
                                                                  value.LanguageCode);

                return(new CustomDataAccessStatus <ItemLanguage>(
                           CustomDataAccessContext.Update,
                           true, returnValue));
            }
            else
            {
                return(new CustomDataAccessStatus <ItemLanguage>(
                           CustomDataAccessContext.NA,
                           false, value));
            }
        }
Пример #7
0
        protected void languagesList_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName.Equals("RemoveButton"))
            {
                int  rowNum = int.Parse(e.CommandArgument.ToString());
                Item item   = (Item)Session["Item" + itemIdTextBox.Text];

                ItemLanguage itemLanguage = findItemLanguage(item.ItemLanguages,
                                                             (int)languagesList.DataKeys[rowNum].Values[0],
                                                             languagesList.DataKeys[rowNum].Values[1].ToString());

                itemLanguage.IsDeleted = true;
                bindLanguageData();
            }
        }
Пример #8
0
        protected void languagesList_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            GridViewRow row = languagesList.Rows[e.RowIndex];

            if (row != null)
            {
                DropDownList ddlLanguageName = row.FindControl("ddlLanguageName") as DropDownList;
                if (ddlLanguageName != null)
                {
                    Item   item         = (Item)Session["Item" + itemIdTextBox.Text];
                    String languageCode = ddlLanguageName.SelectedValue;

                    ItemLanguage itemLanguage = findItemLanguage(item.ItemLanguages,
                                                                 (int)languagesList.DataKeys[e.RowIndex].Values[0],
                                                                 languagesList.DataKeys[e.RowIndex].Values[1].ToString());

                    itemLanguage.LanguageCode = languageCode;
                    itemLanguage.LanguageName = ddlLanguageName.SelectedItem.Text;
                }
            }

            languagesList.EditIndex = -1;
            bindLanguageData();
        }
 public static ItemLanguage CreateItemLanguage(int itemID, int languageID)
 {
     ItemLanguage itemLanguage = new ItemLanguage();
     itemLanguage.ItemID = itemID;
     itemLanguage.LanguageID = languageID;
     return itemLanguage;
 }
 public void AddToItemLanguages(ItemLanguage itemLanguage)
 {
     base.AddObject("ItemLanguages", itemLanguage);
 }