Exemplo n.º 1
0
 protected void uxGrid_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     try
     {
         if (e.CommandName == "Add")
         {
             SpecificationItemValue item = SetupSpecificationItemValueDetails();
             if (IsSpecificationItemValueExist(item.Value))
             {
                 uxMessage.DisplayError(Resources.ProductSpecificationMessages.DuplicateValueError);
                 return;
             }
             DataAccessContext.SpecificationItemValueRepository.Save(item);
             uxMessage.DisplayMessage(Resources.ProductSpecificationMessages.ValueAddSuccess);
             RefreshGrid();
         }
         else if (e.CommandName == "Edit")
         {
             uxGrid.ShowFooter   = false;
             uxAddButton.Visible = true;
         }
     }
     catch (Exception ex)
     {
         uxMessage.DisplayException(ex);
     }
 }
Exemplo n.º 2
0
    protected string GetDisplayText(object groupName)
    {
        if (groupName.ToString().ToLower() == "price")
        {
            if (String.IsNullOrEmpty(MaxPrice))
            {
                return(StoreContext.Currency.FormatPrice(ConvertUtilities.ToDecimal(MinPrice)) + GetLanguageText("andabove"));
            }

            return(StoreContext.Currency.FormatPrice(ConvertUtilities.ToDecimal(MinPrice)) + " - " + StoreContext.Currency.FormatPrice(ConvertUtilities.ToDecimal(MaxPrice)));
        }
        else if (groupName.ToString() == "[$Category]")
        {
            Category category = DataAccessContext.CategoryRepository.GetOne(StoreContext.Culture, Request.QueryString["cat"]);
            return(category.Name);
        }
        else if (groupName.ToString() == "[$Department]")
        {
            Department department = DataAccessContext.DepartmentRepository.GetOne(StoreContext.Culture, Request.QueryString["dep"]);
            return(department.Name);
        }
        else if (groupName.ToString() == "[$Manufacturer]")
        {
            Manufacturer manufacturer = DataAccessContext.ManufacturerRepository.GetOne(StoreContext.Culture, Request.QueryString["manu"]);
            return(manufacturer.Name);
        }
        else
        {
            SpecificationItem      specItem  = DataAccessContext.SpecificationItemRepository.GetOneByName(StoreContext.Culture, groupName.ToString());
            SpecificationItemValue specValue = DataAccessContext.SpecificationItemValueRepository.GetOneBySpecItemIDAndValue(StoreContext.Culture, specItem.SpecificationItemID, Request.QueryString[groupName.ToString()]);
            return(specValue.DisplayValue);
        }
    }
Exemplo n.º 3
0
    private SpecificationItemValue SetupSpecificationItemValueDetails()
    {
        SpecificationItemValue item = new SpecificationItemValue(DataAccessContext.CultureRepository.GetOne(CultureUtilities.BaseCultureID));

        item.Value               = ((TextBox)uxGrid.FooterRow.FindControl("uxValueText")).Text.Trim();
        item.DisplayValue        = ((TextBox)uxGrid.FooterRow.FindControl("uxDisplayValueText")).Text.Trim();
        item.SpecificationItemID = SpecificationItemID;
        return(item);
    }
Exemplo n.º 4
0
    private void CreateDummyRow(IList <SpecificationItemValue> list)
    {
        SpecificationItemValue specificationItemValue = new SpecificationItemValue(DataAccessContext.CultureRepository.GetOne(CultureUtilities.BaseCultureID));

        specificationItemValue.SpecificationItemValueID = "-1";
        specificationItemValue.Value        = string.Empty;
        specificationItemValue.DisplayValue = string.Empty;

        list.Add(specificationItemValue);
    }
Exemplo n.º 5
0
    private IList <SpecificationItemValue> GetSpecItemValueList(IList <string> specKeyList)
    {
        IList <SpecificationItemValue> specItemValueList = new List <SpecificationItemValue>();

        foreach (string specKey in specKeyList)
        {
            string specValue = Request.QueryString[specKey];

            SpecificationItem specItem = DataAccessContext.SpecificationItemRepository.GetOneByName(StoreContext.Culture, specKey);

            SpecificationItemValue specItemValue = DataAccessContext.SpecificationItemValueRepository.GetOneBySpecItemIDAndValue(StoreContext.Culture, specItem.SpecificationItemID, specValue);
            specItemValueList.Add(specItemValue);
        }

        return(specItemValueList);
    }
Exemplo n.º 6
0
    protected void uxGrid_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        try
        {
            string id           = ((Label)uxGrid.Rows[e.RowIndex].FindControl("uxSpecificationItemValueIDLabel")).Text.Trim();
            string value        = ((TextBox)uxGrid.Rows[e.RowIndex].FindControl("uxValueText")).Text.Trim();
            string displayValue = ((TextBox)uxGrid.Rows[e.RowIndex].FindControl("uxDisplayValueText")).Text.Trim();

            if (!String.IsNullOrEmpty(id))
            {
                SpecificationItemValue item = DataAccessContext.SpecificationItemValueRepository.GetOne(DataAccessContext.CultureRepository.GetOne(CultureUtilities.BaseCultureID), id);
                if (!item.Value.Equals(value) && IsSpecificationItemValueExist(value))
                {
                    uxMessage.DisplayError(Resources.ProductSpecificationMessages.DuplicateValueError);
                    return;
                }

                item.Value               = value;
                item.DisplayValue        = displayValue;
                item.SpecificationItemID = SpecificationItemID;

                DataAccessContext.SpecificationItemValueRepository.Save(item);
                uxGrid.EditIndex = -1;
                uxMessage.DisplayMessage(Resources.ProductSpecificationMessages.ValueUpdateSuccess);

                RefreshGrid();
            }
        }
        catch (Exception ex)
        {
            uxMessage.DisplayException(ex);
        }
        finally
        {
            // Avoid calling Update() automatically by GridView
            e.Cancel = true;
        }
    }
Exemplo n.º 7
0
    protected int GetCountItem(string specItemValueID)
    {
        string startPrice = MinPrice;
        string endPrice   = MaxPrice;
        SpecificationItemValue specItemValue = DataAccessContext.SpecificationItemValueRepository.GetOne(StoreContext.Culture, specItemValueID.ToString());


        IList <string> specKeyList = GetAllSpecKey();


        int itemCount = DataAccessContext.ProductRepository.GetFacetCount(
            StoreContext.Culture,
            GetCategoryList(),
            GetDepartmentListWithLeaf(),
            GetManufacturerID(),
            startPrice,
            endPrice,
            GetSpecItemValueList(specKeyList, specItemValue),
            "",
            BoolFilter.ShowTrue,
            StoreContext.CurrentStore.StoreID);

        return(itemCount);
    }