Exemple #1
0
 private MasterGroupEditModel CreateFrom(MasterGroup entity)
 {
     return(new MasterGroupEditModel
     {
         MasterGroupID = entity.MasterGroupID,
         MasterGroupCode = entity.MasterGroupCode,
         MasterGroupName = entity.MasterGroupName
     });
 }
Exemple #2
0
        protected override YAMLMappingNode ExportYAMLRoot(IAssetsExporter exporter)
        {
            YAMLMappingNode node = base.ExportYAMLRoot(exporter);

            //node.AddSerializedVersion(GetSerializedVersion(exporter.Version));
            node.Add("m_OutputGroup", OutputGroup.ExportYAML(exporter));
            node.Add("m_MasterGroup", MasterGroup.ExportYAML(exporter));
            node.Add("m_Snapshots", Snapshots.ExportYAML(exporter));
            node.Add("m_StartSnapshot", StartSnapshot.ExportYAML(exporter));
            node.Add("m_SuspendThreshold", SuspendThreshold);
            node.Add("m_EnableSuspend", EnableSuspend);
            node.Add("m_UpdateMode", UpdateMode);
            node.Add("m_MixerConstant", MixerConstant.ExportYAML(exporter));
            return(node);
        }
        protected override YAMLMappingNode ExportYAMLRoot(IExportContainer container)
        {
            YAMLMappingNode node = base.ExportYAMLRoot(container);

            //node.AddSerializedVersion(GetSerializedVersion(container.Version));
            node.Add(OutputGroupName, OutputGroup.ExportYAML(container));
            node.Add(MasterGroupName, MasterGroup.ExportYAML(container));
            node.Add(SnapshotsName, Snapshots.ExportYAML(container));
            node.Add(StartSnapshotName, StartSnapshot.ExportYAML(container));
            node.Add(SuspendThresholdName, SuspendThreshold);
            node.Add(EnableSuspendName, EnableSuspend);
            node.Add(UpdateModeName, UpdateMode);
            node.Add(MixerConstantName, MixerConstant.ExportYAML(container));
            return(node);
        }
Exemple #4
0
        /*private static int GetSerializedVersion(Version version)
         * {
         #warning TODO: serialized version acording to read version (current 2017.3.0f3)
         *      return 2;
         * }*/

        public override void Read(AssetStream stream)
        {
            base.Read(stream);

            OutputGroup.Read(stream);
            MasterGroup.Read(stream);
            m_snapshots = stream.ReadArray <PPtr <AudioMixerSnapshot> >();
            StartSnapshot.Read(stream);
            SuspendThreshold = stream.ReadSingle();
            EnableSuspend    = stream.ReadBoolean();
            stream.AlignStream(AlignType.Align4);

            UpdateMode = stream.ReadInt32();
            stream.AlignStream(AlignType.Align4);

            MixerConstant.Read(stream);
            stream.AlignStream(AlignType.Align4);
        }
Exemple #5
0
        /*public static int ToSerializedVersion(Version version)
         * {
         #warning TODO: serialized version acording to read version (current 2017.3.0f3)
         *      return 2;
         * }*/

        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            OutputGroup.Read(reader);
            MasterGroup.Read(reader);
            Snapshots = reader.ReadAssetArray <PPtr <AudioMixerSnapshot> >();
            StartSnapshot.Read(reader);
            SuspendThreshold = reader.ReadSingle();
            EnableSuspend    = reader.ReadBoolean();
            reader.AlignStream();

            UpdateMode = reader.ReadInt32();
            reader.AlignStream();

            MixerConstant.Read(reader);
            reader.AlignStream();
        }
Exemple #6
0
        public DataSet GenerateSQL(Guid DataViewListID, out MetricTrac.Bll.DataViewList.Extend dv, out List <MasterGroup> MasterGroupList)
        {
            MasterGroupList = new List <MasterGroup>();
            dv = MetricTrac.Bll.DataViewList.Get(DataViewListID);
            string sql = SqlSelet.Replace("@InstanceId", "'" + dv.InstanceId.ToString() + "'");

            List <string> TotalOrderBy = new List <string>();
            List <string> TotalSelect  = new List <string>();

            List <ReferenceEntity.UseField> MasterGroupByFieldList = GetGroupByFieldList(ref sql, TotalOrderBy, TotalSelect, dv.GroupByList);
            List <ReferenceEntity.UseField> MasterSelectFieldList  = GetSelectFieldList(ref sql, TotalOrderBy, TotalSelect, dv.SelectList);

            List <ReferenceEntity.UseField> SlaveGroupByFieldList = GetGroupByFieldList(ref sql, TotalOrderBy, TotalSelect, dv.GroupBySlaveList);
            List <ReferenceEntity.UseField> SlaveSelectFieldList  = GetSelectFieldList(ref sql, TotalOrderBy, TotalSelect, dv.SelectSlaveList);

            if (MasterSelectFieldList.Count == 0 && SlaveSelectFieldList.Count == 0)
            {
                return(null);
            }

            DataSet                ds = MetricTrac.Bll.LinqMicajahDataContext.Execute(sql);
            DataTable              dt = ds.Tables[0];
            List <string>          PrevMasterGroupValue = new List <string>();
            List <MasterGroupNode> PrevMasterGroupNode  = new List <MasterGroupNode>();

            for (int i = 0; i < MasterGroupByFieldList.Count + SlaveGroupByFieldList.Count; i++)
            {
                PrevMasterGroupValue.Add(null);
                PrevMasterGroupNode.Add(null);
            }
            MasterGroup  mg = null;
            MasterRecord mr = null;
            MasterHeader mh = null;

            foreach (DataRow r in dt.Rows)
            {
                string OrgLocationRootColumnName = "en_FullName";
                if (dt.Columns.Contains(OrgLocationRootColumnName))
                {
                    object o = r[OrgLocationRootColumnName];
                    if (o is string && ((string)o) == "Organization Location")
                    {
                        r[OrgLocationRootColumnName] = MetricTrac.Bll.LinqMicajahDataContext.OrganizationName;
                    }
                }

                //Fill Master Group
                bool   isNewMasterGroup = false;
                string alias;
                string GroupValue;
                List <MasterGroupNode> GroupTree = null;

                for (int i = 0; i < MasterGroupByFieldList.Count; i++)
                {
                    alias      = GetAlias(MasterGroupByFieldList[i]);
                    GroupValue = r[alias].ToString();
                    if (PrevMasterGroupValue[i] != GroupValue && !isNewMasterGroup)
                    {
                        GroupTree        = new List <MasterGroupNode>();
                        isNewMasterGroup = true;
                        for (int k = 0; k < i; k++)
                        {
                            PrevMasterGroupNode[k].HeaderCount++;
                        }
                    }
                    PrevMasterGroupValue[i] = GroupValue;

                    string GroupHeader = MasterGroupByFieldList[i].Entity.ReadableName;
                    if (MasterGroupByFieldList[i].ReadableName != "Name")
                    {
                        GroupHeader += " " + MasterGroupByFieldList[i].ReadableName;
                    }

                    if (isNewMasterGroup)
                    {
                        MasterGroupNode n = new MasterGroupNode()
                        {
                            Header      = GroupHeader,
                            Value       = GroupValue,
                            HeaderCount = 1
                        };
                        GroupTree.Add(n);

                        for (int k = 0; k < i; k++)
                        {
                            PrevMasterGroupNode[k].SubGroupCount++;
                        }
                        PrevMasterGroupNode[i] = n;
                    }
                }
                if (isNewMasterGroup)
                {
                    mg = new MasterGroup()
                    {
                        GroupTree = GroupTree,

                        MasterHeaderList = new List <MasterHeader>(),
                        MasterRecordList = new List <MasterRecord>(),
                        SlaveGroupList   = new List <SlaveGroup>()
                    };
                    MasterGroupList.Add(mg);

                    foreach (var s in MasterSelectFieldList)
                    {
                        mh = new MasterHeader()
                        {
                            Header = s.Entity.ReadableName + (s.ReadableName == "Name" ? "" : (" " + s.ReadableName))
                        };
                        mg.MasterHeaderList.Add(mh);
                    }
                }

                //Fill Master Record
                bool         isNewMasterRecord = isNewMasterGroup;
                MasterRecord PrevMasterRecord  = mg.MasterRecordList.Count == 0 ? null : mg.MasterRecordList[mg.MasterRecordList.Count - 1];
                mr = new MasterRecord()
                {
                    MasterValueList = new List <MasterValue>(),
                    SlaveRecordList = new List <SlaveRecord>()
                };

                for (int i = 0; i < MasterSelectFieldList.Count; i++)
                {
                    var         s  = MasterSelectFieldList[i];
                    MasterValue mv = new MasterValue()
                    {
                        Value = GetValue(s, r)// r[GetAlias(s)].ToString()
                    };
                    mr.MasterValueList.Add(mv);
                    if (PrevMasterRecord == null || mv.Value != PrevMasterRecord.MasterValueList[i].Value)
                    {
                        isNewMasterRecord = true;
                    }
                }
                if (isNewMasterRecord)
                {
                    mg.MasterRecordList.Add(mr);
                    for (int k = 0; k < MasterGroupByFieldList.Count; k++)
                    {
                        PrevMasterGroupNode[k].RecordCount++;
                    }
                }
                else
                {
                    mr = mg.MasterRecordList[mg.MasterRecordList.Count - 1];
                }

                //Fill Slave Group
                if (mg.MasterRecordList.Count == 1)
                {
                    for (int i = 0; i < SlaveGroupByFieldList.Count; i++)
                    {
                        var        sg = SlaveGroupByFieldList[i];
                        SlaveGroup g  = new SlaveGroup()
                        {
                            Group = r[GetAlias(sg)].ToString()
                        };
                        mg.SlaveGroupList.Add(g);
                    }
                }


                //Fill Slave Records
                SlaveRecord sr = new SlaveRecord()
                {
                    SlaveValueList = new List <SlaveValue>()
                };
                mr.SlaveRecordList.Add(sr);
                for (int i = 0; i < SlaveSelectFieldList.Count; i++)
                {
                    var column = SlaveSelectFieldList[i];
                    //object v = r[GetAlias(column)];
                    SlaveValue sv = new SlaveValue()
                    {
                        Value = GetValue(column, r)//v == null ? null : v.ToString()
                    };
                    sr.SlaveValueList.Add(sv);
                }
            }

            /*for (int i = 0; i < MasterGroupList.Count; i++)
             * {
             *  var MG = MasterGroupList[i];
             *
             *  for (int k = i + 1; k < MasterGroupList.Count; k++)
             *  {
             *      if (MG.GroupTree.Count <= ChildMG.GroupTree.Count) break;
             *  }
             * }*/


            return(ds);
        }
Exemple #7
0
 public Group GetActiveGroup() => string.IsNullOrEmpty(ActiveGroupName) ? MasterGroup : MasterGroup.FindGroup(ActiveGroupName);