当前位置: 首页>>代码示例>>C#>>正文


C# Query.GetMax方法代码示例

本文整理汇总了C#中Query.GetMax方法的典型用法代码示例。如果您正苦于以下问题:C# Query.GetMax方法的具体用法?C# Query.GetMax怎么用?C# Query.GetMax使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Query的用法示例。


在下文中一共展示了Query.GetMax方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: btnAdd_Click

        /// <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);
              }
        }
开发者ID:freecin,项目名称:dashcommerce-3,代码行数:53,代码来源:attributeedit.aspx.cs

示例2: btnSave_Click

 /// <summary>
 /// Handles the Click event of the btnSave 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 btnSave_Click(object sender, EventArgs e)
 {
     if(Page.IsValid){
     try {
       string descriptorId = lblDescriptorId.Text;
       Descriptor descriptor;
       Where where = new Where();
       where.ColumnName = Descriptor.Columns.ProductId;
       where.DbType = DbType.Int32;
       where.ParameterValue = productId;
       Query query = new Query(Descriptor.Schema);
       object strSortOrder = query.GetMax(Descriptor.Columns.SortOrder, where);
       int maxSortOrder = 0;
       int.TryParse(strSortOrder.ToString(), out maxSortOrder);
       if(!string.IsNullOrEmpty(descriptorId)) {
     descriptor = new Descriptor(descriptorId);
       }
       else {
     descriptor = new Descriptor();
     descriptor.SortOrder = maxSortOrder + 1;
       }
       descriptor.ProductId = productId;
       descriptor.Title = txtTitle.Text.Trim();
       descriptor.DescriptorX = HttpUtility.HtmlEncode(txtDescriptor.Value.Trim());
       descriptor.Save(WebUtility.GetUserName());
       Store.Caching.ProductCache.RemoveDescriptorCollectionFromCache(productId);
       LoadDescriptors();
       lblDescriptorId.Text = string.Empty;
       txtTitle.Text = string.Empty;
       txtDescriptor.Value = string.Empty;
       base.MasterPage.MessageCenter.DisplaySuccessMessage(LocalizationUtility.GetText("lblDescriptorSaved"));
     }
     catch(Exception ex) {
       Logger.Error(typeof(descriptors).Name + "btnSave_Click", ex);
       base.MasterPage.MessageCenter.DisplayCriticalMessage(ex.Message);
     }
       }
 }
开发者ID:montyclift,项目名称:dashcommerce-3,代码行数:43,代码来源:descriptors.ascx.cs

示例3: btnSave_Click

 /// <summary>
 /// Handles the Click event of the btnSave 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 btnSave_Click(object sender, EventArgs e)
 {
     if(Page.IsValid) {
     try {
       string imageId = lblImageId.Text;
       Where where = new Where();
       where.ColumnName = Store.Image.Columns.ProductId;
       where.DbType = DbType.Int32;
       where.ParameterValue = productId;
       Query query = new Query(Store.Image.Schema);
       object strSortOrder = query.GetMax(Store.Image.Columns.SortOrder, where);
       int maxSortOrder = 0;
       int.TryParse(strSortOrder.ToString(), out maxSortOrder);
       Store.Image image;
       if(!string.IsNullOrEmpty(imageId)) {
     image = new Store.Image(imageId);
       }
       else {
     image = new Store.Image();
     image.SortOrder = maxSortOrder + 1;
       }
       image.ProductId = productId;
       image.ImageFile = txtImageFile.Text.Trim();
       image.Caption = txtImageCaption.Text.Trim();
       image.Save(WebUtility.GetUserName());
       Store.Caching.ProductCache.RemoveImageCollectionFromCache(productId);
       Reset();
       LoadProductImages();
       base.MasterPage.MessageCenter.DisplaySuccessMessage(LocalizationUtility.GetText("lblProductImageSaved"));
     }
     catch(Exception ex) {
       Logger.Error(typeof(images).Name + ".btnSave_Click", ex);
       base.MasterPage.MessageCenter.DisplayCriticalMessage(ex.Message);
     }
       }
 }
开发者ID:freecin,项目名称:dashcommerce-3,代码行数:41,代码来源:images.ascx.cs

示例4: lbAdd_Click

 /// <summary>
 /// Handles the Click event of the lbAdd control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="T:System.Web.UI.WebControls.CommandEventArgs"/> instance containing the event data.</param>
 protected void lbAdd_Click(object sender, CommandEventArgs e)
 {
     try {
     int attributeId = 0;
     int.TryParse(e.CommandArgument.ToString(), out attributeId);
     if(attributeId > 0) {
       Where where = new Where();
       where.ColumnName = ProductAttributeMap.Columns.ProductId;
       where.DbType = DbType.Int32;
       where.ParameterValue = productId;
       Query query = new Query(ProductAttributeMap.Schema);
       object strSortOrder = query.GetMax(ProductAttributeMap.Columns.SortOrder, where);
       int maxSortOrder = 0;
       int.TryParse(strSortOrder.ToString(), out maxSortOrder);
       ProductAttributeMap map = new ProductAttributeMap();
       map.AttributeId = attributeId;
       map.ProductId = productId;
       map.SortOrder = maxSortOrder + 1;
       map.Save(WebUtility.GetUserName());
       Store.Caching.ProductCache.RemoveAssociatedAttributeCollectionFromCache(productId);
       LoadAvailableAttributes();
       LoadAssociatedAttributes();
     }
       }
       catch(Exception ex) {
     Logger.Error(typeof(attributes).Name + ".lbAdd_Click", ex);
     base.MasterPage.MessageCenter.DisplayCriticalMessage(ex.Message);
       }
 }
开发者ID:montyclift,项目名称:dashcommerce-3,代码行数:34,代码来源:attributes.ascx.cs


注:本文中的Query.GetMax方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。