コード例 #1
0
    protected void gvCurrentModel_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        GridViewRow  gvr  = gvCurrentModel.Rows[e.RowIndex];
        int          k    = int.Parse(gvCurrentModel.DataKeys[e.RowIndex].Value.ToString());
        string       name = (gvr.FindControl("txtInnerModelName") as TextBox).Text.Trim();
        string       code = (gvr.FindControl("txtInnerModelCode") as TextBox).Text.Trim();
        string       desc = (gvr.FindControl("txtInnerDesc") as TextBox).Text.Trim();
        ProductModel pm   = ProductModels.GetModel(k);

        pm.ModelName  = name;
        pm.ModelCode  = code;
        pm.ModelDesc  = desc;
        pm.UpdateUser = Profile.AccountInfo.UserID;
        pm.UpdateTime = DateTime.Now;
        ProductModels.Update(pm);
        gvCurrentModel.EditIndex = -1;
        BindToModel();
    }
コード例 #2
0
    protected void egvShoppings_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            Literal ltPN = e.Row.FindControl("ltProductName") as Literal;
            Literal ltMN = e.Row.FindControl("ltModelName") as Literal;
            Literal ltPC = e.Row.FindControl("ltPrice") as Literal;

            Shopping shop = (Shopping)e.Row.DataItem;
            Product  p    = Products.GetProduct(shop.ProductID);
            ltPN.Text = string.Format(productFormat,
                                      GlobalSettings.Encrypt(p.ProductID.ToString()),
                                      p.ProductName,
                                      p.ProductAbstract,
                                      p.GetDefaultImageUrl(50, 50));
            decimal?price1 = null;
            decimal?price2 = null;
            if (Profile.IsAnonymous)
            {
                price1 = ProductPrices.GetPriceDefault(p.ProductID);
            }
            else
            {
                price1 = ProductPrices.GetPriceMarket(Profile.AccountInfo.UserID, p.ProductID);
                price2 = ProductPrices.GetPriceMember(Profile.AccountInfo.UserID, p.ProductID);
            }
            ltPC.Text = GlobalSettings.GetPrice(price1, price2);
            if (shop.ModelID != 0)
            {
                ProductModel pm = ProductModels.GetModel(shop.ModelID);
                ltMN.Text = pm.ModelName;
            }
            else
            {
                ltMN.Text = "——";
            }
        }
    }