Esempio n. 1
0
        protected override void InitializeModuleData()
        {
            base.InitializeModuleData();
            try
            {
                reMain.BeginPaintObjects = new List <AbstractPaintObject>();
#if DEBUG
                MainProcess.ForceLoad((string)this["P01"]);
#endif
                var module = ModuleUtils.GetModuleInfo((string)this["P01"], (string)this["P02"]);
                var fields = (from field in FieldUtils.GetModuleFields((string)this["P01"])
                              where field.FieldGroup == CODES.DEFMODFLD.FLDGROUP.PARAMETER
                              select field).ToList();

                if (fields.Count > 0)
                {
                    reMain.BeginPaintObjects.Add(CreatePaintObject("Parameters", fields, module));
                }

                fields = (from field in FieldUtils.GetModuleFields((string)this["P01"])
                          where
                          field.FieldGroup == CODES.DEFMODFLD.FLDGROUP.COMMON &&
                          field.ControlType != CODES.DEFMODFLD.CTRLTYPE.DEFINEDGROUP
                          select field).ToList();

                if (fields.Count > 0)
                {
                    reMain.BeginPaintObjects.Add(CreatePaintObject("Controls", fields, module));
                }

                var endStores = new List <string>();

                switch (module.ModuleType)
                {
                case CODES.DEFMOD.MODTYPE.MAINTAIN:
                    if (module.SubModule == "MED")
                    {
                        var maintainModule = (MaintainModuleInfo)module;
                        endStores.Add(maintainModule.EditSelectStore);
                        endStores.Add(maintainModule.EditUpdateStore);
                    }
                    if (module.SubModule == "MAD")
                    {
                        var maintainModule = (MaintainModuleInfo)module;
                        endStores.Add(maintainModule.AddSelectStore);
                        endStores.Add(maintainModule.AddInsertStore);
                    }
                    if (module.SubModule == "MVW")
                    {
                        var maintainModule = (MaintainModuleInfo)module;
                        endStores.Add(maintainModule.ViewSelectStore);
                    }
                    break;

                case CODES.DEFMOD.MODTYPE.STOREEXECUTE:
                    var execModule = ((ExecProcModuleInfo)module);
                    endStores.Add(execModule.ExecuteStore);
                    break;
                }

                reMain.EndPaintObjects = new List <AbstractPaintObject>();
                var count = 0;
                foreach (string store in endStores)
                {
                    if (!string.IsNullOrEmpty(store))
                    {
                        cboStoresName.Properties.Items.Add(store);
                        reMain.EndPaintObjects.Add(CreatePaintObject(store, count == 0 ? Color.Green : Color.Red));
                        count++;
                    }
                }

                lbTitle.Text = string.Format("\"{0}\" Data Flow", LangUtils.TranslateModuleItem(LangType.MODULE_TITLE, module));
            }
            catch (Exception ex)
            {
                throw ErrorUtils.CreateError(ex);
            }
        }