/// <summary>
        /// Handles the Click event of the btnAdd control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            try {
            int attributeId = 0;
            int attributeItemId = 0;
            int.TryParse(lblAttributeId.Text, out attributeId);
            int.TryParse(lblAttributeItemId.Text, out attributeItemId);
            AttributeItem attributeItem;
            if (attributeId > 0) {
              Where where = new Where();
              where.ColumnName = AttributeItem.Columns.AttributeId;
              where.DbType = DbType.Int32;
              where.ParameterValue = attributeId;
              Query query = new Query(AttributeItem.Schema);
              object strSortOrder = query.GetMax(AttributeItem.Columns.SortOrder, where);
              int maxSortOrder = 0;
              int.TryParse(strSortOrder.ToString(), out maxSortOrder);

              if (attributeItemId > 0) {
            attributeItem = new AttributeItem(attributeItemId);
              }
              else {
            attributeItem = new AttributeItem();
            attributeItem.SortOrder = maxSortOrder + 1;
              }

              attributeItem.AttributeId = attributeId;
              attributeItem.Name = Server.HtmlEncode(txtAttributeItemName.Text.Trim());
              decimal adjustment = 0;
              decimal.TryParse(txtAdjustment.Text, out adjustment);
              attributeItem.Adjustment = adjustment;
              if (!string.IsNullOrEmpty(txtSkuSuffix.Text)) {
            attributeItem.SkuSuffix = txtSkuSuffix.Text;
              }
              else {
            attributeItem.SkuSuffix = CoreUtility.GenerateRandomString(3);
              }

              attributeItem.Save(WebUtility.GetUserName());
              LoadAttributeItems();
              ResetAttributeItem();
            }
              }
              catch (Exception ex) {
            Logger.Error(typeof(attributeedit).Name + ".btnAdd_Click", ex);
            Master.MessageCenter.DisplayCriticalMessage(ex.Message);
              }
        }
        public void Insert(int AttributeId, string Name, decimal Adjustment, int SortOrder, string SkuSuffix)
        {
            AttributeItem item = new AttributeItem();

            item.AttributeId = AttributeId;

            item.Name = Name;

            item.Adjustment = Adjustment;

            item.SortOrder = SortOrder;

            item.SkuSuffix = SkuSuffix;


            item.Save(UserName);
        }
        public void Insert(int AttributeId,string Name,decimal Adjustment,int SortOrder,string SkuSuffix)
        {
            AttributeItem item = new AttributeItem();

            item.AttributeId = AttributeId;

            item.Name = Name;

            item.Adjustment = Adjustment;

            item.SortOrder = SortOrder;

            item.SkuSuffix = SkuSuffix;

            item.Save(UserName);
        }
 /// <summary>
 /// Handles the AttributeItem Edit.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="T:System.Web.UI.WebControls.CommandEventArgs"/> instance containing the event data.</param>
 protected void lbAttributeItemEdit(object sender, CommandEventArgs e)
 {
     try {
     int attributeItemId = 0;
     int.TryParse(e.CommandArgument.ToString(), out attributeItemId);
     if (attributeItemId > 0) {
       AttributeItem attributeItem = new AttributeItem(attributeItemId);
       lblAttributeItemId.Text = attributeItem.AttributeItemId.ToString();
       txtAttributeItemName.Text = attributeItem.Name;
       txtAdjustment.Text = StoreUtility.GetFormattedAmount(attributeItem.Adjustment, false);
       txtSkuSuffix.Text = attributeItem.SkuSuffix;
       btnAdd.Text = LocalizationUtility.GetText("lblEdit");
     }
       }
       catch (Exception ex) {
     Logger.Error(typeof(attributeedit).Name + ".lbAttributeItemEdit", ex);
     Master.MessageCenter.DisplayCriticalMessage(ex.Message);
       }
 }
 public bool Destroy(object AttributeItemId)
 {
     return(AttributeItem.Destroy(AttributeItemId) == 1);
 }
 public bool Delete(object AttributeItemId)
 {
     return(AttributeItem.Delete(AttributeItemId) == 1);
 }