Example #1
0
 public MustSetShowConfig(PMConfig pmConfig, bool set)
 {
     PmConfig = pmConfig;
     Set      = set;
 }
Example #2
0
        private void GetPmEntities(IEnumerable <PmConfiguratorData> data, Func <PmConfiguratorData, bool> whereFunc, ref List <PM2Operation> pm2Operations, ref List <PMConfig> pmConfigs)
        {
            if (data == null)
            {
                return;
            }

            if (pm2Operations == null)
            {
                pm2Operations = new List <PM2Operation>();
            }
            if (pmConfigs == null)
            {
                pmConfigs = new List <PMConfig>();
            }

            var whereFuncinternal = whereFunc ?? (item => item != null);

            foreach (var p in data.Where(whereFuncinternal))
            {
                foreach (var op in p.PmMethodCodes)
                {
                    //if (!ValidatePmMethods(op.Key, p))
                    //    continue;

                    var pm2Operation = new PM2Operation
                    {
                        OperationCode_r = op.Key
                    };

                    var pm2OperationCode = string.Format("-{0}:{1}", op.Key, p.PmCode);
                    pm2Operation.SetProperty(pm2Operation.GetPrimaryKeyPropertyName(), pm2OperationCode);
                    pm2Operation.PM2OperationPMCode = p.PmCode;
                    pm2Operations.Add(pm2Operation);

                    var methods = op.Value;
                    if (methods == null)
                    {
                        continue;
                    }

                    //Если убрали метод
                    //if (methods.Count == 0)
                    //    methods.Add(string.Empty);

                    foreach (var m in methods.Cast <string>())
                    {
                        var pmbyproductkey = p.GetPmMethodDetailsKey(operationCode: op.Key, methodCode: m);
                        var pmConfig       = new PMConfig
                        {
                            PM2OperationCode_r = pm2OperationCode,
                            ObjectEntitycode_R = p.OjectEntityCode,
                            ObjectName_r       = p.ObjectName,
                            MethodCode_r       = m,
                            PMCONFIGBYPRODUCT  = p.PmMethodByProduct.ContainsKey(pmbyproductkey)
                                ? p.PmMethodByProduct[pmbyproductkey]
                                : (bool?)null,
                            PMCONFIGINPUTMASK = p.PmMethodByInputMask.ContainsKey(pmbyproductkey)
                                ? p.PmMethodByInputMask[pmbyproductkey]
                                : null,
                            PMCONFIGINPUTMASS = p.PmMethodByInputMass.ContainsKey(pmbyproductkey)
                                ? p.PmMethodByInputMass[pmbyproductkey]
                                : (bool?)null,
                        };

                        pmConfigs.Add(pmConfig);
                    }
                }
            }
        }