Beispiel #1
0
    protected void RemoveThumbnails(object sender, CommandEventArgs e)
    {
        Guid  id          = new Guid((e.CommandArgument).ToString());
        books bookcontent = new books();

        if (bookcontent.DeleteThumb(id))
        {
            Thumb ImageThumb         = new Thumb();
            List <ProductThumb> list = ImageThumb.GetListbyid(ImgId.Value);
            DataList1.DataSource = list;
            DataList1.DataBind();
        }
    }
Beispiel #2
0
    protected void Upload(object sender, EventArgs e)
    {
        try
        {
            lblimg.Text = "";
            // if (ImgId.Value == string.Empty || ImgId == null)
            // {
            // lblimg.Text = "Mian image is required.";
            // return;
            // }
            lblimg.Text = "";
            //AsyncUploadStrings img = (FileUpload)imgupload;
            Byte[] imgByte = null;
            if (ThumbUpload.HasFile && ThumbUpload.PostedFile != null)
            {
                HttpPostedFile File = ThumbUpload.PostedFile;
                imgByte = new Byte[File.ContentLength];
                File.InputStream.Read(imgByte, 0, File.ContentLength);

                if (Thumb2SQLServer(ImgId.Value, File.FileName, imgByte, imgByte.Length, File.ContentType))
                {
                    Thumb ImageThumb         = new Thumb();
                    List <ProductThumb> list = ImageThumb.GetListbyid(ImgId.Value);
                    DataList1.DataSource = list;
                    DataList1.DataBind();
                    //lbl_status.Text = "Image uploaded successfully.";

                    //imag_upload.Visible = true;
                    // lbl_status.Visible = false;
                }
                else
                {
                    //  imag_upload.Visible = false
                    lblimg.Text = "Image uploaded Failed.";
                }
            }
            else
            {
                lblimg.Text = "Please choose Image(.jpg,.bmp,.gif)";
            }
        }
        catch (Exception ex)
        {
        }
    }
Beispiel #3
0
    protected void EditClick(object sender, CommandEventArgs e)
    {
        lbloutput.Text = "";
        Guid            id          = new Guid((e.CommandArgument).ToString());
        books           bookcontent = new books();
        alamaat_product item        = bookcontent.GetproductById(id);

        if (null != item)
        {
            ProductId.Value = id.ToString();
            tbname.Text     = item.productname;
            if (item.originalprice != null)
            {
                tbprice.Text = item.originalprice.ToString();
            }
            else
            {
                tbprice.Text = item.price.ToString();
            }
            ComboCategory.SelectedValue = item.category.ToString();
            tbdetails.Text = item.details;
            if (item.fileid != null)
            {
                ImgId.Value  = item.fileid.ToString();
                Img.ImageUrl = "~/ShowImage2.ashx?id=" + item.fileid;
                Thumb ImageThumb         = new Thumb();
                List <ProductThumb> list = ImageThumb.GetListbyid(ImgId.Value);
                DataList1.DataSource = list;
                DataList1.DataBind();
            }
            if (item.discount != null)
            {
                tbdiscount.Text = item.discount.ToString();
            }
            else
            {
                tbdiscount.Text = "0";
            }


            tbSaleprice.Text = item.price.ToString();
            tbname.Focus();
        }
    }
Beispiel #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string id   = Request.QueryString["id"];
            string page = Request.QueryString["page"];
            btnback.HRef = "../" + page + ".aspx";
            if (id != null)
            {
                lblid.Value = id;
                Thumb           imgthumb = new Thumb();
                alamaat_product item     = imgthumb.Getproductbyid(id);
                if (null != item)
                {
                    btncart.CommandArgument = item.id.ToString();

                    lblName.Text        = item.productname;
                    lblprice.Text       = "<b>Price Rs. </b>" + item.price.ToString();
                    thumbimage.ImageUrl = "~/ShowImage2.ashx?id=" + item.fileid;
                    imglink.HRef        = "~/ShowImage2.ashx?id=" + item.fileid;
                    lblDesc.Text        = item.details;
                    List <ProductThumb> list = imgthumb.GetListbyid(item.fileid.ToString());
                    if (list.Count > 0)
                    {
                        //thumbimage.ImageUrl = "~/ShowThumb.ashx?id=" + list[0].id;
                        // imglink.HRef = "~/ShowThumb.ashx?id=" + list[0].id;
                        List <ProductThumb> newlist = new List <ProductThumb>();
                        for (int i = 0; i < list.Count; i++)
                        {
                            if (i != 0)
                            {
                                newlist.Add(list[i]);
                            }
                        }
                        DataList1.DataSource = newlist;
                        DataList1.DataBind();
                    }
                }
            }
        }
    }