コード例 #1
0
 public void RefreshGrid()
 {
     try
     {
         var       list    = mrbal.GetAll().Distinct().OrderBy(o => o.Description).ToList();
         DataTable mrTable = new DataTable();
         using (var reader = ObjectReader.Create(list,
                                                 "RecID",
                                                 "SectionCode",
                                                 "Description",
                                                 "Time",
                                                 "IsActive"))
         {
             mrTable.Load(reader);
             mgridList.DataSource = mrTable;
         }
         dgvorig.DataSource = mgridList.DataSource;
         Grid.ListCheck(mgridList, listTS);
         tslblRowCount.Text = "Number of Records:    " + list.Count + "       ";
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #2
0
        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);
            }
        }