private void GetMatChange() { var result = _db.GetMatChange(_mat_id).ToList(); GetMatChangeBS.DataSource = result; tree.RemoveAll(r => r.ParentId == 3); foreach (var item in result) { var node = new CatalogTreeList { Id = tree.Max(m => m.Id) + 1, ParentId = 4, Text = item.MatChangeName, ImgIdx = 14, TabIdx = 3, DataSetId = item.ChangeId }; TreeListBS.Add(node); } DirTreeList.RefreshDataSource(); DirTreeList.ExpandAll(); }
private void frmMatGroupEdit_Load(object sender, EventArgs e) { xtraTabControl1.ShowTabHeader = DevExpress.Utils.DefaultBoolean.False; TreeListBS.Add(new CatalogTreeList { Id = 0, ParentId = 255, Text = "Основна інформація", ImgIdx = 0, TabIdx = 0 }); TreeListBS.Add(new CatalogTreeList { Id = 1, ParentId = 255, Text = "Ціноутворення ", ImgIdx = 1, TabIdx = 1 }); TreeListBS.Add(new CatalogTreeList { Id = 2, ParentId = 255, Text = "Оподаткування", ImgIdx = 2, TabIdx = 2 }); TreeListBS.Add(new CatalogTreeList { Id = 3, ParentId = 255, Text = "Примітка", ImgIdx = 3, TabIdx = 3 }); if (_grp_id == null) { _mg = _db.MatGroup.Add(new MatGroup { Deleted = 0, Nds = 0, PId = 0, Name = "" }); _db.SaveChanges(); _grp_id = _mg.GrpId; _mg.PId = _pid ?? _mg.GrpId; } else { _mg = _db.MatGroup.Find(_grp_id); } if (_mg != null) { checkEdit4.Checked = (_mg.GrpId == _mg.PId); GrpIdEdit.Properties.TreeList.DataSource = DB.SkladBase().MatGroup.Select(s => new { s.GrpId, s.PId, s.Name, ImageIndex = 7 }).ToList(); MatGroupDS.DataSource = _mg; } GetTreeMatPrices(); #region Init checkEdit3_CheckedChanged(sender, e); PricePanel.Enabled = false; NdsEdit.EditValue = _mg.Nds == -1 ? null : _mg.Nds; #endregion DirTreeList.ExpandAll(); }
private void GetTreeMatPrices() { tree.RemoveAll(r => r.ParentId == 1); foreach (var item in _db.GetMatGroupPriceTypes(_grp_id).ToList()) { TreeListBS.Add(new CatalogTreeList { Id = tree.Max(m => m.Id) + 1, ParentId = 1, Text = item.Name, ImgIdx = item.Dis == 1 ? 5 : 4, TabIdx = 4, DataSetId = item.PTypeId }); } }
private void frmMaterialEdit_Load(object sender, EventArgs e) { xtraTabControl1.ShowTabHeader = DevExpress.Utils.DefaultBoolean.False; TreeListBS.Add(new CatalogTreeList { Id = 0, ParentId = 255, Text = "Основна інформація", ImgIdx = 0, TabIdx = 0 }); TreeListBS.Add(new CatalogTreeList { Id = 1, ParentId = 255, Text = "Ціноутворення", ImgIdx = 1, TabIdx = 1 }); TreeListBS.Add(new CatalogTreeList { Id = 2, ParentId = 255, Text = "Додаткові одиниці виміру", ImgIdx = 12, TabIdx = 8 }); TreeListBS.Add(new CatalogTreeList { Id = 3, ParentId = 255, Text = "Оподаткування", ImgIdx = 2, TabIdx = 2 }); TreeListBS.Add(new CatalogTreeList { Id = 4, ParentId = 255, Text = "Взаємозамінність", ImgIdx = 3, TabIdx = 3 }); TreeListBS.Add(new CatalogTreeList { Id = 5, ParentId = 255, Text = "Посвідчення якості", ImgIdx = 4, TabIdx = 4 }); TreeListBS.Add(new CatalogTreeList { Id = 6, ParentId = 255, Text = "Зображення", ImgIdx = 5, TabIdx = 5 }); TreeListBS.Add(new CatalogTreeList { Id = 7, ParentId = 255, Text = "Примітка", ImgIdx = 6, TabIdx = 6 }); if (_copy_mat_id != null) { _mat_id = _db.CopyMaterial(_copy_mat_id).FirstOrDefault(); _mat = _db.Materials.Find(_mat_id); } else if (_mat_id == null) { _mat = _db.Materials.Add(new Materials() { Archived = 0, Serials = 0, MId = DBHelper.MeasuresList.FirstOrDefault(w => w.Def == 1).MId, WId = DBHelper.WhList.FirstOrDefault(w => w.Def == 1).WId, CId = DBHelper.CountersList.FirstOrDefault(w => w.Def == 1).CId, NDS = 0, GrpId = _mat_grp, DecPlaces = 4 }); _db.SaveChanges(); _mat_id = _mat.MatId; } else { _mat = _db.Materials.Find(_mat_id); _mat.DateModified = DateTime.Now; } if (_mat != null) { GrpIdEdit.Properties.TreeList.DataSource = DB.SkladBase().MatGroup.Select(s => new { s.GrpId, s.PId, s.Name, ImageIndex = 17 }).ToList(); MsrComboBox.Properties.DataSource = DBHelper.MeasuresList; WIdLookUpEdit.Properties.DataSource = DBHelper.WhList; CIdLookUpEdit.Properties.DataSource = DBHelper.CountersList; MaterialsBS.DataSource = _mat; try { pictureEdit1.EditValue = new Bitmap(new MemoryStream(_mat.BMP)); } catch { } GetTreeMatPrices(); GetMatChange(); GetMatMeasures(); } #region Init checkEdit3_CheckedChanged(sender, e); PricePanel.Enabled = false; NdsCheckEdit.Checked = _mat.NDS != -1; NdsEdit.EditValue = _mat.NDS == -1 ? null : _mat.NDS; GetNdsInfo(); #endregion }