Exemple #1
0
        private void initTareLists()
        {
            DataTable tareTable;
            if (!Program.AramisSystem.GetTareTable(out tareTable))
                {
                return;
                }

            var traysDictionary = new Dictionary<long, CatalogItem>();
            var linersDictionary = new Dictionary<long, CatalogItem>();

            foreach (DataRow row in tareTable.Rows)
                {
                var item = new CatalogItem()
                    {
                        Description = row["Description"].ToString(),
                        Id = Convert.ToInt64(row["Id"])
                    };
                if (item.Id == 0)
                    {
                    continue;
                    }

                const int TRAY_TARE_TYPE = 1;
                const int LINER_TARE__TYPE = 2;
                switch (Convert.ToInt32(row["TareType"]))
                    {
                    case TRAY_TARE_TYPE:
                        if (!traysDictionary.ContainsKey(item.Id))
                            {
                            traysDictionary.Add(item.Id, item);
                            }
                        break;

                    case LINER_TARE__TYPE:
                        if (!linersDictionary.ContainsKey(item.Id))
                            {
                            linersDictionary.Add(item.Id, item);
                            }
                        break;
                    }
                }

            if (traysDictionary.Count > 0)
                {
                Repository.traysDictionary = traysDictionary;
                traysList = traysDictionary.Values.ToList();

                traysList.Insert(0, new CatalogItem() { Description = "без піддону", Id = 0 });
                }

            if (linersDictionary.Count > 0)
                {
                Repository.linersDictionary = linersDictionary;
                linersList = linersDictionary.Values.ToList();

                linersList.Insert(0, new CatalogItem() { Description = "без прокладки", Id = 0 });
                }
        }
Exemple #2
0
 public void CopyFrom(CatalogItem item)
 {
     if (item == null)
         {
         Id = 0;
         Description = string.Empty;
         }
     else
         {
         Id = item.Id;
         Description = item.Description;
         }
 }
Exemple #3
0
        protected bool SelectFromList(List<CatalogItem> list, int selectedIndex, int rowHeight, out CatalogItem selectedItem)
        {
            var _selectingItemForm = new WMS_client.Base.Visual.SelectingItem();
            _selectingItemForm.SetRowHeight(rowHeight);
            _selectingItemForm.DataSource = list;
            _selectingItemForm.SelectedIndex = selectedIndex;

            this.selectingItemForm = _selectingItemForm;
            selectingFromList = true;
            var selectResult = _selectingItemForm.ShowDialog();
            selectingFromList = false;
            this.selectingItemForm = null;

            if (selectResult == DialogResult.OK)
                {
                selectedItem = list[_selectingItemForm.SelectedIndex < 0 ? 0 : _selectingItemForm.SelectedIndex];
                return true;
                }

            selectedItem = null;
            return false;
        }
Exemple #4
0
 protected bool SelectFromList(List<CatalogItem> list, int selectedIndex, out CatalogItem selectedItem)
 {
     const int defaultRowHeight = 25;
     return SelectFromList(list, selectedIndex, defaultRowHeight, out selectedItem);
 }
Exemple #5
0
 protected bool SelectFromList(List<CatalogItem> list, out CatalogItem selectedItem)
 {
     return SelectFromList(list, -1, out selectedItem);
 }