private void PopulateEmbroideryImage(int id = 0)
        {
            this.dvEmbroideryImagePreview.Visible  = false;
            this.dvEmbroideryEmbProImage.Visible   = false;
            this.dvEmptyContentEmbReqImage.Visible = false;
            string imagepathreq  = string.Empty;
            string imageprocpath = string.Empty;

            this.dvRequestedImage.Visible = true;
            this.dvProducedImage.Visible  = true;
            this.liProducedImage.Visible  = true;
            this.liRequestedImage.Visible = true;

            if (id > 0)
            {
                // Requested Image
                EmbroideryImageBO objEmbroideryImage = new EmbroideryImageBO();
                objEmbroideryImage.EmbroideryDetails = id;


                List <EmbroideryImageBO> lstReqImage = objEmbroideryImage.SearchObjects().Where(o => o.IsRequested == true).ToList();

                if (lstReqImage.Count > 0)
                {
                    imagepathreq = IndicoConfiguration.AppConfiguration.DataFolderName + "/EmbroideryImages/" + "/" + id.ToString() + "/" + lstReqImage[0].Filename + lstReqImage[0].Extension;

                    if (!File.Exists(Server.MapPath(imagepathreq)))
                    {
                        imagepathreq = IndicoConfiguration.AppConfiguration.DataFolderName + "/noimage-png-350px-350px.png";
                    }

                    System.Drawing.Image VLOrigImage = System.Drawing.Image.FromFile(IndicoConfiguration.AppConfiguration.PathToProjectFolder + "\\" + imagepathreq);
                    SizeF origImageSize = VLOrigImage.PhysicalDimension;
                    VLOrigImage.Dispose();

                    List <float> lstImgDimensions = (new ImageProcess()).GetResizedImageDimensionForHeight(Convert.ToInt32(Math.Abs(origImageSize.Width)), Convert.ToInt32(Math.Abs(origImageSize.Height)), 300);


                    //lblItemName.Text = lstPatternTemplates[0].Filename;

                    this.linkDeleteRequested.Attributes.Add("qid", lstReqImage[0].ID.ToString());
                    imgEmbroiderRequested.ImageUrl        = imagepathreq;
                    imgEmbroiderRequested.Width           = int.Parse(lstImgDimensions[1].ToString());
                    imgEmbroiderRequested.Height          = int.Parse(lstImgDimensions[0].ToString());
                    this.dvEmbroideryImagePreview.Visible = true;
                    this.dvRequestedImage.Visible         = false;
                }
                else
                {
                    imgEmbroiderRequested.ImageUrl = IndicoConfiguration.AppConfiguration.DataFolderName + "/noimage-png-350px-350px.png";
                    this.dvRequestedImage.Visible  = true;
                    this.liRequestedImage.Visible  = false;
                }

                // Procedure Image

                List <EmbroideryImageBO> lstProImage = objEmbroideryImage.SearchObjects().Where(o => o.IsRequested == false).ToList();

                if (lstProImage.Count > 0)
                {
                    imageprocpath = IndicoConfiguration.AppConfiguration.DataFolderName + "/EmbroideryImages/" + "/" + id.ToString() + "/" + lstProImage[0].Filename + lstProImage[0].Extension;

                    if (!File.Exists(Server.MapPath(imageprocpath)))
                    {
                        imageprocpath = IndicoConfiguration.AppConfiguration.DataFolderName + "/noimage-png-350px-350px.png";
                    }

                    System.Drawing.Image VLOrigImage = System.Drawing.Image.FromFile(IndicoConfiguration.AppConfiguration.PathToProjectFolder + "\\" + imageprocpath);
                    SizeF origImageSize = VLOrigImage.PhysicalDimension;
                    VLOrigImage.Dispose();

                    List <float> lstImgDimensions = (new ImageProcess()).GetResizedImageDimensionForHeight(Convert.ToInt32(Math.Abs(origImageSize.Width)), Convert.ToInt32(Math.Abs(origImageSize.Height)), 300);


                    //lblItemName.Text = lstPatternTemplates[0].Filename;

                    this.linkDeleteProduced.Attributes.Add("qid", lstProImage[0].ID.ToString());
                    imgEmbroideryProduced.ImageUrl        = imageprocpath;
                    imgEmbroideryProduced.Width           = int.Parse(lstImgDimensions[1].ToString());
                    imgEmbroideryProduced.Height          = int.Parse(lstImgDimensions[0].ToString());
                    this.dvEmbroideryImagePreview.Visible = true;
                    this.dvProducedImage.Visible          = false;
                }
                else
                {
                    imgEmbroideryProduced.ImageUrl = IndicoConfiguration.AppConfiguration.DataFolderName + "/noimage-png-350px-350px.png";
                    this.dvProducedImage.Visible   = true;
                    this.liRequestedImage.Visible  = false;
                }
            }

            ViewState["isCompareImage"] = false;
        }
        protected void dgEmbroiderDetails_ItemDataBound(object sender, DataGridItemEventArgs e)
        {
            DataGridItem item = e.Item;

            if (item.ItemIndex > -1 && item.DataItem is EmbroideryDetailsBO)
            {
                EmbroideryDetailsBO objEmbroiderDetails = (EmbroideryDetailsBO)item.DataItem;

                Literal litLocation = (Literal)item.FindControl("litLocation");
                litLocation.Text = objEmbroiderDetails.Location;

                Literal litFabricType = (Literal)item.FindControl("litFabricType");
                litFabricType.Text = objEmbroiderDetails.objFabricType.Name;

                HtmlGenericControl dvFabricColor = (HtmlGenericControl)item.FindControl("dvFabricColor");
                dvFabricColor.Attributes.Add("style", (objEmbroiderDetails.FabricColor > 0) ? "background-color: " + objEmbroiderDetails.objFabricColor.ColorValue.ToString() : "background-color:#FFFFFF");

                Literal litWidth = (Literal)item.FindControl("litWidth");
                litWidth.Text = Convert.ToDecimal(objEmbroiderDetails.Width.ToString()).ToString("0.00");

                Literal litHeight = (Literal)item.FindControl("litHeight");
                litHeight.Text = Convert.ToDecimal(objEmbroiderDetails.Height.ToString()).ToString("0.00");

                Literal litStatus = (Literal)item.FindControl("litStatus");
                litStatus.Text = objEmbroiderDetails.objStatus.Name;

                Literal litNotes = (Literal)item.FindControl("litNotes");
                litNotes.Text = objEmbroiderDetails.Notes;

                HtmlAnchor         ancProducedIamge = (HtmlAnchor)item.FindControl("ancProducedIamge");
                HtmlGenericControl iProimageView    = (HtmlGenericControl)item.FindControl("iProimageView");

                // Procedure Image
                EmbroideryImageBO objEmbroideryImage = new EmbroideryImageBO();
                objEmbroideryImage.EmbroideryDetails = objEmbroiderDetails.ID;


                List <EmbroideryImageBO> lstProImage = objEmbroideryImage.SearchObjects().Where(o => o.IsRequested == false).ToList();


                if (lstProImage.Count > 0)
                {
                    ancProducedIamge.HRef = IndicoConfiguration.AppConfiguration.DataFolderName + "/EmbroideryImages/" + "/" + objEmbroiderDetails.ID.ToString() + "/" + lstProImage[0].Filename + lstProImage[0].Extension;

                    if (!File.Exists(Server.MapPath(ancProducedIamge.HRef)))
                    {
                        ancProducedIamge.HRef = IndicoConfiguration.AppConfiguration.DataFolderName + "/noimage-png-350px-350px.png";
                    }

                    ancProducedIamge.Attributes.Add("class", "btn-link preview");
                    iProimageView.Attributes.Add("class", "icon-eye-open");
                    List <float> lstProcImageDimensions = (new ImageProcess()).GetResizedImageDimension(960, 720, 420, 360);
                    if (lstProcImageDimensions.Count > 0)
                    {
                        ancProducedIamge.Attributes.Add("height", lstProcImageDimensions[0].ToString());
                        ancProducedIamge.Attributes.Add("width", lstProcImageDimensions[1].ToString());
                    }
                }
                else
                {
                    ancProducedIamge.Title = "Produced Image Not Found";
                    iProimageView.Attributes.Add("class", "icon-eye-close");
                }

                // <! --------- / ----------------->


                // Requested Image

                HtmlAnchor         ancRequestedIamge = (HtmlAnchor)item.FindControl("ancRequestedIamge");
                HtmlGenericControl iReqimageView     = (HtmlGenericControl)item.FindControl("iReqimageView");

                List <EmbroideryImageBO> lstReqImage = objEmbroideryImage.SearchObjects().Where(o => o.IsRequested == true).ToList();

                if (lstReqImage.Count > 0)
                {
                    ancRequestedIamge.HRef = IndicoConfiguration.AppConfiguration.DataFolderName + "/EmbroideryImages/" + "/" + objEmbroiderDetails.ID.ToString() + "/" + lstReqImage[0].Filename + lstReqImage[0].Extension;

                    if (!File.Exists(Server.MapPath(ancRequestedIamge.HRef)))
                    {
                        ancRequestedIamge.HRef = IndicoConfiguration.AppConfiguration.DataFolderName + "/noimage-png-350px-350px.png";
                    }

                    ancRequestedIamge.Attributes.Add("class", "btn-link preview");
                    iReqimageView.Attributes.Add("class", "icon-eye-open");
                    List <float> lstProcImageDimensions = (new ImageProcess()).GetResizedImageDimension(960, 720, 420, 360);
                    if (lstProcImageDimensions.Count > 0)
                    {
                        ancRequestedIamge.Attributes.Add("height", lstProcImageDimensions[0].ToString());
                        ancRequestedIamge.Attributes.Add("width", lstProcImageDimensions[1].ToString());
                    }
                }
                else
                {
                    ancRequestedIamge.Title = "Requested Image Not Found";
                    iReqimageView.Attributes.Add("class", "icon-eye-close");
                }


                // <! --------- / ----------------->

                HtmlAnchor linkCompare = (HtmlAnchor)item.FindControl("linkCompare");
                linkCompare.Attributes.Add("qid", objEmbroiderDetails.ID.ToString());

                HtmlAnchor linkEdit = (HtmlAnchor)item.FindControl("linkEdit");
                linkEdit.Attributes.Add("qid", objEmbroiderDetails.ID.ToString());

                HyperLink linkDelete = (HyperLink)item.FindControl("linkDelete");
                linkDelete.Attributes.Add("qid", objEmbroiderDetails.ID.ToString());
            }
        }