protected void dgOrders_ItemDataBound(object sender, DataGridItemEventArgs e)
        {
            DataGridItem item = e.Item;

            if (item.ItemIndex > -1 && item.DataItem is ClientOrderDetailsViewBO)
            {
                ClientOrderDetailsViewBO objClientOrder = (ClientOrderDetailsViewBO)item.DataItem;

                Label lblOrderDate = (Label)item.FindControl("lblOrderDate");
                lblOrderDate.Text = ((DateTime)objClientOrder.Date).ToString("dd MMM yyyy");

                Label lblDesiredDate = (Label)item.FindControl("lblDesiredDate");
                //SDU lblDesiredDate.Text = ((DateTime)objClientOrder.DesiredDeliveryDate).ToString("dd MMM yyyy");

                Label lblVlNumber = (Label)item.FindControl("lblVlNumber");
                lblVlNumber.Text = objClientOrder.NamePrefix + "" + objClientOrder.NameSuffix + " - " + objClientOrder.PatternNumber + " - " + objClientOrder.FabricNickName;

                HtmlAnchor ancVLImage = (HtmlAnchor)item.FindControl("ancVLImage");
                ancVLImage.HRef = IndicoPage.GetVLImagePath((int)objClientOrder.VisualLayoutId);
                if (File.Exists(Server.MapPath(ancVLImage.HRef)))
                {
                    ancVLImage.Attributes.Add("class", "btn-link iview preview");
                    List <float> lstVLImageDimensions = (new ImageProcess()).GetResizedImageDimension(960, 720, 420, 360);
                    if (lstVLImageDimensions.Count > 0)
                    {
                        ancVLImage.Attributes.Add("height", lstVLImageDimensions[0].ToString());
                        ancVLImage.Attributes.Add("width", lstVLImageDimensions[1].ToString());
                    }
                }
                else
                {
                    ancVLImage.Title = "Visual Layout Image Not Found";
                    ancVLImage.Attributes.Add("class", "btn-link iremove");
                }

                Label lblOrderStatus = (Label)item.FindControl("lblOrderStatus");
                lblOrderStatus.Text = objClientOrder.Status;
                //lblOrderStatus.Attributes.Add("class", objClientOrder.Status.ToLower());
                lblOrderStatus.CssClass = objClientOrder.Status.ToLower().Replace(" ", "");

                HtmlAnchor linkOrderQty = (HtmlAnchor)item.FindControl("linkOrderQty");
                linkOrderQty.Attributes.Add("qid", objClientOrder.OrderDetailId.ToString());

                HyperLink linkEditView = (HyperLink)item.FindControl("linkEditView");
                linkEditView.CssClass    = "btn-link " + (((bool)objClientOrder.IsTemporary) ? "iedit" : "iview");
                linkEditView.ToolTip     = (((bool)objClientOrder.IsTemporary) ? "Edit Order" : "View Order");
                linkEditView.NavigateUrl = "AddEditClientOrder.aspx?id=" + objClientOrder.OrderId.ToString();
            }
        }
Beispiel #2
0
        protected void rptOrderDetails_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            RepeaterItem item = e.Item;

            if (item.ItemIndex > -1 && item.DataItem is OrderDetailBO)
            {
                OrderDetailBO objOrderDetail = (OrderDetailBO)item.DataItem;

                CheckBox chkOrderDetail  = (CheckBox)item.FindControl("chkOrderDetail");
                Label    lblVisualLayout = (Label)item.FindControl("lblVisualLayout");
                lblVisualLayout.Text = objOrderDetail.objVisualLayout.NamePrefix + " / " + objOrderDetail.objPattern.Number + " " + objOrderDetail.objPattern.NickName + " / " + objOrderDetail.objFabricCode.Code + " " + objOrderDetail.objFabricCode.Name;


                HtmlAnchor         ancVLImage   = (HtmlAnchor)item.FindControl("ancVLImage");
                HtmlGenericControl ivlimageView = (HtmlGenericControl)item.FindControl("ivlimageView");

                ancVLImage.HRef = IndicoPage.GetVLImagePath((int)objOrderDetail.VisualLayout);

                if (!string.IsNullOrEmpty(ancVLImage.HRef))
                {
                    ancVLImage.Attributes.Add("class", "btn-link preview");
                    ivlimageView.Attributes.Add("class", "icon-eye-open");

                    List <float> lstVLImageDimensions = (new ImageProcess()).GetResizedImageDimension(960, 720, 420, 360);
                    if (lstVLImageDimensions.Count > 0)
                    {
                        ancVLImage.Attributes.Add("height", lstVLImageDimensions[0].ToString());
                        ancVLImage.Attributes.Add("width", lstVLImageDimensions[1].ToString());
                    }
                }
                else
                {
                    ancVLImage.Title = "Visual Layout Image Not Available";
                    ivlimageView.Attributes.Add("class", "icon-eye-close");
                }

                HiddenField ODID = (HiddenField)item.FindControl("hdnODID");
                ODID.Value = objOrderDetail.ID.ToString();
            }
        }
        protected void RadGridVisualLayouts_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                var item = e.Item as GridDataItem;

                if ((item.ItemIndex > -1 && item.DataItem is VisualLayoutDetailsView))
                {
                    try
                    {
                        VisualLayoutDetailsView objVisualLayoutDetails = (VisualLayoutDetailsView)item.DataItem;

                        HtmlAnchor         ancMainImage = (HtmlAnchor)item.FindControl("ancMainImage");
                        HtmlGenericControl iVlimageView = (HtmlGenericControl)item.FindControl("iVlimageView");

                        if (!string.IsNullOrEmpty(objVisualLayoutDetails.FileName + objVisualLayoutDetails.Extension))
                        {
                            ancMainImage.Title = "Visual Layout Image";
                            ancMainImage.HRef  = IndicoPage.GetVLImagePath(objVisualLayoutDetails.VisualLayout, objVisualLayoutDetails.FileName, objVisualLayoutDetails.Extension);

                            ancMainImage.Attributes.Add("class", "btn-link preview");
                            iVlimageView.Attributes.Add("class", "icon-eye-open");

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

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

                                if (lstVLImageDimensions.Count > 0)
                                {
                                    ancMainImage.Attributes.Add("height", lstVLImageDimensions[0].ToString());
                                    ancMainImage.Attributes.Add("width", lstVLImageDimensions[1].ToString());
                                }
                            }
                            catch (Exception ex)
                            {
                                ancMainImage.Title = "Visual Layout Image Not Found";
                                iVlimageView.Attributes.Add("class", "icon-eye-close");
                            }
                        }
                        else
                        {
                            ancMainImage.Title = "Visual Layout Image Not Found";
                            iVlimageView.Attributes.Add("class", "icon-eye-close");
                        }

                        Literal lblIsGenerated = (Literal)item.FindControl("lblIsGenerated");
                        //lblIsGenerated.Text = (objVisualLayoutDetails.)

                        HyperLink lnkEdit = (HyperLink)item.FindControl("lnkEdit");
                        lnkEdit.NavigateUrl = "AddEditVisualLayout.aspx?id=" + objVisualLayoutDetails.VisualLayout.ToString();

                        HyperLink linkDelete = (HyperLink)item.FindControl("linkDelete");
                        linkDelete.Attributes.Add("qid", objVisualLayoutDetails.VisualLayout.ToString());

                        linkDelete.Visible = objVisualLayoutDetails.CanDelete ?? false;

                        DropDownList ddlResolutionProfile = (DropDownList)item.FindControl("ddlResolutionProfile");
                        DropDownList ddlPrinter           = (DropDownList)item.FindControl("ddlPrinter");

                        ddlResolutionProfile.Items.Add(new ListItem("Select Resolution Profile", "0"));
                        ddlPrinter.Items.Add(new ListItem("Select Printer", "0"));

                        ddlResolutionProfile.Attributes.Add("vlid", objVisualLayoutDetails.VisualLayout.ToString());
                        ddlPrinter.Attributes.Add("vlid", objVisualLayoutDetails.VisualLayout.ToString());

                        foreach (ResolutionProfileBO res in ResolutionProfile_Source)
                        {
                            ddlResolutionProfile.Items.Add(new ListItem(res.Name, res.ID.ToString()));
                        }

                        foreach (PrinterBO printer in Printer_Source)
                        {
                            ddlPrinter.Items.Add(new ListItem(printer.Name, printer.ID.ToString()));
                        }

                        ddlResolutionProfile.Items.FindByValue(objVisualLayoutDetails.ResolutionProfile.ToString()).Selected = true;
                        ddlPrinter.Items.FindByValue(objVisualLayoutDetails.Printer.ToString()).Selected = true;
                    }
                    catch (Exception ex)
                    {
                    }
                }
            }
        }