Esempio n. 1
0
    protected void ViewControl()
    {
        ProductCategoryInfo info = pcBLL.getEditdata(id);

        if (info.pc_id != 0)
        {
            if (info.pc_fatherid != 0)
            {
                lbcategory.Text = pcBLL.getEditdata(info.pc_fatherid).pc_name;
            }
            lbTitle.Text  = info.pc_name;
            img1.ImageUrl = Tools.GetAppSettings("ProductImageTruePath") + info.pc_image;
            lbshow.Text   = info.pc_show.ToString();
        }
    }
Esempio n. 2
0
    public string getTitle(int id)
    {
        if (id == 0)
        {
            return("此項目為主類別");
        }
        ProductCategoryInfo info = pcBLL.getEditdata(id);

        return(info.pc_name);
    }
Esempio n. 3
0
    public void ControlStatus()
    {
        if (id != 0)
        {
            if (Tools.TryParseMethod(id.ToString()) > 0)
            {
                ProductInfo info = pBLL.GetProductForEdit(Tools.GetInt32SafeFromQueryString(this.Page, "id", 0));
                lbcategory.Text = pcBLL.getEditdata(info.pc_id).pc_name;
                if (info.p_status == 0)
                {
                    lbState.Text = "上架";
                }
                else if (info.p_status == 1)
                {
                    lbState.Text = "缺貨";
                }
                else
                {
                    lbState.Text = "下架";
                }
                lbserial.Text    = info.p_serial;
                lbTitle.Text     = info.p_name;
                lbContent.Text   = info.p_detail;
                lbPrice1.Text    = info.p_price1.ToString();
                lbPrice2.Text    = info.p_price2;
                lbprice3.Text    = info.p_price3;
                lbprice4.Text    = info.p_price4;
                lbprice5.Text    = info.p_price5;
                lbBuilddate.Text = info.p_createDate.ToString("yyyy/MM/dd HH:mm");
                lbeditdate.Text  = info.p_editDate.ToString("yyyy/MM/dd HH:mm");
                if (info.p_show)
                {
                    lbshow.Text = "顯示";
                }
                else
                {
                    lbshow.Text = "隱藏";
                }
                chkshowhot.Checked  = info.p_show_hot;
                lbstock.Text        = info.p_stock.ToString();
                lbstockunit.Text    = info.p_stock_unit;
                rpFormat.DataSource = psfBLL.GetFormatWithProduct(Tools.GetInt32SafeFromQueryString(this.Page, "id", 0));
                rpFormat.DataBind();

                rpDownload.DataSource = pdBLL.GetallFilesWithProduct(Tools.GetInt32SafeFromQueryString(this.Page, "id", 0));
                rpDownload.DataBind();

                rpImage.DataSource = piBLL.GetallImgWithProduct(Tools.GetInt32SafeFromQueryString(this.Page, "id", 0));
                rpImage.DataBind();
            }
        }
    }
Esempio n. 4
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     if (!Directory.Exists(Server.MapPath("ProductImageTruePath")))
     {
         System.IO.Directory.CreateDirectory(Server.MapPath("~/ImageCollection/product/"));
     }
     if (pcBLL.SearchHierarchyDownVail(Tools.TryParseMethod(ddlCategory.SelectedValue), id, int.Parse(UserInfoConfig.GetUserConfig("HierarchyProductCategory"))))
     {
         if (hfImg.Value != Image1.AlternateText)
         {
             System.IO.FileInfo file = new System.IO.FileInfo(Server.MapPath(Image1.ImageUrl));
             file.CopyTo(Server.MapPath(Tools.GetAppSettings("ProductImageTruePath") + Image1.AlternateText));
             if (System.IO.File.Exists(Server.MapPath(Tools.GetAppSettings("ProductImageTruePath") + hfImg.Value)))
             {
                 System.IO.File.Delete(Server.MapPath(Tools.GetAppSettings("ProductImageTruePath") + hfImg.Value));
             }
         }
         ProductCategoryInfo info = pcBLL.getEditdata(id);
         info.pc_fatherid = Tools.TryParseMethod(ddlCategory.SelectedValue);
         info.pc_name     = txtName.Text;
         info.pc_image    = Image1.AlternateText;
         info.pc_show     = bool.Parse(rbShow.SelectedValue);
         if (pcBLL.Update(info) > 0)
         {
             Response.Redirect("List.aspx?header=" + Getmessage("30014"), true);
         }
         else
         {
             ShowMessage("更新失敗: 更新類別不可為自身、不可為自身以下的子類別");
         }
     }
     else
     {
         ShowMessage("轉換類別超越階層限制數");
     }
 }