Ejemplo n.º 1
0
        public ActionResult ApplyTypeDelete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ApplyType AppT = db.ApplyTypes.Find(id);

            if (AppT == null)
            {
                return(HttpNotFound());
            }
            var applys = db.ApplyAudits.Where(a => a.Type.Id == AppT.Id && a.CheckState == (int)EnumAuditState.创建);
            List <ApplyAuditModel> applymodels = new List <ApplyAuditModel>();

            foreach (ApplyAudit apply in applys)
            {
                ApplyAuditModel applymodel = new ApplyAuditModel()
                {
                    Id         = apply.Id,
                    Type       = apply.Type.Name,
                    ApplyDate  = apply.ApplyDate == null ? "未知" : apply.ApplyDate.ToString(),
                    CheckState = apply.CheckState == null ? "未知" : Enum.GetName(typeof(EnumAuditState), apply.CheckState),
                };
                applymodels.Add(applymodel);
            }
            AllTypeModel model = new AllTypeModel()
            {
                TypeName = AppT.Name,
                Enable   = AppT.Enable,
                Data     = applymodels
            };

            return(View(model));
        }
Ejemplo n.º 2
0
        public void MatchingDoneRPC(ApplyType applyType)
        {
            Assert.IsTrue(PhotonNetwork.isMasterClient);

            _applicantList[applyType] = new List <PhotonPlayer>();
            photonView.RPC("SyncOneApplicantListRPC", PhotonTargets.All, _applicantList[applyType].ToArray(), applyType);
        }
Ejemplo n.º 3
0
        public static ConditionResult CheckCondition(ConditionType Condition, RequestType request)
        {
            ConditionEvaluationFor[XacmlFunctions.TIME_IN_RANGE] = new TimeInRangeCondition();

            ConditionResult Result = XAML_Common.ConditionResult.DontCare;

            if (Condition == null)
            {
                return(XAML_Common.ConditionResult.True);
            }

            ApplyType Item = Condition.Item as ApplyType;

            bool ConditionResult = ConditionEvaluationFor[Item.FunctionId].EvaluateConditionFor(Item, request);

            if (ConditionResult)
            {
                Result = XAML_Common.ConditionResult.True;
            }
            else if (!ConditionResult)
            {
                Result = XAML_Common.ConditionResult.False;
            }
            else
            {
                Result = XAML_Common.ConditionResult.DontCare;
            }

            return(Result);
        }
Ejemplo n.º 4
0
 public ActionResult AddApplyType(ApplyType model)
 {
     if (ModelState.IsValid)
     {
         try
         {
             var type = db.ApplyTypes.Where(t => t.Name == model.Name).FirstOrDefault();
             if (type == null)
             {
                 db.ApplyTypes.Add(model);
                 int res = db.SaveChanges();
                 return(RedirectToAction("ApplyType", new { Msg = "成功添加" + res + "个申请类型" }));
             }
             else
             {
                 ModelState.AddModelError("", "已存在名为" + model.Name + "的类型,不可重复添加!");
             }
         }
         catch (Exception ex)
         {
             ModelState.AddModelError("", ex.Message);
         }
     }
     return(View());
 }
Ejemplo n.º 5
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            Type = (ApplyType)reader.ReadInt();
        }
Ejemplo n.º 6
0
        public ApplyOver(string listName, int lineNumber, ApplyType type)
            : base(lineNumber)
        {
            _listGroupName = listName;
            _trueIf        = type;

            _valid = false;
        }
Ejemplo n.º 7
0
        /*
         * Constructors
         */

        public ApplyOver(ListGroupNode list, ApplyType type)
        {
            _trueIf        = type;
            _listGroup     = list;
            _listGroupName = list.FullPath;

            _indexWindow = new IndexedDataWindow(_listGroup.DataWindow);
            _valid       = true;
        }
Ejemplo n.º 8
0
        void Create(int id, int code, string name, string info, string icon_name,
                    ApplyType applyType, ApplyProperty applyProperty, ReleaseType releaseType, string efx_name, int animName, params SkillLevelDate[] skillLevelDates)
        {
            SkillInitial skillInitial = new SkillInitial(id, code, name, info, icon_name,
                                                         applyType, applyProperty, releaseType, efx_name, animName, skillLevelDates);

            skillInitials.Add(skillInitial);
            mapSkill.Add(id, skillInitial);
        }
Ejemplo n.º 9
0
        private void SyncOneApplicantListRPC(PhotonPlayer[] playerAry, ApplyType applyType)
        {
            _applicantList[applyType] = MonoUtility.ToList <PhotonPlayer>(playerAry);

            if (_applicantList[applyType].Contains(PhotonNetwork.player))
            {
                _board.UpdateNameBoard();
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        ///     Redosled navodjenja Apply elementa u XACML politici je bitan
        ///     1. Apply koji definise tip (AttributeDesignator element)
        ///     2. Donja granica
        ///     3. Gordnja granica
        /// </summary>
        /// <param name="Item"> ApplyType element - Sadrzi listu Apply elemenata</param>
        /// <param name="request"> Xacml zahtev </param>
        /// <returns></returns>
        public override bool EvaluateConditionFor(ApplyType Item, RequestType request)
        {
            bool TimeConditionResult = true;

            ApplyType currentTimeItem = Item.Items[0] as ApplyType;
            ApplyType lowerBoundItem  = Item.Items[1] as ApplyType;
            ApplyType upperBoundItem  = Item.Items[2] as ApplyType;

            // designator za def DataType, Category, AttributeId
            AttributeDesignatorType attributeDesignator = currentTimeItem.Items[0] as AttributeDesignatorType;

            // lower bound time
            ExpressionType[]   lowItems        = lowerBoundItem.Items;
            ApplyType          lowItem         = lowItems[0] as ApplyType;
            AttributeValueType lowItemValue    = lowItem.Items[0] as AttributeValueType;
            XmlNode            lowItemValueAny = lowItemValue.Any[0] as XmlNode;

            string lowerBoundTime = lowItemValueAny.Value as string;

            // upper bound time
            ExpressionType[]   uppItems        = upperBoundItem.Items;
            ApplyType          uppItem         = uppItems[0] as ApplyType;
            AttributeValueType uppItemValue    = uppItem.Items[0] as AttributeValueType;
            XmlNode            uppItemValueAny = uppItemValue.Any[0] as XmlNode;

            string upperBoundTime = uppItemValueAny.Value as string;

            // konverzija vremena - daylight saving time - +1 na vremensku zonu tako da je srbija na +2 po letnjem racunanju vremena
            // preporuka da se vreme definise u UTC formatu
            DateTime lowerBoundTimeValue = DateTime.Parse(lowerBoundTime, System.Globalization.CultureInfo.CurrentCulture);
            DateTime upperBoundTimeValue = DateTime.Parse(upperBoundTime, System.Globalization.CultureInfo.CurrentCulture);

            bool exists = false;
            List <AttributeType> Attributes = new List <AttributeType>(2);

            Attributes = AttributeDesignatorManager.RequestBagOfValues(attributeDesignator, request);

            if (Attributes.Count == 0)
            {
                // Provera MustBePresented atributa
                if (attributeDesignator.MustBePresent)
                {
                    // PDP zahteva od PIP dobavljanje atributa koji su potrebni
                    ContextHandler ch = new ContextHandler();
                    Attributes = ch.RequestForEnvironmentAttribute(attributeDesignator);
                }
                else
                {
                    return(TimeConditionResult);
                }
            }

            TimeConditionResult = TimeConditionEvaluation(lowerBoundTimeValue, upperBoundTimeValue, Attributes, out exists);

            return(TimeConditionResult);
        }
Ejemplo n.º 11
0
        public void StartBattle(ApplyType applyType)
        {
            Assert.IsTrue(PhotonNetwork.isMasterClient);

            var roomName = "Battle" + System.Guid.NewGuid();

            int[] team = TeamMaker(_mediator.MatchCount[applyType]);

            photonView.RPC("StartBattleRPC", PhotonTargets.AllViaServer, roomName, team, applyType);
        }
Ejemplo n.º 12
0
 public FunctionApply(ApplyType applytype, string applyname, string applyfunction, string basetable, string basecolumn)
 {
     _applystring = string.Format("{0} APPLY {1}([{2}].[{3}]) as {4}"
                                  , getApplyType(applytype)
                                  , applyfunction
                                  , basetable
                                  , basecolumn
                                  , applyname
                                  );
 }
Ejemplo n.º 13
0
        string getApplyType(ApplyType applytype)
        {
            switch (applytype)
            {
            case ApplyType.CROSS: return("CROSS");

            case ApplyType.OUTER: return("OUTER");
            }
            return("");
        }
Ejemplo n.º 14
0
 public HeroSkill(SkillType skilltype, ApplyType applytype, string skillname, string skilldescription, int skilllevel, int skillabillity, float skilldelaytime)
 {
     this.skillType        = skilltype;
     this.applyType        = applytype;
     this.skillName        = skillname;
     this.skillDescription = skilldescription;
     this.skillLevel       = skilllevel;
     this.skillAbillity    = skillabillity;
     this.skillDelayTime   = skilldelaytime;
 }
Ejemplo n.º 15
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="performer">performer of the interaction</param>
 /// <param name="usedObject">object in hand</param>
 /// <param name="intent">intent of the performer</param>
 /// <param name="targetCellPos">cell position being targeted on the interactable tiles</param>
 /// <param name="targetInteractableTiles">interactable tiles containing the tile being targeted</param>
 /// <param name="basicTile">info of the tile being targeted</param>
 /// <param name="handSlot">slot being used</param>
 /// <param name="targetVector">vector pointing from perform to the targeted position</param>
 public TileApply(GameObject performer, GameObject usedObject, Intent intent, Vector2Int targetCellPos,
                  InteractableTiles targetInteractableTiles, BasicTile basicTile, ItemSlot handSlot, Vector2 targetVector, ApplyType type = ApplyType.HandApply) : base(performer, usedObject, intent)
 {
     this.targetCellPos           = targetCellPos;
     this.targetInteractableTiles = targetInteractableTiles;
     this.basicTile    = basicTile;
     this.handSlot     = handSlot;
     this.targetVector = targetVector;
     this.applyType    = type;
 }
Ejemplo n.º 16
0
        //public FunctionApply(string jointable, string joincolumn, string basetable, string basecolumn)
        //    : this(ApplyType.CROSS, jointable, joincolumn, basetable, basecolumn) { }

        //public FunctionApply(ApplyType applytype, string jointable, string joincolumn, string basetable, string basecolumn)
        //{
        //    _applystring = string.Format("{0} JOIN {1} ON [{1}].[{2}] = [{3}].[{4}]"
        //        , getApplyType(applytype)
        //        , jointable
        //        , joincolumn
        //        , basetable
        //        , basecolumn
        //        );
        //}
        //public FunctionApply(string joinname, string jointable, string joincolumn, string basetable, string basecolumn)
        //    : this(ApplyType.CROSS, joinname, jointable, joincolumn, basetable, basecolumn) { }
        public FunctionApply(ApplyType applyType, string applynameTable, string applynameColumn, XmlFunction xmlFunction, string xmlXPath, string xmlColumn)
        {
            _applystring = string.Format("{0} APPLY {1}.{2}('{3}') as {4}({5})"
                                         , getApplyType(applyType)
                                         , xmlColumn
                                         , xmlFunction
                                         , xmlXPath
                                         , applynameTable
                                         , applynameColumn
                                         );
        }
Ejemplo n.º 17
0
        private void GiveApplyingTicket(PhotonPlayer player, ApplyType applyType)
        {
            Assert.IsTrue(PhotonNetwork.isMasterClient);

            var props = new Hashtable()
            {
                { "ApplyingTicket", (int)applyType }
            };

            player.SetCustomProperties(props);
        }
Ejemplo n.º 18
0
        private void UseApplyingTicket(ApplyType applyType)
        {
            _applyType = applyType;

            var props = new Hashtable()
            {
                { "ApplyingTicket", "" }
            };

            PhotonNetwork.player.SetCustomProperties(props);
        }
Ejemplo n.º 19
0
        public string[] AddApply(int userid, int targetid, string other, ApplyType applytype)
        {
            const string procedureName = "Proc_LayIM_AddApply";
            var          parameters    = new SqlParameter[] { MakeParameterInt("applyuid", userid), MakeParameterInt("targetid", targetid), MakeParameterInt("applytype", applytype.GetHashCode()), MakeParameterVarChar("other", other) };
            var          result        = ExecuteDataTableStoreProcedure(procedureName, parameters);

            if (result.Rows.Count > 0)
            {
                return(result.Rows.Cast <DataRow>().Select(x => x[0].ToString()).ToArray());
            }
            return(new string[] { "" });
        }
Ejemplo n.º 20
0
        public void StartBattleRPC(string roomName, int[] team, ApplyType applyType)
        {
            if (applyType != ApplyType.Practice)
            {
                _audioSource.PlayOneShot(_matchingClip, 0.1f);
            }

            var applyingTicket = PhotonNetwork.player.CustomProperties["ApplyingTicket"];

            if (applyingTicket == null)
            {
                return;
            }
            if (applyingTicket == "")
            {
                return;
            }

            if ((ApplyType)applyingTicket == applyType)
            {
                UseApplyingTicket(applyType);
                _isApplying = true;
            }

            if (_isApplying)
            {
                _board.SetStartBattleMode();
                _roomName = roomName;

                var playerList = _mediator.ApplicantList[applyType];

                for (int i = 0; i < playerList.Count; ++i)
                {
                    if (playerList[i] == PhotonNetwork.player)
                    {
                        if (i == 0)
                        {
                            photonView.RPC("MatchingDoneRPC", PhotonTargets.MasterClient, applyType);
                        }

                        var props = new Hashtable()
                        {
                            { "Team", team[i] }
                        };
                        PhotonNetwork.player.SetCustomProperties(props);
                        break;
                    }
                }

                CountDown(_countDown);
            }
        }
Ejemplo n.º 21
0
        public void ApproveRPC(PhotonPlayer player, ApplyType applyType)
        {
            Assert.IsTrue(PhotonNetwork.isMasterClient);

            GiveApplyingTicket(player, applyType);
            _applicantList[applyType].Add(player);

            photonView.RPC("SyncOneApplicantListRPC", PhotonTargets.All, _applicantList[applyType].ToArray(), applyType);

            if (_applicantList[applyType].Count == _matchCount[applyType])
            {
                _launcher.StartBattle(applyType);
            }
        }
Ejemplo n.º 22
0
    public void SetSkill()
    {
        Skill data = SkillSystem.GetSkill(skillId);

        skillType        = (SkillType)data.skillType;
        applyType        = (ApplyType)data.targetType;
        skillName        = data.name;
        skillDescription = data.description;
        skillLevel       = SkillSystem.GetUserSkillLevel(skillId);
        skillAbillity    = SkillSystem.GetUserSkillPower(skillId);
        skillDelayTime   = data.energy;
        skillImage       = SkillSystem.GetSkillImage(skillId);
        Debugging.Log(skillId + " 스킬 세팅완료");
    }
Ejemplo n.º 23
0
 public SkillInitial(int id, int code, string name, string info, string icon_name,
                     ApplyType applyType, ApplyProperty applyProperty, ReleaseType releaseType, string efx_name, int animName, SkillLevelDate[] skillLevelDates)
 {
     this.id              = id;
     this.code            = code;
     this.name            = name;
     this.info            = info;
     this.icon_name       = icon_name;
     this.applyType       = applyType;
     this.applyProperty   = applyProperty;
     this.releaseType     = releaseType;
     this.efx_name        = efx_name;
     this.aniname         = animName;
     this.SkillLevelDates = skillLevelDates;
 }
Ejemplo n.º 24
0
        public ActionResult ApplyTypeClose(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ApplyType AppT = db.ApplyTypes.Find(id);

            if (AppT == null)
            {
                return(HttpNotFound());
            }
            if (AppT.Enable == 1)
            {
                AppT.Enable = 0;
                db.SaveChanges();
                return(RedirectToAction("ApplyType", new { Msg = "[" + AppT.Name + "]已关闭" }));
            }
            return(Content("<script>alert('已关闭的类型');window.location.href='../ApplyType';</script>"));
        }
Ejemplo n.º 25
0
        public static Account Create(int tradeId, ApplyType applyType, Person Contact, Person Corporation, Person Agent, params Person[] unionBidPersons)
        {
            var account = new Account()
            {
                CreateTime   = DateTime.Now,
                TradeId      = tradeId,
                Status       = AccountStatus.UnGrant,
                VerifyStatus = AccountVerifyStatus.NotifySupply,
                ApplyType    = applyType,
                Contact      = Contact,
                Corporation  = Corporation,
                Agent        = Agent,
                IsOnline     = false
            };

            foreach (var item in unionBidPersons)
            {
                account.UnionBidPersons.Add(item);
            }
            return(account);
        }
Ejemplo n.º 26
0
 public Skill(int id, string name, string iconName, string des, ApplyType applyType,
     ApplyProperty applyProperty, int applyValue, int applyTime, int mp, int coldTime,
     ApproRole approRole, int level, ReleaseType releaseType, float distance, string effectName, string aniname, float anitime)
 {
     this.id = id;
     this.name = name;
     this.iconName = iconName;
     this.des = des;
     this.applyType = applyType;
     this.applyProperty = applyProperty;
     this.applyValue = applyValue;
     this.applyTime = applyTime;
     this.mp = mp;
     this.coldTime = coldTime;
     this.approRole = approRole;
     this.level = level;
     this.releaseType = releaseType;
     this.distance = distance;
     this.effectName = effectName;
     this.aniname = aniname;
     this.anitime = anitime;
 }
Ejemplo n.º 27
0
        public static void LoadValues()
        {
            InitAppLang();

            if (Preferences.ContainsKey(SettingConstants.END_TIME))
            {
                string endTimeP = Preferences.Get(SettingConstants.END_TIME, "");

                if (!DateTime.TryParse(endTimeP, DTCulture, System.Globalization.DateTimeStyles.None, out EndTime))
                {
                    EndTime = DateTime.Now;
                }
            }
            else
            {
                DateTime now = DateTime.Now;

                Preferences.Set(SettingConstants.END_TIME, now.ToString(DTCulture));

                EndTime = now;
            }

            LastInputTime   = Preferences.Get(SettingConstants.LAST_INPUT_TIME, DateTime.Now.ToString(DTCulture));
            ManualApplyType = (ApplyType)Preferences.Get(SettingConstants.RESIN_INPUT_TYPE, (int)ApplyType.Time);

            if (Preferences.ContainsKey(SettingConstants.RESIN_COUNT))
            {
                Resin = Preferences.Get(SettingConstants.RESIN_COUNT, 0);
            }
            else
            {
                Resin = 0;

                Preferences.Set(SettingConstants.RESIN_COUNT, Resin);
            }
        }
Ejemplo n.º 28
0
 /// <summary>
 /// Apply
 /// </summary>
 /// <param name="sqlable"></param>
 /// <param name="applySql">apply主体内容</param>
 /// <param name="shotName">apply简写</param>
 /// <param name="type">Apply类型</param>
 /// <returns></returns>
 public static Sqlable Apply(this Sqlable sqlable, string applySql, string shotName, ApplyType type)
 {
     Check.ArgumentNullException(sqlable.Sql, "语法错误,正确用法:sqlable.Form(“table”).Join");
     sqlable.Sql.AppendFormat(" {0} APPLY ({1}) {2}} ", type.ToString(), applySql, shotName);
     return(sqlable);
 }
Ejemplo n.º 29
0
        /// <summary>
        /// Creates the class (one instance only) that parses a scenario and puts events on queues
        /// </summary>
        /// <param name="scenarioFile"></param>
        public ScenarioToQueues(string scenarioFile, string schemaFile)
        {
            TimerQueueClass timerQueue = new TimerQueueClass();
            // Extract fields from the XML file (and schema)
            // see http://weblogs.asp.net/dbrowning/articles/114561.aspx
            // paths to xml/xsd
            // const string path = @"C:\Documents and Settings\dgeller\My Documents\Visual Studio 2005\Projects\";
            //const string scenarioFile = path + @"DDD\Scenario.xml";
            // const string xsdPath = path + @"XMLTrial\XMLTrial\ScenarioSchema.xsd";



            FileStream fs;
            Boolean    returnVal;

//            ScenarioToQueues.schemaFile = schemaFile;

            //    try
            //  {
            returnVal = ValidateScenario(scenarioFile);
            // }

            /*    catch (System.Exception e)
             *  {
             *
             *      string message = "Failed to validate schema. " + e.Message;
             *      Coordinator.debugLogger.LogException("Scenario Reader", message);
             *      throw new ApplicationException(message, e);
             *  }*/

            if (!returnVal)
            {
                return;
            }


            try
            {
                fs = File.Open(scenarioFile, FileMode.Open);
            }
            catch (System.Exception e)
            {
                string message = "Could not open scenario file on pass 2." + e.Message;
                Coordinator.debugLogger.LogException("Scenario Reader", message);
                throw new ApplicationException(message, e);
            }

            /// XmlReader readerTwo;
            try
            {
                XmlSchemaSet sc = new XmlSchemaSet();
                sc.Add(null, ScenarioToQueues.namedSchemaFile);//+".xsd");
                XmlReaderSettings readerSettings = new XmlReaderSettings();

                // readerSettings.ValidationType = ValidationType.Schema;
                readerSettings.IgnoreWhitespace = true;
                // makes no difference ?!               readerSettings.IgnoreWhitespace = true;
                //   readerSettings.ValidationEventHandler += new ValidationEventHandler(SchemaValidationHandler);

                reader = XmlReader.Create(fs, readerSettings);
                parser.SetReader(reader);
            }
            catch (System.Exception e)
            {
                fs.Close();
                string message = "Could not open schema file. " + e.Message;
                Coordinator.debugLogger.LogException("Scenario Reader", message);
                throw new ApplicationException(message, e);
            }

            //Build reverse dictionary of commnds->stage
            //This lets us enforce moving through the commands in a prescribed order
            Dictionary <string, int> stages = new Dictionary <string, int>();

            string[][] stageMembers = parser.StageMembers();
            for (int level = 0; level < stageMembers.Length; level++)
            {
                for (int member = 0; member < stageMembers[level].Length; member++)
                {
                    stages[stageMembers[level][member]] = level;
                }
            }
            int    currentStage = 0;
            string scenarioName = "";
            string description  = "";


            reader.Read(); // opens, gets to xml declaration
            reader.Read();
            try
            {
                if ("Scenario" == reader.Name) // only Scenario can be top level
                {
                    reader.Read();             // pass by "Scenario"

                    while (!reader.EOF && !((XmlNodeType.EndElement == reader.NodeType) && ("Scenario" == reader.Name)))
                    {
                        //Coordinator.debugLogger.Writeline(".");

                        switch (reader.NodeType)
                        {
                        case XmlNodeType.Element:
                            Coordinator.debugLogger.Writeline("ScenarioToQueues", "ELEMENT " + reader.Name, "test");
                            if (stages.ContainsKey(reader.Name))
                            {
                                if (stages[reader.Name] < currentStage)
                                {
                                    throw new ApplicationException("Command " + reader.Name + " out of sequence.");
                                }
                                currentStage = stages[reader.Name];
                                //NB, if command is not found in stages it will be trapped in the switch's default
                            }
                            switch (reader.Name)
                            {
                            case "ScenarioName":
                                scenarioName = parser.pGetString();
                                break;

                            case "Description":
                                description = parser.pGetString();
                                break;

                            case "ClientSideAssetTransfer":
                                ClientSideAssetTransferType assetTransfers = new ClientSideAssetTransferType(parser.pGetBoolean());
                                TimerQueueClass.SendBeforeStartup(assetTransfers);
                                Coordinator.debugLogger.Writeline("ScenarioToQueues", " ClientSideAssetTransferType ", "test");
                                break;

                            case "ClientSideStartingLabelVisible":
                                ClientSideStartingLabelVisibleType labelsVisible = new ClientSideStartingLabelVisibleType(parser.pGetBoolean());
                                TimerQueueClass.SendBeforeStartup(labelsVisible);
                                Coordinator.debugLogger.Writeline("ScenarioToQueues", " ClientSideStartingLabelVisibleType ", "test");
                                break;

                            case "ClientSideRangeRingVisibility":
                                ClientSideRangeRingVisibilityType rangeRingVisibility = new ClientSideRangeRingVisibilityType(parser.pGetString());
                                TimerQueueClass.SendBeforeStartup(rangeRingVisibility);
                                Coordinator.debugLogger.Writeline("ScenarioToQueues", "ClientSideRangeRingVisibilityType", "test");
                                break;

                            case "Playfield":
                                // except for the optional name/description
                                // Playfield must be first scenario item sent
                                // enforced by schema
                                string             errorText   = string.Empty;
                                string             imgLibPath  = string.Empty;
                                string             mapFilePath = string.Empty;
                                string             hostname    = Aptima.Asim.DDD.CommonComponents.ServerOptionsTools.ServerOptions.HostName;
                                pPlayfieldType     pDefine     = parser.pGetPlayfield();
                                PlayfieldEventType playfield   = new PlayfieldEventType(pDefine);
                                playfield.ScenarioName = scenarioName;
                                playfield.Description  = description;
                                if (playfield.IconLibrary.EndsWith(".dll"))
                                {
                                    imgLibPath = String.Format(@"\\{0}\{1}", ServerOptions.DDDClientPath, playfield.IconLibrary);         //icon library does include dll extension
                                }
                                else
                                {
                                    imgLibPath = String.Format(@"\\{0}\{1}.dll", ServerOptions.DDDClientPath, playfield.IconLibrary);         //icon library doesnt include dll extension
                                }
                                mapFilePath = String.Format(@"\\{0}\MapLib\{1}", ServerOptions.DDDClientPath, playfield.MapFileName);         //map file includes file extension

                                //check image library path
                                if (!File.Exists(imgLibPath))
                                {
                                    if (System.Windows.Forms.MessageBox.Show(String.Format("The server was not able to locate the image library in {0}.  There is a chance that clients connecting to this machine will have a similar issue locating this file.  If you'd still like to run the simulation, click Yes.  If you'd like to stop the server, click No.", imgLibPath), "File not found", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Information) == System.Windows.Forms.DialogResult.Yes)
                                    {        //User wants to continue
                                    }
                                    else
                                    {         //user wants to stop server
                                        throw new Exception("User Cancelled server process.  Server was unable to locate the image library at " + imgLibPath);
                                        return;
                                    }
                                }

                                //check map file path
                                if (!File.Exists(mapFilePath))
                                {
                                    if (System.Windows.Forms.MessageBox.Show(String.Format("The server was not able to locate the map file in {0}.  There is a chance that clients connecting to this machine will have a similar issue locating this file.  If you'd still like to run the simulation, click Yes.  If you'd like to stop the server, click No.", mapFilePath), "File not found", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Information) == System.Windows.Forms.DialogResult.Yes)
                                    {        //User wants to continue
                                    }
                                    else
                                    {         //user wants to stop server
                                        throw new Exception("User Cancelled server process.  Server was unable to locate the map file at " + mapFilePath);
                                        return;
                                    }
                                }
                                TimerQueueClass.SendBeforeStartup(playfield);
                                Coordinator.debugLogger.Writeline("ScenarioToQueues", "Playfield", "test");

                                TimerQueueClass.SendBeforeStartup(new RandomSeedType());
                                break;

                            case "LandRegion":
                                pLandRegionType region      = parser.pGetLandRegion();
                                RegionEventType regionEvent = new RegionEventType(region);

                                TimerQueueClass.SendBeforeStartup(regionEvent);
                                Coordinator.debugLogger.Writeline("ScenarioToQueues", " LandRegion " + regionEvent.UnitID, "test");

                                break;

                            /*
                             * case "ScoringRegion":
                             * pScoringRegionType regionS = parser.pGetScoringRegion();
                             * RegionEventType regionEventS = new RegionEventType(regionS);
                             * TimerQueueClass.SendBeforeStartup(regionEventS);
                             * Coordinator.debugLogger.Writeline("ScenarioToQueues", " ScoringRegion " + regionEventS.UnitID, "test");
                             * break;
                             */
                            case "ActiveRegion":
                                pActiveRegionType regionA      = parser.pGetActiveRegion();
                                RegionEventType   regionEventA = new RegionEventType(regionA);
                                if (!NameLists.activeRegionNames.New(regionA.ID, regionEventA))
                                {
                                    throw new ApplicationException("Duplicate active region name " + regionA.ID);
                                }
                                TimerQueueClass.SendBeforeStartup(regionEventA);
                                Coordinator.debugLogger.Writeline("ScenarioToQueues", " ActiveRegion " + regionEventA.UnitID, "test");
                                break;

                            case "Team":
                                pTeamType team      = parser.pGetTeam();
                                TeamType  teamEvent = new TeamType(team);
                                for (int i = 0; i < teamEvent.Count(); i++)
                                {
                                    UnitFacts.AddEnemy(teamEvent.Name, teamEvent.GetEnemy(i));
                                }
                                Coordinator.debugLogger.Writeline("ScenarioToQueues", " Team " + team.Name.ToString(), "test");
                                if (!NameLists.teamNames.New(team.Name, teamEvent))
                                {
                                    throw new ApplicationException("Duplicate team name " + team.Name);
                                }

                                TimerQueueClass.SendBeforeStartup(teamEvent);
                                break;

                            case "DecisionMaker":
                                DecisionMakerType decisionMaker = new DecisionMakerType(parser.pGetDecisionMaker());
                                UnitFacts.AddDM(decisionMaker.Identifier, decisionMaker.Chroma, decisionMaker.Team);
                                TimerQueueClass.SendBeforeStartup(decisionMaker);
                                Coordinator.debugLogger.Writeline("ScenarioToQueues", "Decision Maker ", "test");
                                break;

                            case "Network":
                                NetworkType network = new NetworkType(parser.pGetNetwork());
                                NetworkTable.AddNetwork(network);
                                TimerQueueClass.SendBeforeStartup(network);
                                Coordinator.debugLogger.Writeline("ScenarioToQueues", "Network ", "test");
                                break;


                            case "Sensor":
                                //sensor follows Playfield
                                pSensor sen = parser.pGetSensor();
                                // if Attribute is "all" there will be one cone; only extent is filled in from parser
                                if (sen.Attribute == "All")
                                {
                                    sen.Cones[0].Spread = 360;
                                    sen.Cones[0].Level  = "Total";
                                }
                                SensorTable.Add(sen.Name, new SensorType(sen.Attribute, sen.IsEngram, sen.TypeIfEngram, sen.Cones));

                                Coordinator.debugLogger.Writeline("ScenarioToQueues", " Sensor " + sen.Name.ToString(), "test");

                                break;

                            /*    case "TimeToRemove":
                             *          Defaults.DefaultTimeToRemove = parser.pGetInt();
                             *          break;
                             */
                            case "Classifications":
                                ClassificationsType classifications = new ClassificationsType(parser.pGetClassifications());
                                TimerQueueClass.SendBeforeStartup(classifications);
                                Coordinator.debugLogger.Writeline("ScenarioToQueues", " Classifications ", "test");
                                break;

                            case "TimeToAttack":
                                Defaults.DefaultTimeToAttack = parser.pGetInt() * 1000;
                                break;

                            case "Genus":
                                pGenusType g = parser.pGetGenus();
                                if (!NameLists.speciesNames.New(g.Name, g))
                                {
                                    throw new ApplicationException("Duplicate use of genus name " + g.Name);
                                }

                                Genealogy.Add(g.Name);


                                Coordinator.debugLogger.Writeline("ScenarioToQueues", "Genus " + g.Name, "test");
                                // StartupForUnits.Add(genus);
                                break;

                            case "Species":
                                // Genus and species come after playfield


                                pSpeciesType s       = parser.pGetSpecies();
                                SpeciesType  species = new SpeciesType(s);
                                if (!NameLists.speciesNames.New(species.Name, species))
                                {
                                    throw new ApplicationException("Duplicate use of species name " + species.Name);
                                }
                                Genealogy.Add(species.Name, species.BasedOn);
                                if (species.IsWeapon)
                                {
                                    WeaponTable.Add(species.Name);
                                }

                                WorkStates.Clear();
                                WorkStates.Add(species.States);
                                StatesForUnits.AddStatesOf(species.Name, WorkStates.CollapseStates(species.Name, species.BasedOn));
                                Coordinator.debugLogger.Writeline("ScenarioToQueues", "Species " + s.Name, "test");
                                // StartupForUnits.Add(species);
                                break;

                            case "Create_Event":
                                //string newId;
                                //   Create_EventType platformCreate;//used for sub platforms
                                pCreateType      c           = parser.pGetCreate();
                                Create_EventType createEvent = new Create_EventType(c);
                                Genealogy.Add(createEvent.UnitID, createEvent.UnitBase);
                                createEvent.Genus = Genealogy.GetGenus(createEvent.UnitID);
                                UnitFacts.AddUnit(createEvent.UnitID, createEvent.Owner, createEvent.UnitBase);
                                createEvent.Parameters = new ObjectDictionary();

                                SpeciesType speciesInfo = (SpeciesType)NameLists.speciesNames[createEvent.UnitBase];

                                foreach (KeyValuePair <string, StateBody> kvp in StatesForUnits.StateTable[createEvent.UnitBase])
                                {
                                    string            stateName = kvp.Key;
                                    ExtendedStateBody extended  = new ExtendedStateBody(kvp.Value);

                                    //end species dependent atts
                                    createEvent.Parameters.Add(stateName, (object)extended);
                                    //               EngramDependants.Add(createEvent.UnitID, extended);
                                }



                                //       TimerQueueClass.Add(1, createEvent);
                                NameLists.unitNames.New(createEvent.UnitID, null);
                                TimerQueueClass.SecondarySendBeforeStartup(createEvent);
                                UnitFacts.CurrentUnitStates.Add(createEvent.UnitID, "");
                                Coordinator.debugLogger.Writeline("ScenarioToQueues", "createEvent for " + createEvent.UnitID, "test");

                                //for some reason this docs everyone at time 1.  this seems to be the heart of the bug

                                /*
                                 * for (int i = 0; i < createEvent.Subplatforms.Count;i++ )
                                 * {
                                 * SubplatformDockType dockNotice = new SubplatformDockType(createEvent.Subplatforms[i], createEvent.UnitID);
                                 * dockNotice.Time = 1;
                                 * TimerQueueClass.SecondarySendBeforeStartup(dockNotice);
                                 *
                                 * }
                                 */
                                break;

                            case "Reveal_Event":
                                pRevealType      r           = parser.pGetReveal();
                                Reveal_EventType revealEvent = new Reveal_EventType(r);
                                revealEvent.Genus = Genealogy.GetGenus(revealEvent.UnitID);
                                if (r.Time > 1)
                                {
                                    TimerQueueClass.Add(r.Time, revealEvent);
                                }
                                else
                                {
                                    TimerQueueClass.SecondarySendBeforeStartup(revealEvent);
                                }
                                Coordinator.debugLogger.Writeline("ScenarioToQueues", "revealEvent for  " + revealEvent.UnitID + " at time" + r.Time.ToString(), "test");
                                RevealDocked(r.UnitID, r.Time);
                                break;

                            case "Move_Event":
                                pMoveType m = parser.pGetMove();
                                if (!UnitFacts.IsAUnit(m.UnitID))
                                {
                                    throw new ApplicationException("Cannot move non-exsitant unit " + m.UnitID);
                                }
                                Move_EventType moveEvent = new Move_EventType(m);
                                TimerQueueClass.Add(moveEvent.Time, moveEvent);
                                Coordinator.debugLogger.Writeline("ScenarioToQueues", " moveEvent for  " + moveEvent.UnitID, "test");
                                break;

                            case "Completion_Event":
                                HappeningCompletionType completionType = new HappeningCompletionType(parser.pGetHappeningCompletion());
                                HappeningList.Add(completionType);
                                break;

                            case "Species_Completion_Event":
                                pSpeciesCompletionType sct = parser.pGetSpeciesCompletion();
                                SpeciesCompletionType  speciesCompletion = new SpeciesCompletionType(sct);
                                SpeciesHappeningList.Add(speciesCompletion);
                                break;

                            case "Reiterate":
                                ReiterateType  reiterate = new ReiterateType(parser.pGetReiterate());
                                Move_EventType mQueued   = (Move_EventType)(reiterate.ReiterateList[0]);
                                Move_EventType mQCopy    = (Move_EventType)(reiterate.ReiterateList[0]);
                                mQueued.Range = reiterate.Range;
                                mQueued.Time  = reiterate.Time;
                                TimerQueueClass.Add(mQueued.Time, mQueued);

                                Coordinator.debugLogger.Writeline("ScenarioToQueues", " moveEvent from reiterate for  " + mQueued.UnitID, "test");
                                reiterate.ReiterateList.RemoveAt(0);
                                reiterate.ReiterateList.Add(mQCopy);
                                HappeningCompletionType envelope = new HappeningCompletionType(reiterate);
                                HappeningList.Add(envelope);
                                break;

                            case "StateChange_Event":
                                StateChangeEvent change = new StateChangeEvent(parser.pGetStateChange());
                                if (!UnitFacts.IsAUnit(change.UnitID))
                                {
                                    throw new ApplicationException("State change event references unknown unit " + change.UnitID);
                                }
                                if (!StatesForUnits.UnitHasState(change.UnitID, change.NewState))
                                {
                                    throw new ApplicationException("State chage for " + change.UnitID + " refers to unknwon state " + change.NewState);
                                }
                                for (int i = 0; i < change.Except.Count; i++)
                                {
                                    //                    if (!StatesForUnits.UnitHasState(Genealogy.GetBase(change.UnitID), change.Except[i])) throw new ApplicationException("State change for " + change.UnitID + " refers to unknown state " + change.Except);
                                    if (!StatesForUnits.UnitHasState(change.UnitID, change.Except[i]))
                                    {
                                        throw new ApplicationException("State change for " + change.UnitID + " refers to unknown state " + change.Except);
                                    }
                                }
                                for (int i = 0; i < change.From.Count; i++)
                                {
                                    //                if (!StatesForUnits.UnitHasState(Genealogy.GetBase(change.UnitID), change.From[i])) throw new ApplicationException("State change for " + change.UnitID + " refers to unknown state " + change.From);
                                    if (!StatesForUnits.UnitHasState(change.UnitID, change.From[i]))
                                    {
                                        throw new ApplicationException("State change for " + change.UnitID + " refers to unknown state " + change.From);
                                    }
                                }
                                TimerQueueClass.Add(change.Time, change);
                                break;

                            case "Transfer_Event":
                                TransferEvent t = new TransferEvent(parser.pGetTransfer());

                                if (!UnitFacts.IsDM(t.From))
                                {
                                    throw new ApplicationException("Transfer event references unknown DM (from) " + t.From);
                                }
                                if (!UnitFacts.IsDM(t.To))
                                {
                                    throw new ApplicationException("Transfer event references unknown DM (to) " + t.To);
                                }
                                if (!UnitFacts.IsAUnit(t.UnitID))
                                {
                                    throw new ApplicationException("Transfer event references unknown unit " + t.UnitID);
                                }
                                TimerQueueClass.Add(t.Time, t);
                                break;

                            case "Launch_Event":
                                LaunchEventType launch = new LaunchEventType(parser.pGetLaunch());
                                if (!UnitFacts.IsAUnit(launch.UnitID))
                                {
                                    throw new ApplicationException("Cannot launch from non-existent unit " + launch.UnitID);
                                }
                                TimerQueueClass.Add(launch.Time, launch);


                                break;

                            case "WeaponLaunch_Event":

                                WeaponLaunchEventType weaponLaunch = new WeaponLaunchEventType(parser.pGetWeaponLaunch());
                                if (!UnitFacts.IsAUnit(weaponLaunch.UnitID))
                                {
                                    throw new ApplicationException("Cannot launch from non-existent unit " + weaponLaunch.UnitID);
                                }
                                TimerQueueClass.Add(weaponLaunch.Time, weaponLaunch);


                                break;

                            case "DefineEngram":
                                pDefineEngramType defineEngram = parser.pGetDefineEngram();
                                Engrams.Create(defineEngram.Name, defineEngram.EngramValue, defineEngram.Type);
                                TimerQueueClass.SendBeforeStartup(new EngramSettingType(defineEngram.Name, "", defineEngram.EngramValue, defineEngram.Type));
                                break;

                            case "ChangeEngram":
                                ChangeEngramType changeEngram = new ChangeEngramType(parser.pGetChangeEngram());
                                if (!Engrams.ValidUpdate(changeEngram.Name, changeEngram.EngramValue))
                                {
                                    throw new ApplicationException("Illegal value " + changeEngram.EngramValue + " for engram " + changeEngram.Name);
                                }
                                TimerQueueClass.Add(changeEngram.Time, changeEngram);
                                //  Engrams.SendUpdate(changeEngram.Name);
                                break;

                            case "RemoveEngram":
                                RemoveEngramEvent removeEngram = new RemoveEngramEvent(parser.pGetRemoveEngram());
                                TimerQueueClass.Add(removeEngram.Time, removeEngram);
                                break;

                            //These chat commands are those from the scenario only;
                            // thos from client are handled immediately
                            case "OpenChatRoom":
                                OpenChatRoomType openChatRoom = new OpenChatRoomType(parser.pGetOpenChatRoom());
                                TimerQueueClass.Add(openChatRoom.Time, openChatRoom);
                                break;

                            case "CloseChatRoom":
                                CloseChatRoomType closeChatRoom = new CloseChatRoomType(parser.pGetCloseChatRoom());

                                TimerQueueClass.Add(closeChatRoom.Time, closeChatRoom);
                                break;

                            /* Not implemented yet
                             * case "DropChatters":
                             *     DropChattersType dropChatters = new DropChattersType(parser.pGetDropChatters());
                             *     TimerQueueClass.Add(dropChatters.Time, dropChatters);
                             *     break;
                             * case "AddChatters":
                             *     AddChattersType addChatters = new AddChattersType(parser.pGetAddChatters());
                             *     TimerQueueClass.Add(addChatters.Time, addChatters);
                             *     break;
                             *
                             */
                            case "OpenWhiteboardRoom":
                                OpenWhiteboardRoomType openWhiteboardRoom = new OpenWhiteboardRoomType(parser.pGetOpenWhiteboardRoom());
                                TimerQueueClass.Add(openWhiteboardRoom.Time, openWhiteboardRoom);
                                break;

                            case "OpenVoiceChannel":
                                OpenVoiceChannelType openVoiceChannel = new OpenVoiceChannelType(parser.pGetOpenVoiceChannel());
                                TimerQueueClass.Add(openVoiceChannel.Time, openVoiceChannel);
                                break;

                            case "CloseVoiceChannel":
                                CloseVoiceChannelType closeVoiceChannel = new CloseVoiceChannelType(parser.pGetCloseVoiceChannel());
                                TimerQueueClass.Add(closeVoiceChannel.Time, closeVoiceChannel);
                                break;

                            /*
                             * //Removed before 4.1
                             * case "GrantVoiceChannelAccess":
                             * GrantVoiceAccessType grantVoiceChannelAccess = new GrantVoiceAccessType(parser.pGetGrantVoiceChannelAccess());
                             * TimerQueueClass.Add(grantVoiceChannelAccess.Time, grantVoiceChannelAccess);
                             * break;
                             * case "RemoveVoiceChannelAccess":
                             * RemoveVoiceAccessType removeVoiceChannelAccess = new RemoveVoiceAccessType(parser.pGetRemoveVoiceChannelAccess());
                             * TimerQueueClass.Add(removeVoiceChannelAccess.Time, removeVoiceChannelAccess);
                             * break;
                             */
                            case "Rule":
                                pScoringRuleType srt       = parser.pGetScoringRule();
                                ScoringRuleType  scoreRule = new ScoringRuleType(srt);
                                if (!NameLists.ruleNames.New(srt.Name, scoreRule))
                                {
                                    throw new ApplicationException("Duplicate scoring rule name " + srt.Name);
                                }
                                ScoringRules.Add(scoreRule);
                                break;

                            case "Score":
                                pScoreType pst = parser.pGetScore();
                                ScoreType  st  = new ScoreType(pst);
                                if (!NameLists.scoreNames.New(pst.Name, st))
                                {
                                    throw new ApplicationException("Duplicate score name " + pst.Name);
                                }
                                Scores.Register(st);
                                break;

                            case "FlushEvents":
                                FlushEvents flush = new FlushEvents(parser.pGetFlushEventsType());
                                TimerQueueClass.Add(flush.Time, flush);
                                break;

                            case "SendChatMessage":
                                SendChatMessageType sendChat = new SendChatMessageType(parser.pGetSendChatMessage());
                                if (!UnitFacts.IsDM(sendChat.Sender) && !("EXP" == sendChat.Sender))
                                {
                                    throw new ApplicationException("In SendChatMessage, '" + sendChat.Sender + "' is not a valid DM name.");
                                }
                                // Note: Can't validate chat room name at parse time; it might not have been created yet
                                TimerQueueClass.Add(sendChat.Time, sendChat);
                                break;

                            case "Apply":
                                ApplyType apply = new ApplyType(parser.pGetApply());
                                //what does this do?
                                TimerQueueClass.Add(apply.Time, apply);
                                break;

                            case "SendVoiceMessage":
                                SendVoiceMessageType playVoiceMessage = new SendVoiceMessageType(parser.pGetSendVoiceMessage());
                                //what does this do?
                                TimerQueueClass.Add(playVoiceMessage.Time, playVoiceMessage);
                                break;

                            case "SendVoiceMessageToUser":
                                SendVoiceMessageToUserType playVoiceMessageToUser = new SendVoiceMessageToUserType(parser.pGetSendVoiceMessageToUser());
                                //what does this do?
                                TimerQueueClass.Add(playVoiceMessageToUser.Time, playVoiceMessageToUser);
                                break;

                            default:
                                throw new ApplicationException("ScenarioToQueues: Unknown Scenario Element is *" + reader.Name);
                            }    //switch
                            break;

                        default:
                            Coordinator.debugLogger.Writeline("ScenarioToQueues", "Unhandled or out-of-sequence XML tag " + reader.Value, "test");
                            reader.Read();
                            break;
                        } //switch
                    }     //while
                      // All of scenario processed. Now do last things

                    //verify that the Chat, Whiteboard, and Voice lists contain only DMs and make them symmetric.
                    List <string> allDMs = UnitFacts.GetAllDms();
                    for (int i = 0; i < allDMs.Count; i++)
                    {
                        DecisionMakerType thisDM = DecisionMakerType.GetDM(allDMs[i]);

                        for (int j = 0; j < thisDM.ChatPartners.Count; j++)
                        {
                            if (!allDMs.Contains(thisDM.ChatPartners[j]))
                            {
                                throw new ApplicationException("Unknown decision maker name '" + thisDM.ChatPartners[j] + "' found as chat partner of '" + allDMs[i] + "'");
                            }
                            DecisionMakerType partnerDM = DecisionMakerType.GetDM(thisDM.ChatPartners[j]);
                            if (!partnerDM.ChatPartners.Contains(allDMs[i]))
                            {
                                partnerDM.MayChatWith(allDMs[i]);
                            }
                        }

                        for (int j = 0; j < thisDM.WhiteboardPartners.Count; j++)
                        {
                            if (!allDMs.Contains(thisDM.WhiteboardPartners[j]))
                            {
                                throw new ApplicationException("Unknown decision maker name '" + thisDM.WhiteboardPartners[j] + "' found as whiteboard partner of '" + allDMs[i] + "'");
                            }
                            DecisionMakerType partnerDM = DecisionMakerType.GetDM(thisDM.WhiteboardPartners[j]);
                            if (!partnerDM.WhiteboardPartners.Contains(allDMs[i]))
                            {
                                partnerDM.MayWhiteboardWith(allDMs[i]);
                            }
                        }

                        for (int j = 0; j < thisDM.VoicePartners.Count; j++)
                        {
                            if (!allDMs.Contains(thisDM.ChatPartners[j]))
                            {
                                throw new ApplicationException("Unknown decision maker name '" + thisDM.VoicePartners[j] + "' found as voice partner of '" + allDMs[i] + "'");
                            }
                            DecisionMakerType partnerDM = DecisionMakerType.GetDM(thisDM.VoicePartners[j]);
                            if (!partnerDM.VoicePartners.Contains(allDMs[i]))
                            {
                                partnerDM.MaySpeakWith(allDMs[i]);
                            }
                        }
                    }

                    // Add networks for DMs that have none
                    List <string> dmList = UnitFacts.GetAllDms();
                    for (int nextDM = 0; nextDM < dmList.Count; nextDM++)
                    {
                        if (!NetworkTable.IsNetworkMember(dmList[nextDM]))
                        {
                            string netName = "Network-For-" + dmList[nextDM];
                            NetworkTable.AddMember(netName, dmList[nextDM]);
                            NetworkType newNet = new NetworkType(netName);
                            newNet.Add(dmList[nextDM]);
                            TimerQueueClass.SendBeforeStartup(newNet);
                            Coordinator.debugLogger.Writeline("ScenarioToQueues", "Network ", "test");
                        }
                    }
                    //AD: Don't create default chat room, user should have control of this
                    // Create the detault Broadcast chatroom
                    //OpenChatRoomType broadcastChatRoom = new OpenChatRoomType(1, "", "Broadcast", dmList);
                    //TimerQueueClass.SendBeforeStartup(broadcastChatRoom);
                }//if
            }
            catch (System.Exception e)
            {
                if (e.Message.StartsWith("User Cancelled"))
                {//This means a missing map or icon library, and the user wanted to stop the server.  Do not write to error log, just stop the server.
                    throw e;
                }
                string message = "Failure in Parsing Control for next tag=" + reader.Name + " : " + e.Message;
                Coordinator.debugLogger.LogException("ScenarioReader", message);
                throw new ApplicationException(message, e);
            }
            finally
            {
                reader.Close();
                fs.Close();
                // Coordinator.debugLogger.Writeline("ScenarioToQueues", "Done", "general");
            }
        }//
Ejemplo n.º 30
0
 public static Account Create(int tradeId, ApplyType applyType, Person Contact, Person Corporation, Person Agent, params Person[] unionBidPersons)
 {
     var account = new Account()
     {
         CreateTime = DateTime.Now,
         TradeId = tradeId,
         Status = AccountStatus.UnGrant,
         VerifyStatus = AccountVerifyStatus.NotifySupply,
         ApplyType = applyType,
         Contact = Contact,
         Corporation = Corporation,
         Agent = Agent,
         IsOnline = false
     };
     foreach (var item in unionBidPersons)
     {
         account.UnionBidPersons.Add(item);
     }
     return account;
 }
Ejemplo n.º 31
0
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();
            Type = (ApplyType)reader.ReadInt();
        }
Ejemplo n.º 32
0
    public void Run(ApplyType applyType, string ClassName, string MD5, int ReportCateID, int ReportType, Dictionary <string, object> dict, Action <string> action = null)
    {
        var            request  = HttpContext.Current.Request;
        var            response = HttpContext.Current.Response;
        ReportResultVM result   = new ReportResultVM();

        Task.Factory.StartNew(() =>
        {
            try
            {
                int MyID    = 0;
                bool CanRun = false;
                int Chk     = 0;

                //check seed
                Dictionary <string, object> OutDict = new Dictionary <string, object>()
                {
                    { "@MyID", MyID },
                    { "@CanRun", CanRun },
                    { "@Chk", Chk }
                };

                //var dt = MSDB.GetDataTable("ConnDB", "dbo.usp_ParameterM_xAddOrUpdateDefaultVaccine"
                //                                 , ref OutDict
                //                                 , new Dictionary<string, object>()
                //                                 {
                //                                    { "@MD5", MD5 },
                //                                    { "@OrgID", OrgID },
                //                                    { "@ReportCateID", ReportCateID },
                //                                    //{ "@SeedStorageFileID",0  },
                //                                    //{ "@FruitStorageFileID" ,0 },
                //                                    //{ "@ExcelStorageFileID",0  },
                //                                    { "@ApplyType",applyType },
                //                                    { "@ReportType",1 },
                //                                });

                Chk = (int)OutDict["@Chk"];

                //if(CanRun==true)
                if (true)
                {
                    //upload seed
                    //call WebService
                    //var json = "";
                    //
                    NIIS_Report.WebServiceSoapClient WS = new NIIS_Report.WebServiceSoapClient();
                    var json = WS.SendTask(ClassName, MD5, ReportCateID, ReportType, (int)applyType, JsonConvert.SerializeObject(dict));
                    result   = JsonConvert.DeserializeObject <ReportResultVM>(json, new JsonSerializerSettings {
                        TypeNameHandling = TypeNameHandling.Objects
                    });
                    //result.ResultFile = new byte[] { 1,2,3};
                }
                else
                {
                    //ReportDataVM VM = new ReportDataVM();
                    //EntityS.FillModel(VM,dt);
                    //get ReportResultVM
                }

                switch (applyType)
                {
                case ApplyType.預覽列印:
                    if (action != null)
                    {
                        success = true;
                        //JsonSerializerSettings settings = new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.All };
                        //string Serialized = JsonConvert.SerializeObject(inheritanceList, settings);
                        action(JsonConvert.SerializeObject(result.ResultData));
                    }
                    break;

                case ApplyType.匯出xls:
                    success = true;
                    //var filePath = Path.Combine(Path.GetDirectoryName(request.PhysicalPath), Path.GetFileNameWithoutExtension(request.PhysicalPath) + ".xlsx");
                    //response.ContentType = "application/download";
                    //response.AddHeader("content-disposition", "attachment;filename=" + HttpUtility.UrlEncode("預防接種紀錄表") + Path.GetExtension(filePath));
                    //response.TransmitFile(filePath);
                    //response.End();
                    response.Clear();
                    MemoryStream ms      = new MemoryStream(result.ResultFile);
                    response.ContentType = "application/pdf";
                    response.AddHeader("content-disposition", "attachment;filename=" + HttpUtility.UrlEncode(result.DisplayFileName));
                    response.Buffer = true;
                    ms.WriteTo(response.OutputStream);
                    response.End();
                    break;
                }
            }
            catch (Exception ex)
            {
                throw ex;
                #if (Debug)
                Console.WriteLine(ex.Message);
                response.Write(ex.Message);
                response.End();
                #endif
            }
        });


        response.BufferOutput = false;
        response.Write("<html><body><div id='fakeLoader'></div>");
        response.Write("<link rel='stylesheet' href='/css/fakeLoader.css'/>");
        response.Write("<script src='/js/jq/jquery-2.1.4.min.js'></script>");
        response.Write("<script src='/js/jq/fakeLoader.min.js'></script>");
        response.Write("<script>$('#fakeLoader').fakeLoader({timeToHide:60000,bgColor:'#f7cecd'});</script>");
        for (int i = 10; i > 0; i--)
        {
            if (success)
            {
                break;
            }
            response.Write("<script>document.getElementById('spnDisp').innerHTML='" + string.Format("倒數 {0} 秒", i) + "';</script>");

            response.Flush();
            Thread.Sleep(1000);
        }
        response.Write("<script>$('#fakeLoader').fadeOut();document.getElementById('spnDisp').innerText='';</script>");
        if (success == false)
        {
            response.Write("<script>alert('運算進行中,請等候通知');</script>");
        }
        //else
        //{
        //    response.Write("<a id='btnGetFile' href='http://www.google.com' target='_blank'></a>");
        //    response.Write("<script>document.getElementById('btnGetFile').click();</script>");
        //}
        response.Write("</body></html>");
    }