private bool LoadTemplate()
        {
            var templates = _templateBLl.GetTemplates();

            var optionList = new List <ComboOptionItem>();

            foreach (var template in templates)
            {
                ComboOptionItem item = new ComboOptionItem
                {
                    Id   = template.TemplateId.ToString(),
                    Name = template.TemplateName,
                    Code = template.TemplateId.ToString(),
                    Data = template,
                };

                optionList.Add(item);
            }

            var templateOption = new ComboOption
            {
                Items = optionList
            };

            if (optionList.Count > 0)
            {
                templateOption.Name     = optionList[0].Name;
                templateOption.Selected = optionList[0].Id;
            }
            ;

            ComboBoxUtil.SetComboBox(this.cbTemplate, templateOption);

            return(true);
        }
        private void LoadTemplates(int templateId)
        {
            var         templates   = _templateBLL.GetTemplates();
            ComboOption comboOption = new ComboOption
            {
                Items = new List <ComboOptionItem>()
            };

            if (templates != null && templates.Count > 0)
            {
                foreach (var template in templates)
                {
                    ComboOptionItem item = new ComboOptionItem
                    {
                        Id   = string.Format("{0}", template.TemplateId),
                        Name = template.TemplateName
                    };

                    comboOption.Items.Add(item);
                }
            }

            ComboBoxUtil.SetComboBox(this.cbTemplate, comboOption);
            ComboBoxUtil.SetComboBoxSelect(this.cbTemplate, templateId.ToString());
        }
        private void LoadStockTemplate()
        {
            var templates = _templateBLL.GetTemplates();

            if (templates == null || templates.Count == 0)
            {
                return;
            }

            ComboOption cbOption = new ComboOption
            {
                Items = new List <ComboOptionItem>()
            };

            foreach (var p in templates)
            {
                ComboOptionItem item = new ComboOptionItem
                {
                    Id   = p.TemplateId.ToString(),
                    Data = p,
                    Name = string.Format("{0} {1}", p.TemplateId, p.TemplateName)
                };

                cbOption.Items.Add(item);
            }

            cbOption.Selected = cbOption.Items[0].Id;
            ComboBoxUtil.SetComboBox(this.cbStockTemplate, cbOption);
        }
Example #4
0
        private void LoadAllData()
        {
            _tempDataSource.Clear();
            _spotDataSource.Clear();

            var items = _templateBLL.GetTemplates();

            if (items != null)
            {
                foreach (var item in items)
                {
                    _tempDataSource.Add(item);
                }

                if (items.Count > 0)
                {
                    LoadTemplateStock(items[0].TemplateId);
                }
            }

            _securityInfoList = SecurityInfoManager.Instance.Get();
            _benchmarkList    = _benchmarkBLL.GetAll();

            SetCurrentTemplate();
        }
        private bool Form_LoadData(object sender, object data)
        {
            _tempDataSource.Clear();
            _spotDataSource.Clear();

            var items = _templateBLL.GetTemplates();

            if (items != null)
            {
                foreach (var item in items)
                {
                    _tempDataSource.Add(item);
                }

                if (items.Count > 0)
                {
                    LoadTemplateStock(items[0].TemplateId);
                }
            }

            _securityInfoList = SecurityInfoManager.Instance.Get();
            _benchmarkList    = _benchmarkBLL.GetAll();

            SetCurrentTemplate();

            return(true);
        }