protected void lbtnModify_Click(object sender, EventArgs e)
    {
        if (lbItemID.Text == "" || txtAgoraPrice.Text == "" || txtMemberPrice.Text == "" || txtSeckillPrice.Text == "" || txtVipPrice.Text == "")
        {
            panelAttention.Visible = true;
            lbAttention.Text = "请先选择修改项目!";
        }
        else
        {
            Entity.Items item = new Entity.Items();
            item.setItemID(int.Parse(lbItemID.Text));
            item.setAgoraPrice(txtAgoraPrice.Text);
            item.setMemberPrice(txtMemberPrice.Text);
            item.setVipPrice( txtVipPrice.Text);
            item.setSeckillPrice(txtSeckillPrice.Text);
            if (items.UpdateSinglePrice(item))
            {
                panelSuccess.Visible = true;
                lbSuccess.Text = "价格更新成功!";
                txtAgoraPrice.Text = txtMemberPrice.Text = ""; txtSeckillPrice.Text = ""; txtVipPrice.Text = "";
            }
            else {
                panelError.Visible = true;
                lbError.Text = "更新出错!";
            }
        }

    }
Пример #2
0
 protected void lbtnModify_Click(object sender, EventArgs e)
 {
     Entity.Items item = new Entity.Items();
     item.setItemID(int.Parse(lbItemID.Text));
     item.setDays(txtDays.Text);
     item.setHours(txtHour.Text);
     item.setMinutes(txtMinutes.Text);
     item.setSeconds(txtSeconds.Text);
     item.setIsSecondKill(rblIsSecondKill.SelectedValue.ToLower());
     if (lbItemID.Text == string.Empty || txtDays.Text == string.Empty ||
         txtHour.Text == string.Empty || txtMinutes.Text == string.Empty || txtSeconds.Text == string.Empty)
     {
         panelAttention.Visible = true;
         lbAttention.Text       = "请先选择需要设置的商品!";
     }
     else if (items.UpdateSingleItem(item))
     {
         panelSuccess.Visible   = true;
         lbSuccess.Text         = "更新成功!";
         txtSeconds.Text        = txtMinutes.Text = txtHour.Text = txtDays.Text = lbItemID.Text = "";
         gvItemsList.DataSource = items.GetItemByAllWithNoImg();
         gvItemsList.DataBind();
     }
     else
     {
         panelError.Visible = false;
         lbError.Text       = "更新失败!";
     }
 }
 protected void lbtnModify_Click(object sender, EventArgs e)
 {
     Entity.Items item = new Entity.Items();
     item.setItemID(int.Parse(lbItemID.Text));
     item.setDays(txtDays.Text);
     item.setHours(txtHour.Text);
     item.setMinutes(txtMinutes.Text);
     item.setSeconds( txtSeconds.Text);
     item.setIsSecondKill(rblIsSecondKill.SelectedValue.ToLower());
     if (lbItemID.Text == string.Empty || txtDays.Text == string.Empty
         || txtHour.Text == string.Empty || txtMinutes.Text == string.Empty || txtSeconds.Text == string.Empty)
     {
         panelAttention.Visible = true;
         lbAttention.Text = "请先选择需要设置的商品!";
     }
     else if (items.UpdateSingleItem(item))
     {
         panelSuccess.Visible = true;
         lbSuccess.Text = "更新成功!";
         txtSeconds.Text = txtMinutes.Text = txtHour.Text = txtDays.Text =lbItemID.Text= "";
         gvItemsList.DataSource = items.GetItemByAllWithNoImg();
         gvItemsList.DataBind(); 
     }
     else 
     {
         panelError.Visible = false;
         lbError.Text = "更新失败!";
     }   
 }
 protected void lbtnModify_Click(object sender, EventArgs e)
 {
     if (lbItemID.Text == "" || txtAgoraPrice.Text == "" || txtMemberPrice.Text == "" || txtSeckillPrice.Text == "" || txtVipPrice.Text == "")
     {
         panelAttention.Visible = true;
         lbAttention.Text       = "请先选择修改项目!";
     }
     else
     {
         Entity.Items item = new Entity.Items();
         item.setItemID(int.Parse(lbItemID.Text));
         item.setAgoraPrice(txtAgoraPrice.Text);
         item.setMemberPrice(txtMemberPrice.Text);
         item.setVipPrice(txtVipPrice.Text);
         item.setSeckillPrice(txtSeckillPrice.Text);
         if (items.UpdateSinglePrice(item))
         {
             panelSuccess.Visible = true;
             lbSuccess.Text       = "价格更新成功!";
             txtAgoraPrice.Text   = txtMemberPrice.Text = ""; txtSeckillPrice.Text = ""; txtVipPrice.Text = "";
         }
         else
         {
             panelError.Visible = true;
             lbError.Text       = "更新出错!";
         }
     }
 }
 protected void lbtnModify_Click(object sender, EventArgs e)
 {
    
         switch (lbtnModify.Text)
         {
             case "更新":
                 if (lbItemID.Text == "" || txtItemName.Text == "" || txtArea.Text == "")
                 {
                     panelAttention.Visible = true;
                     lbAttention.Text = "请先选择更新的商品并填写相关信息!";
                 }
                 else
                 {
                     Entity.Items item = new Entity.Items();
                     item.setItemID(int.Parse(lbItemID.Text));
                     item.setProductID(int.Parse(ddlProductID.SelectedItem.Value));
                     item.setBrandID(int.Parse(ddlBrandID.SelectedItem.Value));
                     item.setName(txtItemName.Text.Trim());
                     item.setArea(txtArea.Text.Trim());
                     if (items.UpdateSingleItem(item))
                     {
                         panelSuccess.Visible = true;
                         lbSuccess.Text = "商品信息更新成功!";
                         gvItemsList.DataSource = items.GetItemByAllWithNoImg();
                         gvItemsList.DataBind();
                         txtArea.Text = txtItemName.Text = lbItemID.Text = "";
                     }
                     else
                     {
                         panelError.Visible = false;
                         lbError.Text = "商品信息更新失败!";
                     }
                 }
                 break;
             case "删除":
                 if (lbItemID.Text == "")
                 {
                     panelAttention.Visible = true;
                     lbAttention.Text = "请先选择更新的商品并填写相关信息!";
                 }
                 else
                 {
                     if (items.DeleteItem(int.Parse(lbItemID.Text)))
                     {
                         panelSuccess.Visible = true;
                         lbSuccess.Text = "商品信息删除成功!";
                         gvItemsList.DataSource = items.GetItemByAllWithNoImg();
                         gvItemsList.DataBind();
                     }
                     else
                     {
                         panelError.Visible = true;
                         lbError.Text = "商品信息删除失败!";
                     }
                 }
                 break;  
     }
   
 }
    protected void lbtnModify_Click(object sender, EventArgs e)
    {
        switch (lbtnModify.Text)
        {
        case "更新":
            if (lbItemID.Text == "" || txtItemName.Text == "" || txtArea.Text == "")
            {
                panelAttention.Visible = true;
                lbAttention.Text       = "请先选择更新的商品并填写相关信息!";
            }
            else
            {
                Entity.Items item = new Entity.Items();
                item.setItemID(int.Parse(lbItemID.Text));
                item.setProductID(int.Parse(ddlProductID.SelectedItem.Value));
                item.setBrandID(int.Parse(ddlBrandID.SelectedItem.Value));
                item.setName(txtItemName.Text.Trim());
                item.setArea(txtArea.Text.Trim());
                if (items.UpdateSingleItem(item))
                {
                    panelSuccess.Visible   = true;
                    lbSuccess.Text         = "商品信息更新成功!";
                    gvItemsList.DataSource = items.GetItemByAllWithNoImg();
                    gvItemsList.DataBind();
                    txtArea.Text = txtItemName.Text = lbItemID.Text = "";
                }
                else
                {
                    panelError.Visible = false;
                    lbError.Text       = "商品信息更新失败!";
                }
            }
            break;

        case "删除":
            if (lbItemID.Text == "")
            {
                panelAttention.Visible = true;
                lbAttention.Text       = "请先选择更新的商品并填写相关信息!";
            }
            else
            {
                if (items.DeleteItem(int.Parse(lbItemID.Text)))
                {
                    panelSuccess.Visible   = true;
                    lbSuccess.Text         = "商品信息删除成功!";
                    gvItemsList.DataSource = items.GetItemByAllWithNoImg();
                    gvItemsList.DataBind();
                }
                else
                {
                    panelError.Visible = true;
                    lbError.Text       = "商品信息删除失败!";
                }
            }
            break;
        }
    }