private void ClearInfo() { _brand = ""; _category = ""; _description = ""; _model = ""; _partname = ""; _partno = ""; _status = PartStatus.Inactive; _type = PartStockingType.NonStocking; _unit = ""; }
private void GetInfo(string code) { ClearInfo(); DataTable _parts = Cache.GetCachedTable("parts"); DataTable _partnames = Cache.GetCachedTable("partnames"); DataTable _models = Cache.GetCachedTable("models"); if (_parts != null && _partnames != null) { var _query = from _part in _parts.AsEnumerable() join _names in _partnames.AsEnumerable() on _part.Field <string>("PartName") equals _names.Field <string>("PartName") join _mdl in _models.AsEnumerable() on _part.Field <string>("ModelCode") equals _mdl.Field <string>("ModelCode") into _m where _part.Field <string>("PartCode") == _partcode from _mdl in _m.DefaultIfEmpty(_models.NewRow()) select new { PartNo = _part.Field <string>("PartNo"), PartName = _part.Field <string>("PartName"), Description = _part.Field <string>("Description"), Brand = _part.Field <string>("Brand"), Model = _mdl.Field <string>("Model"), Category = _names.Field <string>("PartCategory"), Unit = _part.Field <string>("Unit"), Status = _part.Field <Int16>("Active"), Type = _part.Field <int>("StockType") }; try { foreach (var _row in _query) { if (!Materia.IsNullOrNothing(_row.PartNo)) { _partno = _row.PartNo; } if (!Materia.IsNullOrNothing(_row.PartName)) { _partname = _row.PartName; } if (!Materia.IsNullOrNothing(_row.Description)) { _description = _row.Description; } if (!Materia.IsNullOrNothing(_row.Category)) { _category = _row.Category; } if (!Materia.IsNullOrNothing(_row.Brand)) { _brand = _row.Brand; } if (!Materia.IsNullOrNothing(_row.Model)) { _model = _row.Model; } if (!Materia.IsNullOrNothing(_row.Unit)) { _unit = _row.Unit; } if (VisualBasic.IsNumeric(_row.Status)) { _status = (PartStatus)_row.Status; } if (VisualBasic.IsNumeric(_row.Type)) { _type = (PartStockingType)_row.Type; } } } catch { } } }