public void RefreshGrid() { try { var list = Categorybal.GetAll().Distinct().Where(r => r.YEARUSED == UserSettings.LogInYear).ToList(); DataTable itmTable = new DataTable(); using (var reader = ObjectReader.Create(list, "RecID", "CATCODE", "CATDESC", "MoldSetup", "LotSize", "IsDependent", "IsActive" )) { itmTable.Load(reader); mgridList.DataSource = itmTable; } dgvorig.DataSource = mgridList.DataSource; Grid.ListCheck(mgridList, listTS); tslblRowCount.Text = "Number of Records: " + list.Count + " "; } catch (Exception ex) { MessageHelpers.ShowError(ex.Message); } }
private void FillComboBoxes() { try { //Categories ListHelper.FillMetroCombo(mcboCategory, catbal.GetAll().Select(i => new { i.CATCODE }).Distinct().ToList(), "CATCODE", "CATCODE"); mcboCategory.SelectedIndex = -1; //First Year ListHelper.FillMetroCombo(mcbofrstYear, yrbal.GetAll().Select(i => new { i.RecYear }).Distinct().ToList(), "RecYear", "RecYear"); mcbofrstYear.SelectedValue = UserSettings.LogInYear; //Second Year ListHelper.FillMetroCombo(mcboscndYear, yrbal.GetAll().Select(i => new { i.RecYear }).Distinct().ToList(), "RecYear", "RecYear"); var yearlist = yrbal.GetAll().Select(s => s.RecYear).ToList(); if (yearlist.Contains(UserSettings.LogInYear - 1)) { mcboscndYear.SelectedValue = UserSettings.LogInYear - 1; } else if (yearlist.Contains(UserSettings.LogInYear + 1)) { mcboscndYear.SelectedValue = UserSettings.LogInYear + 1; } else { mcboscndYear.SelectedIndex = 0; } } catch (Exception ex) { MessageHelpers.ShowError(ex.Message); } }
private void RefreshCBox() { try { ListHelper.FillMetroCombo(mcboYear, catbal.GetAll().Select(i => new { i.YEARUSED }).Distinct().OrderByDescending(m => m.YEARUSED).Where(i => i.YEARUSED != UserSettings.LogInYear && i.YEARUSED < UserSettings.LogInYear).ToList(), "YEARUSED", "YEARUSED"); } catch (Exception ex) { MessageHelpers.ShowError(ex.Message); } }
public ActionResult GetAll() { var categoryGroupBAL = new CategoryGroupBAL(); var lstCateGroup = categoryGroupBAL.GetAll(); var categoryBAL = new CategoryBAL(); var lstCategory = categoryBAL.GetAll(); var model = new AllCategoryModel(); model.LstCategory = lstCategory; model.LstCategoryGroup = lstCateGroup; return(View(model)); }
private void GetComponents() { try { FormHelpers.CursorWait(true); var itemno = BPSUtilitiesV1.NZ(mtxtItemNo.Text, "").ToString(); var partscode = BPSUtilitiesV1.NZ(mtxtPartCode.Text, "").ToString(); ListHelper.FillMetroCombo(mcboCatCode, catbal.GetAll().Select(i => new { i.CATCODE, i.CATDESC }). Where(w => w.CATCODE == "BULK").Distinct().ToList(), "CATCODE", "CATCODE"); var catcode = BPSUtilitiesV1.NZ(mcboCatCode.SelectedValue, "").ToString(); item = itembal.GetWithCat(UserSettings.LogInYear, itemno, catcode); GetRefCompDetails(); if (item != null && item.itemCom.Count > 0) { if (partscode != "") { itemcom = item.itemCom.Where(w => w.PartNo == partscode).OrderBy(o => o.ItemAddress).FirstOrDefault(); if (itemcom != null) { var sourceTable = item.itemCom.Where(w => w.ItemAddress.StartsWith(itemcom.ItemAddress) && w.ItemAddress != itemcom.ItemAddress).ToList(); using (var reader = ObjectReader.Create(sourceTable, "DocID", "MatCode", "MatDescription", "ItemUsage", "UnitPrice", "Amount", "Address")) { dt.Load(reader); mgridMatList.DataSource = dt; } } } } } catch (Exception ex) { MessageHelpers.ShowError(ex.Message); } finally { FormHelpers.CursorWait(false); } }
public void RefreshGrid() { try { switch (KindOfList) { #region Materials/ Compo case "CL": var list_CL = combal.GetAll().Select(i => new { i.DocID, i.YEARUSED, Part_No = i.PartNo, Name = i.PartName, Whddd_Qty = i.WholeQty, Whddd_Unit = i.WholeUnit, Conddd_Qty = i.ConversionQty, Conddd_Unit = i.ConversionUnit, Whddd_Price = i.WholePrice, Conddd_Price = i.ConversionPrice, Prevddd_Price = i.PreviousPrice, Locked = i.IsLocked, } ).OrderBy(m => m.DocID).Where(r => r.YEARUSED == UserSettings.LogInYear).ToList(); this.mgridList.DataSource = list_CL; break; #endregion #region Plastic Injection case "MT_PI": var list_PI = pibal.GetAll().Select(i => new { i.DocID, i.YEARUSED, Mold_No = i.MoldNo, Mold_Name = i.MoldName, i.Oz, Purge_Per_Gram = i.PurgePerG, Shots_Per_Hour = i.SPH, Cavity = i.Cavity, Pieces_Per_Hour = i.PPH, }).OrderBy(m => m.DocID).Where(r => r.YEARUSED == UserSettings.LogInYear).ToList(); mgridList.DataSource = list_PI; break; #endregion #region Vacuum Plating case "MT_VP": var list_VP = vpbal.GetAll().Select(i => new { DocID = i.DocID, YEARUSED = i.YEARUSED, Part_No = i.PartNo, Part_Name = i.PartName, Source_Data = i.SourceData, }).OrderBy(m => m.DocID).Where(r => r.YEARUSED == UserSettings.LogInYear).ToList(); mgridList.DataSource = list_VP; break; #endregion #region Assymbly case "MT_ASSY": var list_ASSY = assybal.GetAll().Select(i => new { DocID = i.DocID, YEARUSED = i.YEARUSED, Part_No = i.PartNo, Part_Name = i.PartName, Rate_Per_Hour = i.RATEPERHOUR, }).OrderBy(m => m.DocID).Where(r => r.YEARUSED == UserSettings.LogInYear).ToList(); mgridList.DataSource = list_ASSY; break; #endregion #region MPT case "MPT": var list_MR = mrbal.GetAll().Select(i => new { Code = i.SectionCode, Description = i.Description, Time = i.Time, Active = i.IsActive, IsCosting = i.IsCosting }).Distinct().OrderBy(m => m.Code).ToList(); this.mgridList.DataSource = list_MR; break; #endregion #region Items case "ITEM": int yeartouse = UserSettings.LogInYear; if (IsPrevious) { yeartouse = PreviousYear; } var list_ITEM = itembal.GetAll().Select(i => new { i.DocID, i.YEARUSED, i.ItemNo, i.Description, i.IsLocked }).Where(w => w.YEARUSED == yeartouse).Distinct().OrderBy(m => m.Description).ToList(); DataTable itmTable = new DataTable(); using (var reader = ObjectReader.Create(list_ITEM, "DocID", "YEARUSED", "ItemNo", "Description", "IsLocked")) { itmTable.Load(reader); mgridList.DataSource = itmTable; } break; #endregion #region case "CAT": var list_CAT = catbal.GetAll().Select(i => new { DocID = i.RecID, i.YEARUSED, Code = i.CATCODE, Description = i.CATDESC }).Where(w => w.YEARUSED == PreviousYear).Distinct().OrderBy(m => m.Code).ToList(); DataTable catTable = new DataTable(); using (var reader = ObjectReader.Create(list_CAT, "DocID", "YEARUSED", "Code", "Description")) { catTable.Load(reader); mgridList.DataSource = catTable; } break; #endregion } ColumnManager(); } catch (Exception ex) { MessageHelpers.ShowError(ex.Message); } }
private void FillComboBox() { ListHelper.FillMetroCombo(mcboCategory, catbal.GetAll().Select(i => new { i.CATCODE }).Distinct().ToList(), "CATCODE", "CATCODE"); mcboCategory.SelectedIndex = -1; }