private void Images()
    {
         // Dataset containing 
        string catname ="Electricals";
        ProductImageService.serProdctImage prodimage = new ProductImageService.serProdctImage();
        DataSet dataset = prodimage.ProductImage_GetFashImgtwoForHandler(catname);
        //string x = dataset.GetXml();
        string xmlfile = dataset.GetXml();

        XslTransform xslt = new XslTransform();
        xslt.Load(Server.MapPath("~/xslt/HomeXSLTFile.xslt"));
        XPathDocument xpathdocument = new
        XPathDocument(xmlfile);
        XmlTextWriter writer = new XmlTextWriter(Console.Out);
        writer.Formatting = Formatting.Indented;

        xslt.Transform(xpathdocument, null, writer, null);
        


        //strstudentDetails = GetHtml(Server.MapPath("~/xsl/studentDetails.xsl"), strXML);

        //XPathDocument myXPathDoc = new XPathDocument(myXmlFile);
        //XslCompiledTransform myXslTrans = new XslCompiledTransform();
        //myXslTrans.Load(myStyleSheet);
        //XmlTextWriter myWriter = new XmlTextWriter("result.html", null);
        //myXslTrans.Transform(myXPathDoc, null, myWriter);
     }
    protected void btUpload1_Click(object sender, EventArgs e)
    {
        ProductImageService.serProdctImage productimages = new ProductImageService.serProdctImage();
        DataSet dataset2 = productimages.ProductImage_GetAll();


        DataRow dr2 = dataset2.Tables[0].NewRow();

        bool successfull2 = false;

        if (fromScreenToEntityProductImageTest1(dr2))
        {
            dataset2.Tables[0].Rows.Add(dr2);
            successfull2 = productimages.UpdateProdctImage(dataset2);
        }
        if (successfull2)
        {
            LabelErr.Text = "ProductImageService details was added";
            Session["productid"] = lbSessionProdId.Text;
            //Response.Redirect("ShippingDetails.aspx");

        }
        else
        {
            LabelErr.Text = "Transaction rolled back";
        }
    }
示例#3
0
    private void Images()
    {
        // Dataset containing
        string catname = "Electricals";

        ProductImageService.serProdctImage prodimage = new ProductImageService.serProdctImage();
        DataSet dataset = prodimage.ProductImage_GetFashImgtwoForHandler(catname);
        //string x = dataset.GetXml();
        string xmlfile = dataset.GetXml();

        XslTransform xslt = new XslTransform();

        xslt.Load(Server.MapPath("~/xslt/HomeXSLTFile.xslt"));
        XPathDocument xpathdocument = new
                                      XPathDocument(xmlfile);
        XmlTextWriter writer = new XmlTextWriter(Console.Out);

        writer.Formatting = Formatting.Indented;

        xslt.Transform(xpathdocument, null, writer, null);



        //strstudentDetails = GetHtml(Server.MapPath("~/xsl/studentDetails.xsl"), strXML);

        //XPathDocument myXPathDoc = new XPathDocument(myXmlFile);
        //XslCompiledTransform myXslTrans = new XslCompiledTransform();
        //myXslTrans.Load(myStyleSheet);
        //XmlTextWriter myWriter = new XmlTextWriter("result.html", null);
        //myXslTrans.Transform(myXPathDoc, null, myWriter);
    }
    protected void btUpload1_Click(object sender, EventArgs e)
    {
        ProductImageService.serProdctImage productimages = new ProductImageService.serProdctImage();
        DataSet dataset2 = productimages.ProductImage_GetAll();


        DataRow dr2 = dataset2.Tables[0].NewRow();

        bool successfull2 = false;

        if (fromScreenToEntityProductImageTest1(dr2))
        {
            dataset2.Tables[0].Rows.Add(dr2);
            successfull2 = productimages.UpdateProdctImage(dataset2);
        }
        if (successfull2)
        {
            LabelErr.Text        = "ProductImageService details was added";
            Session["productid"] = lbSessionProdId.Text;
            //Response.Redirect("ShippingDetails.aspx");
        }
        else
        {
            LabelErr.Text = "Transaction rolled back";
        }
    }
    private void populateGridViewCustomers()
    {

        int productcategoryId = 0;

        try
        {
            if (Session["productcategoryId"] != null)
                lbSesProductCat.Text = Session["productcategoryId"].ToString();

            productcategoryId = Convert.ToInt32(lbSesProductCat.Text);

        }

        catch
        {
            productcategoryId = 0;

        }



        ProductImageService.serProdctImage products = new ProductImageService.serProdctImage();
        DataSet dataset = products.ProductImage_GetFashionCategoryForPage(productcategoryId);



        if (dataset != null)
        {
            // A user can select a person from the grid
            GridViewProdSearch.AutoGenerateSelectButton = true;
            // Set the DataSet to cotrols DataSource
            GridViewProdSearch.DataSource = dataset;
            // Bind values to controls rows and columns
            GridViewProdSearch.DataBind();
            // Set control visible

            GridViewProdSearch.Visible = true;

            Image2.ImageUrl = "~/Handler/GetAroundHandler.ashx?productcategoryId=" + productcategoryId;

        }


        else
        {
            //lbErrorViewPBI.Text = "Sql sentence was not successful.";
        }
    }
    private void populateGridViewCustomers()
    {
        int productcategoryId = 0;

        try
        {
            if (Session["productcategoryId"] != null)
            {
                lbSesProductCat.Text = Session["productcategoryId"].ToString();
            }

            productcategoryId = Convert.ToInt32(lbSesProductCat.Text);
        }

        catch
        {
            productcategoryId = 0;
        }



        ProductImageService.serProdctImage products = new ProductImageService.serProdctImage();
        DataSet dataset = products.ProductImage_GetFashionCategoryForPage(productcategoryId);



        if (dataset != null)
        {
            // A user can select a person from the grid
            GridViewProdSearch.AutoGenerateSelectButton = true;
            // Set the DataSet to cotrols DataSource
            GridViewProdSearch.DataSource = dataset;
            // Bind values to controls rows and columns
            GridViewProdSearch.DataBind();
            // Set control visible

            GridViewProdSearch.Visible = true;

            Image2.ImageUrl = "~/Handler/GetAroundHandler.ashx?productcategoryId=" + productcategoryId;
        }


        else
        {
            //lbErrorViewPBI.Text = "Sql sentence was not successful.";
        }
    }
示例#7
0
    //public override void ProcessRequest(HttpContext context)
    //{

    //    context.Response.ContentType = "image/jpeg";
    //    Stream strm = ShowEmpImage();
    //    byte[] buffer = new byte[4096];
    //    int byteSeq = strm.Read(buffer, 0, 4096);


    //    while (byteSeq > 0)
    //    {
    //        context.Response.OutputStream.Write(buffer, 0, byteSeq);

    //        byteSeq = strm.Read(buffer, 0, 4096);
    //    }


    //    context.Response.BinaryWrite(buffer);
    //}


    //private Stream ShowEmpImage()
    //{


    //    ProductImageService.serProdctImage image = new ProductImageService.serProdctImage();
    //    DataSet dataset = image.ProductImage_GetImageTest();

    //    // Create a DataSet from Database
    //    bool successful = false;

    //    if (dataset.Tables[0].Rows.Count > 0)
    //    {
    //        // Move data from data row to screen
    //        DataRow dr = dataset.Tables[0].Rows[0];

    //        byte[] img = (byte[])dr["imageone"];

    //        int byteSeq = strm.Read(buffer, 0, 4096);

    //        if(successful)
    //        {

    //        }

    //    }


    //    else
    //    {
    //        //setInitialValues();
    //        //lbErrorViewPBI.Text = "No cat numb not selected";
    //    }
    //}

    //public bool IsReusable
    //{
    //    get
    //    {
    //        return false;
    //    }
    //}



    protected void btAddImage_Click1(object sender, EventArgs e)
    {
        int productimageId = 0;

        try
        {
            productimageId = Convert.ToInt32(TextBox1mage.Text);
        }

        catch
        {
            productimageId = 0;
        }



        ProductImageService.serProdctImage image = new ProductImageService.serProdctImage();
        DataSet dataset = image.ProductImage_GetImageTest(productimageId);



        if (dataset != null)
        {
            // A user can select a person from the grid
            GridViewTestImage.AutoGenerateSelectButton = true;
            // Set the DataSet to cotrols DataSource
            GridViewTestImage.DataSource = dataset;
            // Bind values to controls rows and columns
            GridViewTestImage.DataBind();
            // Set control visible


            GridViewTestImage.Visible = true;

            Image1.ImageUrl = "~/Handler/Handler.ashx?productimageId=" + productimageId;
            Image3.ImageUrl = "~/Handler/Handler.ashx?productimageId=" + productimageId;
        }


        else
        {
            //lbErrorViewPBI.Text = "Sql sentence was not successful.";
        }
    }
    //public static Image bytetoimage(Byte[] byt)
    //{
    //    MemoryStream ms = new MemoryStream(byt);
    //    Image retuimage = Image.ReferenceEqual (ms);
    //}


    private void populateGridViewCustomers()
    {

        int productimageId = 0;

        try
        {
            productimageId = Convert.ToInt32(TextBox1mage.Text);
        }

        catch
        {
            productimageId = 0;

        }


        ProductImageService.serProdctImage image = new ProductImageService.serProdctImage();
        DataSet dataset = image.ProductImage_GetImageTest(productimageId);

        //Byte[] imageData = new Byte[0];
        ////imageData = (Byte[])(dataset.Tables[0].Rows[0]["imageone"]);
        //MemoryStream stream = new MemoryStream(imageData);



        if (dataset != null)
        {
            // A user can select a person from the grid
            GridViewTestImage.AutoGenerateSelectButton = true;
            // Set the DataSet to cotrols DataSource
            GridViewTestImage.DataSource = dataset;
            // Bind values to controls rows and columns
            GridViewTestImage.DataBind();
            // Set control visible

            GridViewTestImage.Visible = true;
        }
        else
        {
            //lbErrorViewPBI.Text = "Sql sentence was not successful.";
        }
    }
示例#9
0
    //public static Image bytetoimage(Byte[] byt)
    //{
    //    MemoryStream ms = new MemoryStream(byt);
    //    Image retuimage = Image.ReferenceEqual (ms);
    //}


    private void populateGridViewCustomers()
    {
        int productimageId = 0;

        try
        {
            productimageId = Convert.ToInt32(TextBox1mage.Text);
        }

        catch
        {
            productimageId = 0;
        }


        ProductImageService.serProdctImage image = new ProductImageService.serProdctImage();
        DataSet dataset = image.ProductImage_GetImageTest(productimageId);

        //Byte[] imageData = new Byte[0];
        ////imageData = (Byte[])(dataset.Tables[0].Rows[0]["imageone"]);
        //MemoryStream stream = new MemoryStream(imageData);



        if (dataset != null)
        {
            // A user can select a person from the grid
            GridViewTestImage.AutoGenerateSelectButton = true;
            // Set the DataSet to cotrols DataSource
            GridViewTestImage.DataSource = dataset;
            // Bind values to controls rows and columns
            GridViewTestImage.DataBind();
            // Set control visible

            GridViewTestImage.Visible = true;
        }
        else
        {
            //lbErrorViewPBI.Text = "Sql sentence was not successful.";
        }
    }
    protected void btUpload2_Click(object sender, EventArgs e)
    {

        bool successful = false;
        // Dataset containing accounts
        ProductImageService.serProdctImage productimages = new ProductImageService.serProdctImage();
        DataSet dataset = productimages.ProductImage_GetAll();
        // Find the account to update
        try
        {
            foreach (DataRow dr in dataset.Tables[0].Rows)
            {
                if (dr["productimageId"].ToString() == tbProductImageId.Text.Trim())
                {
                    // Account found. Move values from screen to row
                    fromScreenToEntityProductImageTest2(dr);
                    successful = true;
                }
            }
            if (successful)
                // Update the database
                successful = productimages.UpdateProdctImage(dataset); 
        }
        catch
        {


        }

        if (successful)
        {
            LabelErr.Text = "ProductImageService details was added";
            Session["productid"] = lbSessionProdId.Text;
        }
        else
        {
            LabelErr.Text = "Transaction rolled back";
        }

    }
    protected void btUpload2_Click(object sender, EventArgs e)
    {
        bool successful = false;

        // Dataset containing accounts
        ProductImageService.serProdctImage productimages = new ProductImageService.serProdctImage();
        DataSet dataset = productimages.ProductImage_GetAll();

        // Find the account to update
        try
        {
            foreach (DataRow dr in dataset.Tables[0].Rows)
            {
                if (dr["productimageId"].ToString() == tbProductImageId.Text.Trim())
                {
                    // Account found. Move values from screen to row
                    fromScreenToEntityProductImageTest2(dr);
                    successful = true;
                }
            }
            if (successful)
            {
                // Update the database
                successful = productimages.UpdateProdctImage(dataset);
            }
        }
        catch
        {
        }

        if (successful)
        {
            LabelErr.Text        = "ProductImageService details was added";
            Session["productid"] = lbSessionProdId.Text;
        }
        else
        {
            LabelErr.Text = "Transaction rolled back";
        }
    }
    private void BindDataList()
    {
        int productcategoryId = 0;

        try
        {
            if (Session["productcategoryId"] != null)
            {
                lbSesProductCat.Text = Session["productcategoryId"].ToString();
            }

            productcategoryId = Convert.ToInt32(lbSesProductCat.Text);
        }

        catch
        {
            productcategoryId = 0;
        }

        ProductImageService.serProdctImage products = new ProductImageService.serProdctImage();
        DataSet   dataset = products.ProductImage_GetFashionCategoryForPage(productcategoryId);
        DataTable dt      = new DataTable();

        DataColumn imageCol = new DataColumn("imageone", typeof(string));

        dt.Columns.Add(imageCol);

        if (dataset != null)
        {
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                dt.Rows[i][imageCol] = string.Format("<img src='GetAroundHandler.ashx?id={0}' alt='' style='width:100px' />", dt.Rows[i][0].ToString());
            }
        }
        DataList1.DataSource = dataset;
        DataList1.DataBind();
    }
    //private bool fromScreenToEntityProductImageService(DataRow dr)
    //{
    //    try
    //    {
    //        byte[] img1 = new byte[FileUpload1.PostedFile.ContentLength];
    //        byte[] img2 = new byte[FileUpload2.PostedFile.ContentLength];
    //        byte[] img3 = new byte[FileUpload3.PostedFile.ContentLength];
    //        byte[] img4 = new byte[FileUpload4.PostedFile.ContentLength];


    //        dr["productimageId"] = Int32.Parse(tbProductImageId.Text);
    //        dr["productid"] = lbSessionProdId.Text;
    //        dr["imageone"] = img1;
    //        dr["imagetwo"] = img2;
    //        dr["imagethree"] = img3;
    //        dr["imagefour"] = img4;


    //        return true;
    //    }
    //    catch
    //    {
    //        LabelErr.Text = "Values are not correct.";
    //    }
    //    return false;
    //}

    private void CreateProductImageId()
    {
        bool successful = false;

        // Dataset containing


        ProductImageService.serProdctImage prodImageId = new ProductImageService.serProdctImage();
        DataSet dataset = prodImageId.ProductImage_CreateProductImgId();

        try
        {
            foreach (DataRow dr in dataset.Tables[0].Rows)
            {
                successful = true;
                string s = dr["productimageId"].ToString();

                tbProductImageId.Text = dr["productimageId"].ToString();
            }
        }
        catch
        {
        }
        if (successful)
        {
            //lbPBIErrorMessage.Text = "Task Id created";
            // New  list must be created
            //loadTask();
            // Initial values to screen
            //setInitialValues();
        }
        else
        {
            LabelErr.Text = "Problem with customer number";
        }
    }
    private void BindDataList()
    {
        int productcategoryId = 0;

        try
        {
            if (Session["productcategoryId"] != null)
                lbSesProductCat.Text = Session["productcategoryId"].ToString();

            productcategoryId = Convert.ToInt32(lbSesProductCat.Text);

        }

        catch
        {
            productcategoryId = 0;

        }

        ProductImageService.serProdctImage products = new ProductImageService.serProdctImage();
        DataSet dataset = products.ProductImage_GetFashionCategoryForPage(productcategoryId);
        DataTable dt = new DataTable();

        DataColumn imageCol = new DataColumn("imageone", typeof(string));
        dt.Columns.Add(imageCol);

       if (dataset != null)
        {
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                dt.Rows[i][imageCol] = string.Format("<img src='GetAroundHandler.ashx?id={0}' alt='' style='width:100px' />", dt.Rows[i][0].ToString());
            }
        }
        DataList1.DataSource = dataset;
        DataList1.DataBind();
    }
    //private bool fromScreenToEntityProductImageService(DataRow dr)
    //{
    //    try
    //    {
    //        byte[] img1 = new byte[FileUpload1.PostedFile.ContentLength];
    //        byte[] img2 = new byte[FileUpload2.PostedFile.ContentLength];
    //        byte[] img3 = new byte[FileUpload3.PostedFile.ContentLength];
    //        byte[] img4 = new byte[FileUpload4.PostedFile.ContentLength];


    //        dr["productimageId"] = Int32.Parse(tbProductImageId.Text);
    //        dr["productid"] = lbSessionProdId.Text;
    //        dr["imageone"] = img1;
    //        dr["imagetwo"] = img2;
    //        dr["imagethree"] = img3;
    //        dr["imagefour"] = img4;


    //        return true;
    //    }
    //    catch
    //    {
    //        LabelErr.Text = "Values are not correct.";
    //    }
    //    return false;
    //}

    private void CreateProductImageId()
    {
        bool successful = false;
        // Dataset containing 


        ProductImageService.serProdctImage prodImageId = new ProductImageService.serProdctImage();
        DataSet dataset = prodImageId.ProductImage_CreateProductImgId();

        try
        {
            foreach (DataRow dr in dataset.Tables[0].Rows)
            {
                successful = true;
                string s = dr["productimageId"].ToString();

                tbProductImageId.Text = dr["productimageId"].ToString();
            }
        }
        catch
        {
        }
        if (successful)
        {
            //lbPBIErrorMessage.Text = "Task Id created";
            // New  list must be created
            //loadTask();
            // Initial values to screen
            //setInitialValues();
        }
        else
        {
            LabelErr.Text = "Problem with customer number";
        }
    }
    //public override void ProcessRequest(HttpContext context)
    //{

    //    context.Response.ContentType = "image/jpeg";
    //    Stream strm = ShowEmpImage();
    //    byte[] buffer = new byte[4096];
    //    int byteSeq = strm.Read(buffer, 0, 4096);


    //    while (byteSeq > 0)
    //    {
    //        context.Response.OutputStream.Write(buffer, 0, byteSeq);

    //        byteSeq = strm.Read(buffer, 0, 4096);
    //    }


    //    context.Response.BinaryWrite(buffer);
    //}


    //private Stream ShowEmpImage()
    //{


    //    ProductImageService.serProdctImage image = new ProductImageService.serProdctImage();
    //    DataSet dataset = image.ProductImage_GetImageTest();

    //    // Create a DataSet from Database
    //    bool successful = false;

    //    if (dataset.Tables[0].Rows.Count > 0)
    //    {
    //        // Move data from data row to screen 
    //        DataRow dr = dataset.Tables[0].Rows[0];

    //        byte[] img = (byte[])dr["imageone"];

    //        int byteSeq = strm.Read(buffer, 0, 4096);

    //        if(successful)
    //        {

    //        }

    //    }


    //    else
    //    {
    //        //setInitialValues();
    //        //lbErrorViewPBI.Text = "No cat numb not selected";
    //    }
    //}

    //public bool IsReusable
    //{
    //    get
    //    {
    //        return false;
    //    }
    //}



    protected void btAddImage_Click1(object sender, EventArgs e)
    {
        int productimageId = 0;

        try
        {
            productimageId = Convert.ToInt32(TextBox1mage.Text);
           
        }

        catch
        {
            productimageId = 0;

        }



        ProductImageService.serProdctImage image = new ProductImageService.serProdctImage();
        DataSet dataset = image.ProductImage_GetImageTest(productimageId);

        

        if (dataset != null)
        {
            // A user can select a person from the grid
            GridViewTestImage.AutoGenerateSelectButton = true;
            // Set the DataSet to cotrols DataSource
            GridViewTestImage.DataSource = dataset;
            // Bind values to controls rows and columns
            GridViewTestImage.DataBind();
            // Set control visible


            GridViewTestImage.Visible = true;

            Image1.ImageUrl = "~/Handler/Handler.ashx?productimageId=" + productimageId;
            Image3.ImageUrl = "~/Handler/Handler.ashx?productimageId=" + productimageId;
        }


        else
        {
            //lbErrorViewPBI.Text = "Sql sentence was not successful.";
        }

       

    }