示例#1
0
 void RefrshStragAndPlan()
 {
     try
     {
         if (UseSetting == null)
         {
             return;
         }
         DataTable dt_strag = StragClass.ToTable <StragClass>(UseSetting.AllStrags.Values.ToList <StragClass>());
         if (dt_strag != null)
         {
             SetDataGridDataTable(dg_StragList, dt_strag);
         }
         DataTable dt_plans = StragRunPlanClass.ToTable <StragRunPlanClass>(UseSetting.AllRunPlannings.Values.ToList <StragRunPlanClass>());
         if (dt_plans != null)
         {
             SetDataGridDataTable(dg_stragStatus, dt_plans);
         }
         DataTable dt_grps = CalcStragGroupClass.ToTable <CalcStragGroupClass>(UseSetting.AllRunningPlanGrps.Values.ToList <CalcStragGroupClass>());
         if (dt_grps != null)
         {
             SetDataGridDataTable(dg_PlanGrps, dt_grps);
         }
         DataTable dt_assetunit = AssetUnitClass.ToTable <AssetUnitClass>(UseSetting.AllAssetUnits.Values.ToList <AssetUnitClass>());
         if (dt_assetunit != null)
         {
             SetDataGridDataTable(dg_AssetUnits, dt_assetunit);
         }
         refresh_AssetChart();
     }
     catch (Exception e)
     {
     }
 }
示例#2
0
        private void tsmi_refreshPlans_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem menu = sender as ToolStripMenuItem;

            try
            {
                // menu.Owner
                DataGridView dg = (menu.Owner as ContextMenuStrip).SourceControl as DataGridView;
                if (dg == null)
                {
                    return;
                }
                if (UseSetting == null)
                {
                    return;
                }
                DataTable dt = null;

                if (dg.Equals(this.dg_stragStatus))
                {
                    dt = StragRunPlanClass.ToTable <StragRunPlanClass>(UseSetting.AllRunPlannings.Values.ToList <StragRunPlanClass>());
                }
                else if (dg.Equals(this.dg_StragList))
                {
                    dt = StragClass.ToTable <StragClass>(UseSetting.AllStrags.Values.ToList <StragClass>());
                }
                if (dt == null)
                {
                    return;
                }
                SetDataGridDataTable(dg, dt);
            }
            catch (Exception ce)
            {
            }
        }