//Adding data to dataView
        private void AddDataItems(ASPxDataView dvMaster, int lineId, int sectionId)
        {
            AssemblySection section = ProductionRepository.GetAssemblySection(sectionId);

            List <Station> stations = new List <Station>();

            stations = ProductionRepository.GetStationsInAssemblySection(sectionId);

            if (stations.Any())
            {
                foreach (Station sta in stations)
                {
                    DataViewItem dvItem = new DataViewItem();

                    StationInfo info = new StationInfo();
                    info.StationId   = sta.Id;
                    info.StationName = sta.StationName;
                    info.SectionId   = sectionId;
                    info.LineId      = lineId;

                    info.SectionTypeId = section.AssemblySectionTypeId;
                    info.IsQGate       = sta.IsQualityGate;

                    info.Capacity = sta.Capacity;

                    info.Items = ProductionRepository.GetProductionItems(info.LineId, info.StationId);

                    dvItem.DataItem = info;

                    dvMaster.Items.Add(dvItem);
                }

                dvMaster.SettingsTableLayout.ColumnCount = stations.Count;
            }
        }
Beispiel #2
0
    protected object GetItemDetail(DataViewItem item)
    {
        Dictionary <string, object> itemDetail = new Dictionary <string, object>();

        itemDetail.Add("description", GetItemValue(item, "Description"));
        itemDetail.Add("highQualityImageUrl", GetItemValue(item, "LargeImageUrl"));
        itemDetail.Add("imageWidth", GetItemValue(item, "Width"));
        itemDetail.Add("imageHeight", GetItemValue(item, "Height"));
        return(itemDetail);
    }
    protected void UpdateMyItemsFromClient()
    {
        for (int i = 0; i < dataView.VisibleItems.Count; i++)
        {
            DataViewItem item     = dataView.Items[i];
            ASPxComboBox comboBox = (ASPxComboBox)dataView.FindItemControl("comboItemValue", item);

            Data[i].ItemValue = (int)comboBox.Value;
        }
    }
Beispiel #4
0
        protected virtual void PrepareSpanControl()
        {
            if (SpanControl == null)
            {
                return;
            }

            DataViewItem.GetControlStyle().AssignToControl(SpanControl, AttributesRange.Font);

            PrepareLiteralControl();
        }
Beispiel #5
0
        protected override void PrepareControlHierarchy()
        {
            if (MainControl == null)
            {
                return;
            }

            RenderUtils.AssignAttributes(DataViewItem, MainControl);
            RenderUtils.SetVisibility(MainControl, DataViewItem.IsClientVisible(), true);

            var controlStyle = DataViewItem.GetControlStyle();

            if (controlStyle.CssClass != "")
            {
                MainControl.CssClass = controlStyle.CssClass;
            }

            PrepareImageControl();
            PrepareSpanControl();
        }
Beispiel #6
0
 protected void LocalizeDataView(ASPxDataView view)
 {
     try
     {
         string[] idToTranslate = new string[] { "lblGeneralTitle", "lblProductName", "lblProductEan",
                                                 "lblCategory", "lblRecommendedPrice" };
         DataViewItem item = view.Items[0];
         foreach (string id in idToTranslate)
         {
             ASPxLabel ctrl = (ASPxLabel)view.FindItemControl(id, item);
             if (ctrl != null)
             {
                 ctrl.Text = Utilities.GetResourceString("Common", "Details" + id.Replace("lbl", ""));
             }
         }
     }
     catch (Exception)
     {
     }
 }
        private void AddDataItems(ASPxDataView dvMaster, List <ProductionItem> items, int sectionId)
        {
            List <DotWeb.Models.Station> stations = new List <DotWeb.Models.Station>();

            stations = ProductionRepository.GetStationsByAssemblySection(sectionId);

            if (stations.Any())
            {
                foreach (var station in stations)
                {
                    DataViewItem dvItem = new DataViewItem();

                    var  historyId    = string.Empty;
                    var  model        = string.Empty;
                    var  variant      = string.Empty;
                    var  finNo        = string.Empty;
                    var  statusId     = string.Empty;
                    bool isSubAssy    = ProductionRepository.IsSubAssemblyStation(station.Id);
                    var  subAssyCount = ProductionRepository.CountSubAssyPerSection(sectionId);

                    var prodItem = items.Where(x => x.StationId == station.Id).FirstOrDefault();
                    if (prodItem != null)
                    {
                        historyId = prodItem.ItemId.ToString();
                        model     = prodItem.ModelName;
                        variant   = prodItem.VariantName;
                        finNo     = prodItem.FINNumber;
                        statusId  = prodItem.StatusId.ToString();
                    }

                    dvItem.DataItem = new
                    {
                        HistoryId   = historyId,
                        ModelName   = model,
                        VariantName = variant,
                        FINNumber   = finNo,
                        StatusId    = statusId,
                        StationId   = station.Id,
                        StationName = station.StationName,
                        IsQGate     = station.IsQualityGate,

                        SectionId  = sectionId,
                        IsSubAssy  = isSubAssy,
                        NumSubAssy = subAssyCount
                    };

                    dvMaster.Items.Add(dvItem);
                }

                dvMaster.SettingsTableLayout.ColumnCount = stations.Count;
            }
            else
            {
                foreach (var item in items)
                {
                    DataViewItem dvItem = new DataViewItem();

                    dvItem.DataItem = new
                    {
                        HistoryId   = item.ItemId,
                        ModelName   = item.ModelName,
                        VariantName = item.VariantName,
                        FINNumber   = item.FINNumber,
                        StatusId    = item.StatusId,
                        StationId   = item.StationId,
                        StationName = item.StationName,
                        IsQGate     = false,

                        SectionId  = sectionId,
                        IsSubAssy  = false,
                        NumSubAssy = 0
                    };

                    dvMaster.Items.Add(dvItem);
                }

                dvMaster.SettingsTableLayout.ColumnCount = items.Count > 0 ? items.Count : 1;
            }
        }
        public void DrawMainLine(AppDb ctx, ProductionLine line, AssemblySectionType sectionType, bool showNewButton = false)
        {
            //Generate new div header in div master
            HtmlGenericControl divLineHeader = new HtmlGenericControl("div");

            divLineHeader.Attributes.Add("class", "div-header");

            //create button New for the Line
            if (showNewButton)
            {
                ASPxButton btnNew = new ASPxButton();
                btnNew.ID           = line.Id.ToString();
                btnNew.Text         = "New";
                btnNew.AutoPostBack = false;
                btnNew.CssClass     = "btn-new-line";
                var command = "function (s, e) {window.location = '../Production/VINNumberChecker.aspx?LineId=" + line.Id + "'}";
                btnNew.ClientSideEvents.Click = command;
                divLineHeader.Controls.Add(btnNew);
            }

            ASPxLabel lblMainLine = new ASPxLabel();

            if (sectionType.IsMultiLine)
            {
                lblMainLine.Text = line.LineName + " " + sectionType.Name;
            }
            else
            {
                lblMainLine.Text = sectionType.Name;
            }
            lblMainLine.CssClass = "label-line";

            divLineHeader.Controls.Add(lblMainLine);
            divMasterDataView.Controls.Add(divLineHeader);

            //Line content
            HtmlGenericControl divLineContent = new HtmlGenericControl("div");

            divLineContent.Attributes.Add("class", "div-section");

            divMasterDataView.Controls.Add(divLineContent);

            IQueryable <AssemblySection> mainsections = ctx.AssemblySections.Where(x => x.AssemblySectionTypeId == sectionType.Id).OrderBy(x => x.AreaNo);

            foreach (AssemblySection sect in mainsections)
            {
                IQueryable <Station> stations = ctx.Stations.Where(x => x.AssemblySectionId == sect.Id);
                if (stations.Count() == 0)
                {
                    continue;
                }

                //Assembly section label
                ASPxLabel lblSection = new ASPxLabel();
                lblSection.Text     = sect.AssemblySectionName;
                lblSection.CssClass = "label-section";

                divLineContent.Controls.Add(lblSection);

                //Generate new dataView in Dashboard
                ASPxDataView dvMaster = new ASPxDataView();

                dvMaster.ID           = "dv" + line.LineName + sect.AssemblySectionName;
                dvMaster.ItemTemplate = new StationDataViewTemplate();
                dvMaster.CssClass     = "dataview-master";

                //dvMaster.ClientSideEvents.Init = "function(s, e) { setTimeout(function() { " + cbpDashboard.ClientInstanceName + ".PerformCallback('refresh; " + sect.Id + "'); }, " + AppConfiguration.ANDON_POLL_INTERVAL_MSEC + ") }; ";

                divLineContent.Controls.Add(dvMaster);

                //Station list
                foreach (Station sta in stations)
                {
                    DataViewItem dvItem = new DataViewItem();

                    StationInfo info = new StationInfo();
                    info.StationId   = sta.Id;
                    info.StationName = sta.StationName;
                    info.SectionId   = sect.Id;
                    info.LineId      = line.Id;

                    info.SectionTypeId = sectionType.Id;
                    info.IsQGate       = sta.IsQualityGate;

                    info.Capacity = sta.Capacity;

                    info.Items = ProductionRepository.GetProductionItems(info.LineId, info.StationId);

                    dvItem.DataItem = info;

                    dvMaster.Items.Add(dvItem);

                    //add the collections of dataviewitems for easy updates
                    dvStations.Add(dvItem);
                }

                dvMaster.SettingsTableLayout.ColumnCount = (stations.Count() <= 10 ? stations.Count() : 10);
            }
        }
        public void DrawSubAssyLine(AppDb ctx, AssemblySectionType sectionType)
        {
            //Generate new div header in div master
            HtmlGenericControl divSubAssyHeader = new HtmlGenericControl("div");

            divSubAssyHeader.Attributes.Add("class", "div-header");

            ASPxLabel lblSubAssy = new ASPxLabel();

            lblSubAssy.Text     = "Sub Assembly";
            lblSubAssy.CssClass = "label-line";

            divSubAssyHeader.Controls.Add(lblSubAssy);
            divMasterDataView.Controls.Add(divSubAssyHeader);

            //SubAssy content
            HtmlGenericControl divSubAssyContent = new HtmlGenericControl("div");

            divSubAssyContent.Attributes.Add("class", "div-section");

            divMasterDataView.Controls.Add(divSubAssyContent);

            IQueryable <AssemblySection> subsections = ctx.AssemblySections.Where(x => x.AssemblySectionTypeId == sectionType.Id).OrderBy(x => x.AreaNo);

            foreach (AssemblySection sect in subsections)
            {
                IQueryable <Station> stations = ctx.Stations.Where(x => x.AssemblySectionId == sect.Id);
                if (stations.Count() == 0)
                {
                    continue;
                }

                //Assembly section label
                ASPxLabel lblSection = new ASPxLabel();
                lblSection.Text     = sect.AssemblySectionName;
                lblSection.CssClass = "label-section";

                divSubAssyContent.Controls.Add(lblSection);

                //Generate new dataView in Dashboard
                ASPxDataView dvMaster = new ASPxDataView();

                dvMaster.ID           = "dvSubAssy" + sect.AssemblySectionName;
                dvMaster.ItemTemplate = new StationDataViewTemplate();
                dvMaster.CssClass     = "dataview-master";

                //dvMaster.ClientSideEvents.Init = "function(s, e) { setTimeout(function() { " + cbpDashboard.ClientInstanceName + ".PerformCallback('refresh; " + sect.Id + "'); }, " + AppConfiguration.ANDON_POLL_INTERVAL_MSEC + ") }; ";

                divSubAssyContent.Controls.Add(dvMaster);

                //Station list
                foreach (Station sta in stations)
                {
                    DataViewItem dvItem = new DataViewItem();

                    StationInfo info = new StationInfo();
                    info.StationId   = sta.Id;
                    info.StationName = sta.StationName;
                    info.SectionId   = sect.Id;
                    info.LineId      = AppConfiguration.PRODUCTION_SUBASSY_LINENUMBER;

                    info.SectionTypeId = sectionType.Id;
                    info.IsQGate       = sta.IsQualityGate;

                    info.Capacity = sta.Capacity;

                    info.Items = ProductionRepository.GetProductionItems(info.LineId, info.StationId);

                    dvItem.DataItem = info;

                    dvMaster.Items.Add(dvItem);

                    //add the collections of dataviewitems for easy updates
                    dvStations.Add(dvItem);
                }

                dvMaster.SettingsTableLayout.ColumnCount = (stations.Count() <= 10 ? stations.Count() : 10);
            }
        }
Beispiel #10
0
 protected object GetItemValue(DataViewItem item, string fieldName)
 {
     return(DataBinder.Eval(item.DataItem, fieldName));
 }