예제 #1
0
        protected void OnDoActualPlantGrowth(object sender, EventArgs e)
        {
            if (parentPlant.IsAlive)
            {
                // Do detachment
                double detachedFrac = detachmentRateFunction.Value();
                if (Dead.Wt * (1.0 - detachedFrac) < BiomassToleranceValue)
                {
                    detachedFrac = 1.0;  // remaining amount too small, detach all
                }
                Biomass detaching = Dead * detachedFrac;
                Dead.Multiply(1.0 - detachedFrac);
                if (detaching.Wt > 0.0)
                {
                    Detached.Add(detaching);
                    surfaceOrganicMatter.Add(detaching.Wt * 10, detaching.N * 10, 0, parentPlant.PlantType, Name);
                }

                // Do maintenance respiration
                if (maintenanceRespirationFunction.Value() > 0)
                {
                    MaintenanceRespiration = (Live.MetabolicWt + Live.StorageWt) * maintenanceRespirationFunction.Value();
                    Live.MetabolicWt      *= (1 - maintenanceRespirationFunction.Value());
                    Live.StorageWt        *= (1 - maintenanceRespirationFunction.Value());
                }
            }
        }
예제 #2
0
        public void SetData(FinalPlayerData Data)
        {
            Vector3 position = mDMono.transform.parent.localPosition;

            position.x = mDMono.transform.parent.localPosition.x > 0 ? 1700 : -1700;
            mDMono.transform.parent.localPosition = position;

            ItemData = Data ?? new FinalPlayerData();

            if (ItemData == null || ItemData.Name == null)
            {
                Empty.CustomSetActive(true);
                Filled.CustomSetActive(false);
                SetMysterious(true);
            }
            else
            {
                Empty.CustomSetActive(false);
                Filled.CustomSetActive(true);
                Replace.CustomSetActive(false);
                Icon.spriteName  = ItemData.IconName;
                Frame.spriteName = ItemData.FrameName;
                Name.text        = Name.transform.GetChild(0).GetComponent <UILabel>().text = ItemData.Name;
                LadderRank.text  = LadderRank.transform.GetChild(0).GetComponent <UILabel>().text = string.Format(EB.Localizer.GetString("ID_LADDER_RANK") + ":[fff348]{0}", (ItemData.LadderRank > 0 ? ItemData.LadderRank.ToString() : EB.Localizer.GetString("ID_ARENA_RANK_OUT_OF_RANGE")));
                Dead.CustomSetActive(ItemData.Dead);

                SetMysterious();
            }
        }
 public float ReceiveDamage(float damage)
 {
     Debug.Log("receive " + damage + " damage, " + health + " hp left");
     health -= damage;
     if (health > 400)
     {
         currentSprite = 0;
     }
     else if (health > 200 && health < 400)
     {
         currentSprite = 1;
     }
     else
     {
         currentSprite = 2;
     }
     if (health <= 0)
     {
         if (Dead != null)
         {
             Dead.Invoke(this, null);
         }
     }
     return(health);
 }
예제 #4
0
        private void OnPrune(PruneType Prune)
        {
            Summary.WriteMessage(this, "Pruning");

            Live.Clear();
            Dead.Clear();
        }
예제 #5
0
        public static void StartGame(List <int> playerIds, List <string> names)
        {
            if (playerIds.Count != names.Count)
            {
                throw new Exception("Player IDs and Names must have the same count");
            }
            Deck = new Stack <Card>(Card.GetCards());
            for (var i = 0; i < 3; i++)
            {
                if (Deck.Count != 0)
                {
                    CardsForSale.Add(Deck.Pop());
                }
            }
            Monsters.Clear();
            Turns.Clear();
            Dead.Clear();

            for (var i = 0; i < playerIds.Count; i++)
            {
                var monster = new Monster(playerIds[i], names[i]);
                Monsters.Add(monster);
                Turns.AddLast(monster);
            }

            Current = Monsters.First();
            Board.Reset();
            Host = true;
        }
예제 #6
0
파일: Agent.cs 프로젝트: jballaban/game1
    private void Awake()
    {
        if (gameObject.activeSelf == true)
        {
            idle   = new Idle(this);
            rest   = new Rest(this);
            eat    = new Eat(this);
            wander = new Wander(this);
            chase  = new Chase(this);
            flee   = new Flee(this);
            attack = new Attack(this);
            dead   = new Dead(this);

            navAgent = GetComponentInParent <NavMeshAgent>();

            tracker = GameObject.FindGameObjectWithTag("Tracker").GetComponent <Tracking>();

            damageOutput = gameObject.GetComponentsInChildren <Damage>();

            if (useAnimator == true)
            {
                anim = GetComponent <Animator>();
            }

            if (dynamicWandering == false)
            {
                spawnpoint = transform.position;
            }
        }
    }
예제 #7
0
 /// <summary>Clears this instance.</summary>
 private void Clear()
 {
     Live.Clear();
     Dead.Clear();
     DMDemand.Clear();
     NDemand.Clear();
 }
예제 #8
0
        public void OnGUI()
        {
            UpdateControllers();

            Sleep.OnGUI();
            Dead.OnGUI();
        }
예제 #9
0
        private void Form1_Load(object sender, EventArgs e)
        {
            Lifeless life = new Lifeless();
            Dead     dead = new Dead();

            int countOfDead = 0;

            while (countOfDead != 100)
            {
                for (int i = 0; i < Map.GetLength(0); i++)
                {
                    for (int j = 0; j < Map.GetLength(1); j++)
                    {
                        if (Map[i, j] == dead.Dead)
                        {
                            MapTemp[i, j] = Map[i, j];
                        }
                        if (Map[i, j] == life.Lifeless)
                        {
                            if (i > 0 && i < 99 && j > 0 && j < 99)
                            {
                                MiniMash[0, 0] = Map[i - 1, j - 1]; MiniMash[0, 1] = Map[i, j - 1]; MiniMash[0, 2] = Map[i + 1, j - 1];
                                MiniMash[1, 0] = Map[i - 1, j]; MiniMash[1, 1] = Map[i, j]; MiniMash[1, 2] = Map[i + 1, j];
                                MiniMash[2, 0] = Map[i - 1, j + 1]; MiniMash[2, 1] = Map[i, j + 1]; MiniMash[2, 2] = Map[i + 1, j + 1];
                                RewriteToSeconsArr.Checkking(MiniMash, ref MapTemp, i, j);
                            }
                        }
                    }
                }
                Map = MapTemp;
                countOfDead++;
            }
        }
        public static void DrawFigure(string value)
        {
            Lifeless life = new Lifeless();
            Dead     dead = new Dead();

            if (value == "Korabl")
            {
                Figure[0, 0] = life.Lifeless; Figure[0, 1] = life.Lifeless; Figure[0, 2] = dead.Dead;
                Figure[1, 0] = life.Lifeless; Figure[1, 1] = dead.Dead; Figure[1, 2] = life.Lifeless;
                Figure[2, 0] = dead.Dead; Figure[2, 1] = life.Lifeless; Figure[2, 2] = life.Lifeless;
            }
            if (value == "X")
            {
                Figure[0, 0] = dead.Dead; Figure[0, 1] = life.Lifeless; Figure[0, 2] = dead.Dead;
                Figure[1, 0] = life.Lifeless; Figure[1, 1] = dead.Dead; Figure[1, 2] = life.Lifeless;
                Figure[2, 0] = dead.Dead; Figure[2, 1] = life.Lifeless; Figure[2, 2] = life.Lifeless;
            }
            if (value == "Plus")
            {
                Figure[0, 0] = dead.Dead; Figure[0, 1] = life.Lifeless; Figure[0, 2] = dead.Dead;
                Figure[1, 0] = life.Lifeless; Figure[1, 1] = life.Lifeless; Figure[1, 2] = life.Lifeless;
                Figure[2, 0] = dead.Dead; Figure[2, 1] = life.Lifeless; Figure[2, 2] = dead.Dead;
            }
            for (int i = 0; i < 3; i++)
            {
                for (int j = 0; j < 3; j++)
                {
                    Map[7, 7] = Figure[0, 0]; Map[7, 8] = Figure[0, 1]; Map[7, 9] = Figure[0, 2];
                    Map[8, 7] = Figure[1, 0]; Map[8, 8] = Figure[1, 1]; Map[8, 9] = Figure[1, 2];
                    Map[9, 7] = Figure[2, 0]; Map[9, 8] = Figure[2, 1]; Map[9, 9] = Figure[2, 2];
                }
            }
        }
예제 #11
0
        protected void OnDoActualPlantGrowth(object sender, EventArgs e)
        {
            if (parentPlant.IsAlive)
            {
                // Do senescence
                double senescedFrac = senescenceRate.Value();
                if (Live.Wt * (1.0 - senescedFrac) < BiomassToleranceValue)
                {
                    senescedFrac = 1.0;  // remaining amount too small, senesce all
                }
                Biomass Loss = Live * senescedFrac;
                Live.Subtract(Loss);
                Dead.Add(Loss);
                Senesced.Add(Loss);

                // Do detachment
                double detachedFrac = detachmentRateFunction.Value();
                if (Dead.Wt * (1.0 - detachedFrac) < BiomassToleranceValue)
                {
                    detachedFrac = 1.0;  // remaining amount too small, detach all
                }
                Biomass detaching = Dead * detachedFrac;
                Dead.Multiply(1.0 - detachedFrac);
                if (detaching.Wt > 0.0)
                {
                    Detached.Add(detaching);
                    surfaceOrganicMatter.Add(detaching.Wt * 10, detaching.N * 10, 0, parentPlant.CropType, Name);
                }

                // Do maintenance respiration
                MaintenanceRespiration  = 0;
                MaintenanceRespiration += Live.MetabolicWt * maintenanceRespirationFunction.Value();
                MaintenanceRespiration += Live.StorageWt * maintenanceRespirationFunction.Value();
            }
        }
예제 #12
0
        public void Kill(long document)
        {
            using (var transaction = _bdContext.Database.BeginTransaction())
            {
                try
                {
                    var  serializedParent = JsonConvert.SerializeObject(_aliveRepository.DeleteByDocument(document));
                    Dead killed           = JsonConvert.DeserializeObject <Dead>(serializedParent);

                    killed.DateOfDeath = DateTime.UtcNow;

                    _deadRepository.Add(killed);

                    _aliveRepository.Save();
                    _deadRepository.Save();

                    transaction.Commit();
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    transaction.Rollback();
                }
            }
        }
예제 #13
0
        public virtual void Reset()
        {
            if (Dead != null)
            {
                Dead.Clear();
            }
            else
            {
                Dead = new Dictionary <PlayerMobile, DateTime>();
            }

            if (Idlers != null)
            {
                Idlers.Clear();
            }
            else
            {
                Idlers = new List <PlayerMobile>();
            }

            if (Members != null)
            {
                ForEachMember(pm => RemoveMember(pm, true));
                Members.Clear();
            }
            else
            {
                Members = new Dictionary <PlayerMobile, DateTime>();
            }
        }
예제 #14
0
    /// <summary>
    /// 状态机初始化
    /// </summary>
    private void ConstructFSM()
    {
        //针对每一个行为进行初始化, 针对于每个行为进行状态到行为转变的添加
        //巡逻
        Patrol patrol = new Patrol(this);

        patrol.AddTransition(Transition.SawPlayer, FSMActionID.Chasing);
        patrol.AddTransition(Transition.NoHealth, FSMActionID.Dead);
        //追逐
        Chase chase = new Chase(this);

        chase.AddTransition(Transition.ReachPalyer, FSMActionID.Attacking);
        chase.AddTransition(Transition.LostPlayer, FSMActionID.Patroling);
        chase.AddTransition(Transition.NoHealth, FSMActionID.Dead);
        //攻击
        Attack attack = new Attack(this);

        attack.AddTransition(Transition.SawPlayer, FSMActionID.Chasing);
        attack.AddTransition(Transition.LostPlayer, FSMActionID.Patroling);
        attack.AddTransition(Transition.NoHealth, FSMActionID.Dead);
        //死亡
        Dead dead = new Dead(this);

        dead.AddTransition(Transition.NoHealth, FSMActionID.Dead);
        //把状态列表进行初始化
        AddFSMState(patrol);
        AddFSMState(chase);
        AddFSMState(attack);
        AddFSMState(dead);
    }
예제 #15
0
    public override void OnHarvest()
    {
        if (Harvesting != null)
        {
            Harvesting.Invoke();
        }

        string Indent  = "     ";
        string Title   = Indent + Clock.Today.ToString("d MMMM yyyy") + "  - Harvesting " + Name + " from " + Plant.Name;
        double YieldDW = (Live.Wt + Dead.Wt);

        Console.WriteLine("");
        Console.WriteLine(Title);
        Console.WriteLine(Indent + new string('-', Title.Length));
        Console.WriteLine(Indent + Name + " Yield DWt: " + YieldDW.ToString("f2") + " (g/m^2)");
        Console.WriteLine(Indent + Name + " Size: " + Size.ToString("f2") + " (g)");
        Console.WriteLine(Indent + Name + " Number: " + Number.ToString("f2") + " (/m^2)");
        Console.WriteLine("");


        Live.Clear();
        Dead.Clear();
        Number           = 0;
        _ReadyForHarvest = false;
    }
예제 #16
0
        public void StartWork()
        {
            IsWorking = true;
            while (IsWorking)
            {
                Y += 2;
                if (_rnd.NextDouble() <= _brokeChance && !IsBroken && !IsRodsDisconnect)
                {
                    IsBroken = true;
                    Broken?.Invoke(this);
                    _liveTimer          = new Timer(TimeSpan.FromSeconds(TimeToDistraction).TotalMilliseconds);
                    _liveTimer.Elapsed += (o, e) =>
                    {
                        Dead?.Invoke(this);
                        StopWork();
                        _liveTimer?.Stop();
                    };
                    _liveTimer.Start();
                    return;
                }

                if (_rnd.NextDouble() <= _rodDisconnectChance && !IsRodsDisconnect && !IsBroken)
                {
                    IsBroken = true;
                    RodsDisconnect?.Invoke(this);
                    return;
                }
                Thread.Sleep(200);
            }
        }
예제 #17
0
 public void OnPrune(PruneType Prune)
 {
     Live.Clear();
     Dead.Clear();
     Number           = 0;
     _ReadyForHarvest = false;
 }
예제 #18
0
 public override void OnEndCrop(BiomassRemovedType BiomassRemoved)
 {
     DisposeDetachedMaterial(Live, RootLength);
     DisposeDetachedMaterial(Dead, RootLengthSenesced);
     Dead.Clear();
     Live.Clear();
 }
예제 #19
0
        //----------------------- Public methods -----------------------

        /// <summary>Initialise this root instance (and tissues).</summary>
        /// <param name="zone">The zone the roots belong to.</param>
        /// <param name="minimumLiveWt">Minimum live DM biomass for this organ (kg/ha).</param>
        public void Initialise(Zone zone, double minimumLiveWt)
        {
            // link to soil models parameters
            soil = zone.FindInScope <Soil>();
            if (soil == null)
            {
                throw new Exception($"Cannot find soil in zone {zone.Name}");
            }

            soilPhysical = soil.FindInScope <IPhysical>();
            if (soilPhysical == null)
            {
                throw new Exception($"Cannot find soil physical in soil {soil.Name}");
            }

            waterBalance = soil.FindInScope <ISoilWater>();
            if (waterBalance == null)
            {
                throw new Exception($"Cannot find a water balance model in soil {soil.Name}");
            }

            soilCropData = soil.FindDescendant <SoilCrop>(species.Name + "Soil");
            if (soilCropData == null)
            {
                throw new Exception($"Cannot find a soil crop parameterisation called {species.Name + "Soil"}");
            }

            nutrient = zone.FindInScope <INutrient>();
            if (nutrient == null)
            {
                throw new Exception($"Cannot find SoilNitrogen in zone {zone.Name}");
            }

            no3 = zone.FindInScope("NO3") as ISolute;
            if (no3 == null)
            {
                throw new Exception($"Cannot find NO3 solute in zone {zone.Name}");
            }

            nh4 = zone.FindInScope("NH4") as ISolute;
            if (nh4 == null)
            {
                throw new Exception($"Cannot find NH4 solute in zone {zone.Name}");
            }

            // initialise soil related variables
            zoneName             = soil.Parent.Name;
            nLayers              = soilPhysical.Thickness.Length;
            mySoilNH4Available   = new double[nLayers];
            mySoilNO3Available   = new double[nLayers];
            mySoilWaterAvailable = new double[nLayers];

            // save minimum DM and get target root distribution
            MinimumLiveDM      = minimumLiveWt;
            TargetDistribution = RootDistributionTarget();

            // initialise tissues
            Live.Initialise();
            Dead.Initialise();
        }
예제 #20
0
 void Awake()
 {
     enemyMoving = gameObject.GetComponent<EnemyMoving>();
     orbiting = gameObject.GetComponent<Orbiting>();
     chained = gameObject.GetComponent<Chained>();
     dead = gameObject.GetComponent<Dead>();
 }
예제 #21
0
 /// <summary>Kills part of the organ (transfer DM and N to dead tissue).</summary>
 /// <param name="fractionToRemove">The fraction to kill in each tissue</param>
 internal void KillOrgan(double fractionToRemove)
 {
     double[] dmKilled = MathUtilities.Multiply_Value(Live.FractionWt, Live.DM.Wt * fractionToRemove);
     double[] nKilled  = MathUtilities.Multiply_Value(Live.FractionWt, Live.DM.N * fractionToRemove);
     Dead.AddBiomass(dmKilled, nKilled);
     Live.AddBiomass(MathUtilities.Multiply_Value(dmKilled, -1.0), MathUtilities.Multiply_Value(nKilled, -1.0));
 }
        public void MyCode()
        {
            // The FIRST line of code should be BELOW this line

            AggregationCalculation <bool, bool> deadCalc       = new Dead();
            AggregationCalculation <int, int>   dealDamageCalc = new DealDamage();
            ApplyCalculation <int> receiveDamageApply          = new ReceiveDamageOneGetsAll();
            ApplyAction            logSurvivorApply            = new LogSurvivor();

            CharacterGroup redTeam = new CharacterGroup("Team Red", deadCalc, dealDamageCalc, receiveDamageApply, logSurvivorApply);

            redTeam.AddCharacter(new Defender("Thorbjorn", 340, 8, 12));
            redTeam.AddCharacter(new Character("Angor", 200, 15, 25));
            redTeam.AddCharacter(new Character("Zurin", 170, 18, 30));
            redTeam.AddCharacter(new Damager("Allarin", 100, 15, 25));

            CharacterGroup greenTeam = new CharacterGroup("Team Green", deadCalc, dealDamageCalc, receiveDamageApply, logSurvivorApply);

            greenTeam.AddCharacter(new Defender("Olaf", 400, 7, 13));
            greenTeam.AddCharacter(new Character("Baldur", 210, 12, 18));
            greenTeam.AddCharacter(new Character("Eliza", 160, 20, 35));
            greenTeam.AddCharacter(new Damager("Bezuron", 90, 10, 30));

            BattleHandler.DoBattle(redTeam, greenTeam);

            // The LAST line of code should be ABOVE this line
        }
예제 #23
0
        static void PassYear()
        {
            Year++;
            WriteLine($"Year {Year}");
            WriteLine($"Living: {LivingPeople.Count}");
            for (int i = 0; i < LivingPeople.Count; i++)
            {
                var person = LivingPeople[i];
                if (person.IsDying())
                {
                    Dead dead = new Dead(person);
                    DeadPeople.Add(dead);
                    //WriteLine($"{person.FamilyName} {person.GivenName} died at the age of {person.Age}");
                    //Write('✝');
                    Write('+');
                    LivingPeople.Remove(person);
                    if (person is Girl girl && Bakfis.Contains(girl))
                    {
                        Bakfis.Remove(girl);
                    }
                }
            }

            WriteLine();

            foreach (var living in LivingPeople)
            {
                if (living is Girl girl && !Bakfis.Contains(living) && girl.WantToMarry())
                {
                    Bakfis.Add(girl);
                }
예제 #24
0
        public override void SetAgent(IPlayerView view, IPieceAgent agent)
        {
            base.SetAgent(view, agent);

            Assert.IsNotNull(agent);
            Assert.IsNotNull(agent.Power);
            Assert.IsNotNull(agent.Health);
            Assert.IsNotNull(Power);
            Assert.IsNotNull(Health);

            agent.Power.Subscribe(p => Power.text   = $"{p}").AddTo(this);
            agent.Health.Subscribe(p => Health.text = $"{p}").AddTo(this);
            //agent.Model.ManaCost.Subscribe(p => Mana.text = $"{p}").AddTo(this);

            FindPiece().GetComponent <Renderer>().material
                = Owner.Value.Color == EColor.Black ? BoardView.BlackMaterial : BoardView.WhiteMaterial;

            MouseOver.DistinctUntilChanged().Subscribe(
                v =>
            {
                //BoardView.ShowSquares(this);
            }
                );
            Dead.Subscribe(d => { if (d)
                                  {
                                      Die();
                                  }
                           });
        }
예제 #25
0
        private async Task Combatant_Death(IEntity deadCombatant)
        {
            deadCombatant.Died -= Combatant_Death;

            Dead.Add(deadCombatant);

            Debug.WriteLine("Combatant Died " + deadCombatant.Name);


            // figure out how many are alive per faction

            foreach (var faction in Factions.Keys.ToList())
            {
                // if a faction has no members alive then we are ending
                var aliveCount = Factions[faction].Count(e => !Dead.Contains(e));
                if (aliveCount == 0)
                {
                    _ended = true;
                    foreach (var combatant in Combatants.Keys.ToList())
                    {
                        combatant.Died -= Combatant_Death;
                    }


                    if (Ended != null)
                    {
                        await Ended.Invoke(this, EncounterEndings.Death);
                    }

                    //break;
                    return;
                }
            }
        }
예제 #26
0
 private void OnCollisionEnter(Collision collision)
 {
     if (_canJump == false)
     {
         return;
     }
     if (collision.gameObject.TryGetComponent(out PlatformSegmentDead platformSegmentDead))
     {
         if (_ball.BallCanDead)
         {
             _ball.StaminaZero();
             Dead?.Invoke();
         }
         else
         {
             Jump(platformSegmentDead);
         }
     }
     else if (collision.gameObject.TryGetComponent(out PlatformSegment platformSegment))
     {
         Jump(platformSegment);
     }
     else if (collision.gameObject.TryGetComponent(out FinishSegment finishSegment))
     {
         Finish?.Invoke();
     }
 }
예제 #27
0
        public override bool AddSubscriptions()
        {
            Agent.Power.Subscribe(p => Power.text   = $"{p}").AddTo(this);
            Agent.Health.Subscribe(p => Health.text = $"{p}").AddTo(this);
            //agent.Model.ManaCost.Subscribe(p => Mana.text = $"{p}").AddTo(this);

            MouseOver.DistinctUntilChanged().Subscribe(
                v =>
            {
                //BoardView.ShowSquares(this);
            }
                );

            Dead.Subscribe(dead =>
            {
                if (!dead)
                {
                    return;
                }

                Info($"{Agent.Model} died");
                _Queue.Sequence(Cmd.Do(() => _AudioSource.PlayOneShot(DiedClip)));
                BoardView.Remove(this);
            });

            return(true);
        }
예제 #28
0
        public static void DrawFigure(string value)
        {
            Lifeless life = new Lifeless();
            Dead     dead = new Dead();

            if (value == "Rectangle")
            {
                Figure[0, 0] = life.Lifeless; Figure[0, 1] = life.Lifeless; Figure[0, 2] = life.Lifeless;
                Figure[1, 0] = life.Lifeless; Figure[1, 1] = dead.Dead; Figure[1, 2] = life.Lifeless;
                Figure[2, 0] = life.Lifeless; Figure[2, 1] = life.Lifeless; Figure[2, 2] = life.Lifeless;
            }
            if (value == "X")
            {
                Figure[0, 0] = life.Lifeless; Figure[0, 1] = dead.Dead; Figure[0, 2] = life.Lifeless;
                Figure[1, 0] = life.Lifeless; Figure[1, 1] = life.Lifeless; Figure[1, 2] = life.Lifeless;
                Figure[2, 0] = life.Lifeless; Figure[2, 1] = dead.Dead; Figure[2, 2] = life.Lifeless;
            }
            if (value == "Plus")
            {
                Figure[0, 0] = dead.Dead; Figure[0, 1] = life.Lifeless; Figure[0, 2] = dead.Dead;
                Figure[1, 0] = life.Lifeless; Figure[1, 1] = life.Lifeless; Figure[1, 2] = life.Lifeless;
                Figure[2, 0] = dead.Dead; Figure[2, 1] = life.Lifeless; Figure[2, 2] = dead.Dead;
            }
            for (int i = 0; i < 3; i++)
            {
                for (int j = 0; j < 3; j++)
                {
                    Map[50 + i, 50 + j] = Figure[i, j];
                }
            }
        }
예제 #29
0
 /// <summary>Clears this instance.</summary>
 private void Clear()
 {
     Live.Clear();
     Dead.Clear();
     dryMatterDemand.Clear();
     nitrogenDemand.Clear();
 }
예제 #30
0
파일: Root.cs 프로젝트: m8harrison/ApsimX-1
 /// <summary>Clears this instance.</summary>
 private void Clear()
 {
     Live.Clear();
     Dead.Clear();
     PlantZone.Clear();
     Zones.Clear();
     needToRecalculateLiveDead = true;
 }
 //---------------------------------------------------------------------
 private InitialBiomass(SiteCohorts cohorts,
     Dead.Pool   deadWoodyPool,
     Dead.Pool   deadNonWoodyPool)
 {
     this.cohorts = cohorts;
     this.deadWoodyPool = deadWoodyPool;
     this.deadNonWoodyPool = deadNonWoodyPool;
 }
예제 #32
0
 public bool isDead()
 {
     if (Dead.Equals(1))
     {
         return(true);
     }
     return(false);
 }
예제 #33
0
    private void loadBirthData()
    {
        Dead objDead = new Dead();
        objDead.Where.OrgID.Value = MHOCommon.CurrentOrgID.Value;
        objDead.Where.OrgID.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal;
        objDead.Where.OrgID.Conjuction = MyGeneration.dOOdads.WhereParameter.Conj.And;
        objDead.Where.Approved.Value = 0;
        objDead.Where.Approved.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal;
        objDead.Where.Approved.Conjuction = MyGeneration.dOOdads.WhereParameter.Conj.And;
        objDead.Where.HasHealthData.Value = 1;
        objDead.Where.HasHealthData.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal;
        objDead.Query.AddOrderBy(Dead.ColumnNames.RegisterDate, MyGeneration.dOOdads.WhereParameter.Dir.ASC);

        objDead.Query.Load();

        grdBorns.DataSource = objDead.DefaultView;
        grdBorns.DataBind();
    }
 private void LoadGridData()
 {
     Dead objDead = new Dead();
     if (GovID !=-1 && CivilID != -1 && HealthOfficeID != -1)
     {
         grdListDeadAprrovedCountHealthOffice.DataSource = objDead.ListDeadAprrovedCountHealthOffice(StarDate, EndDate, GovID, CivilID, HealthOfficeID);
         grdListDeadAprrovedCount.Visible = false;
         grdListDeadAprrovedCountCivil.Visible = false;
         grdListDeadAprrovedCountGov.Visible = false;
         grdListDeadAprrovedCountHealthOffice.DataBind();
         grdListDeadAprrovedCountHealthOffice.Visible = true;
     }
     else if (GovID != -1 && CivilID != -1)
     {
         grdListDeadAprrovedCountCivil.DataSource = objDead.ListDeadAprrovedCountCivil(StarDate, EndDate, GovID, CivilID);
         grdListDeadAprrovedCount.Visible = false;
         grdListDeadAprrovedCountHealthOffice.Visible = false;
         grdListDeadAprrovedCountGov.Visible = false;
         grdListDeadAprrovedCountCivil.Visible = true;
         grdListDeadAprrovedCountCivil.DataBind();
     }
     else if (GovID != -1)
     {
         grdListDeadAprrovedCountGov.DataSource = objDead.ListDeadAprrovedCountGov(StarDate, EndDate, GovID);
         grdListDeadAprrovedCount.Visible = false;
         grdListDeadAprrovedCountHealthOffice.Visible = false;
         grdListDeadAprrovedCountGov.Visible = true;
         grdListDeadAprrovedCountCivil.Visible = false;
         grdListDeadAprrovedCountGov.DataBind();
     }
     else
     {
         grdListDeadAprrovedCount.DataSource = objDead.ListDeadAprrovedCount(StarDate, EndDate);
         grdListDeadAprrovedCount.DataBind();
         grdListDeadAprrovedCount.Visible = true;
         grdListDeadAprrovedCountCivil.Visible = false;
         grdListDeadAprrovedCountHealthOffice.Visible = false;
         grdListDeadAprrovedCountGov.Visible = false;
     }
 }
예제 #35
0
 void Start()
 {
     _dead = GetComponent<Dead>();
     _skill = GetComponent<Skill>();
 }
 public void FemalDefaultCheck()
 {
     try
     {
         Dead objDead = new Dead();
         objDead.LoadByPrimaryKey(ParmDeadEventID);
         TimeSpan span = objDead.DeadDieDate.Subtract(objDead.DeadBirthDate);
         //check if the dead age was between 15 and 45 years & the dead is femal.
         if ((span.Days >= 5475 && span.Days <= 17885) && objDead.DeadGender == 2)
         {
             TabPanelGirlsData.Enabled = true;
         }
         else
         {
             TabPanelGirlsData.Enabled = false;
         }
     }
     catch
     {
         TabPanelGirlsData.Enabled = false;
     }
 }
 protected void btnApprove_Click(object sender, EventArgs e)
 {
     Dead dead = new Dead();
     if (dead.ApproveDeadInfo(ParmDeadEventID))
     {
        // Dead objDead = new Dead();
         dead.UpdateDeadDoctor(MHOCommon.CurrentLoggedUserID, ParmDeadEventID);
         Response.Redirect("BornResult.aspx?ApproveDead=1&Medical=1&DeadEventID=" + ParmDeadEventID);
     }
     else
     {
         MHOCommon.ShowMessage("عفوا هناك خطا فى البيانات", this.Page);
     }
 }
예제 #38
0
    public static void WriteQrsDead(Guid DeadEventID)
    {
        Dead deadCase = new Dead();
        deadCase.LoadByPrimaryKey(DeadEventID);
        MHO.BLL.AREA area = new AREA();
        area.LoadByPrimaryKey(deadCase.DeadArea);
        MHO.BLL.POLICE_STATION ps = new POLICE_STATION();
        ps.LoadByPrimaryKey(deadCase.DeadSection);
        MHO.BLL.health_office ho = new health_office();
        ho.LoadByPrimaryKey(deadCase.OrgID);

        NATIONALITY MotherNath = new NATIONALITY();
        MotherNath.LoadByPrimaryKey(deadCase.DeadMotherNationality);
        string gender = (deadCase.DeadGender == 1) ? "ذكر " : "أنثى";
        string deadMartialStatus = "اعزب", deadReligion = "مسلم", motherReligion = "مسلم", InformRelation = "الأب";

        switch (deadCase.DeadMartialStatus)
        {
            case 1:
                deadMartialStatus = "اعزب";
                break;
            case 2:
                deadMartialStatus = "متزوج";
                break;
            case 3:
                deadMartialStatus = "مطلق";
                break;
            case 4:
                deadMartialStatus = "أرمل";
                break;
        }
        switch (deadCase.DeadMotherReligion)
        {
            case 1:
                motherReligion = "مسلم";
                break;
            case 2:
                motherReligion = "مسيحى";
                break;
            case 3:
                motherReligion = "يهودى";
                break;
        }

        switch (deadCase.DeadReligion)
        {
            case 1:
                deadReligion = "مسلم";
                break;
            case 2:
                deadReligion = "مسيحى";
                break;
            case 3:
                deadReligion = "يهودى";
                break;
        }

        switch (deadCase.InformerRelation)
        {
            case 1:
                InformRelation = "الاب";
                break;
            case 2:
                InformRelation = "الام";
                break;
            case 3:
                InformRelation = "الاخ";
                break;
            case 4:
                InformRelation = "الاخت";
                break;
            case 5:
                InformRelation = "العم";
                break;
            case 6:
                InformRelation = "الخال";
                break;
            case 7:
                InformRelation = "الجد";
                break;
            case 8:
                InformRelation = "اخري";
                break;
            case 9:
                InformRelation = "الابن";
                break;
            case 10:
                InformRelation = "الابنة";
                break;
        }
        if (deadCase.RowCount > 0)
        {
            QrEncoder encoder = new QrEncoder(ErrorCorrectionLevel.M);
            QrCode qrCode;
            StringBuilder builder = new StringBuilder();
            builder.AppendLine(deadCase.DeadNID);
            builder.AppendLine("," + deadCase.DeadFirstName + " " + deadCase.DeadFatherName + " " + deadCase.DeadGrandName + " " + deadCase.DeadFamilyName);
            builder.AppendLine("," + deadCase.DeadBirthDate.ToShortDateString());
            builder.AppendLine("," + deadReligion);
            builder.AppendLine("," + deadMartialStatus);
            builder.AppendLine("," + gender);
            builder.AppendLine("," + deadCase.AddressNo + "," + deadCase.AddressStreet + "," + deadCase.AddressFeatured);
            builder.AppendLine("," + ps.DESCR);
            builder.AppendLine("," + area.DESCR);
            builder.AppendLine("," + deadCase.DeadDieDate.ToShortDateString() + " - " + deadCase.DeadDieHour + ":" + deadCase.DeadDieMin);
            builder.AppendLine("," + deadCase.DiePlace + "," + deadCase.DiePlaceDescription);
            builder.AppendLine("," + deadCase.DeadMotherFirstName + " " + deadCase.DeadMotherSecondName + " " + deadCase.DeadMotherFamilyName + " " + deadCase.DaadMotherSureName);
            builder.AppendLine("," + MotherNath.DESCR);
            builder.AppendLine("," + motherReligion);
            builder.AppendLine("," + deadCase.DeadMotherJob);
            builder.AppendLine("," + deadCase.DeadMotherNID);
            builder.AppendLine("," + deadCase.InformerFirstName + " " + deadCase.InformerSecondName);
            builder.AppendLine("," + InformRelation);
            builder.AppendLine("," + deadCase.InformerNID);
            builder.AppendLine("," + deadCase.InformerPhone);
            encoder.TryEncode(builder.ToString(), out qrCode);

            GraphicsRenderer gRenderer = new GraphicsRenderer(
            new FixedModuleSize(2, QuietZoneModules.Zero),
            Brushes.Black, Brushes.White);

            MemoryStream ms = new MemoryStream();
            gRenderer.WriteToStream(qrCode.Matrix, ImageFormat.Bmp, ms);

            try
            {

                SqlCommand cmd = new SqlCommand();
                SqlConnection conn = new SqlConnection(ConfigurationManager.AppSettings["dbConnection"].ToString());
                cmd.CommandText = "insert into QRSDead (ID,QrCode) values  (@ID,@Picture)";
                cmd.Parameters.Add("@ID", System.Data.SqlDbType.UniqueIdentifier);
                cmd.Parameters.Add("@Picture", System.Data.SqlDbType.VarBinary);
                cmd.Connection = conn;
                cmd.Parameters["@ID"].Value = DeadEventID;
                cmd.Parameters["@Picture"].Value = ms.ToArray();

                conn.Open();
                cmd.ExecuteNonQuery();
                conn.Close();
            }
            catch (Exception ex)
            {

            }
        }
    }
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        Dead objDead = new Dead();

        if (DeadEventIDParameter != null)
        {
            if (LogicValidation())
            {
                UpdateDeathData();
                objDead.UpdateDeadWriter(MHOCommon.CurrentLoggedUserID, DeadEventIDParameter.Value);
                Response.Redirect("BornResult.aspx?Dead=1&DeadEventID=" + DeadEventIDParameter.Value);
            }
        }
        else
        {
            if (LogicValidation())
            {
             Guid insertedDeadID = InsertDeathCase();
             objDead.UpdateDeadWriter(MHOCommon.CurrentLoggedUserID, insertedDeadID);
             Response.Redirect("BornResult.aspx?Dead=1&DeadEventID=" + insertedDeadID.ToString());
            }

        }
    }
예제 #40
0
    private void LoadData()
    {
        DecisionControl1.HealthOffice = "المعادي";
        if (DeadEventIDParameter != null)
        {

            Dead objDead = new Dead();
            objDead.LoadByPrimaryKey(DeadEventIDParameter.Value);
            UcDeathInfo2.ShowHideNID(objDead.DeadNationality == 13818);
            UcDeathInfo2.EventDeadNID = objDead.DeadNID;
            UcDeathInfo2.EventDeadGender = objDead.DeadGender;
            UcDeathInfo2.EventDeadFristName = objDead.DeadFirstName;
            UcDeathInfo2.EventDeadFatherName = objDead.DeadFatherName;
            UcDeathInfo2.EventDeadFamilyName = objDead.DeadGrandName;
            UcDeathInfo2.EventDeadTitle = objDead.DeadFamilyName;
            UcDeathInfo2.EventDeadNationality = objDead.DeadNationality;
            UcDeathInfo2.EventDeadReligion = objDead.DeadReligion;
            UcDeathInfo2.EventDeadMartialStatus = objDead.DeadMartialStatus;
            UcDeathInfo2.EventDeadCardNo = objDead.PaperID;
            UcDeathInfo2.EventDeadCardType = objDead.PaperIDType;
            UcDeathInfo2.EventCardLocation = objDead.PaperIssuePlace;
            UcDeathInfo2.ProveType = objDead.ProveText;
            UcDeathInfo2.ProveNo = objDead.ProveNumber;
            UcDeathInfo2.EventDeadBirthDate = objDead.DeadBirthDate.ToShortDateString();

            UcAddressInfo1.EventDeadAddressNo = objDead.AddressNo;
            UcAddressInfo1.EventDeadAddressStreet = objDead.AddressStreet;
            UcAddressInfo1.EventDeadAddressSign = objDead.AddressFeatured;
            UcAddressInfo1.DeadAddressGovernate = objDead.DeadGovernorate;
            UcAddressInfo1.LoadPoliceStation();
            UcAddressInfo1.DeadAddressPoliceStation = objDead.DeadSection;
            UcAddressInfo1.LoadArea();
            UcAddressInfo1.DeadAddressArea = objDead.DeadArea;
            UcAddressInfo1.EventDeadAddressPhone = objDead.DeadPhone;
            UcAddressInfo1.EventDeadAddressJob = objDead.DeadJob;

            UcGeneralDeathInfo1.EventDeadDieDate = objDead.DeadDieDate.ToShortDateString();
            UcGeneralDeathInfo1.EventDeadPlace = objDead.DiePlace;
            UcGeneralDeathInfo1.EventDeadPlaceDescription = objDead.DiePlaceDescription;
            UcGeneralDeathInfo1.EventDeadDieHour = objDead.DeadDieHour;
            UcGeneralDeathInfo1.EventDeadDieMin = objDead.DeadDieMin;
            //objDead.DieGovernorate = -- ToDO
            //objDead.DieSection = --ToDo
            //objDead.DieArea = --ToDo
            UcMotherInfo2.ParentNID = objDead.DeadMotherNID;
            UcMotherInfo2.ParentNationality = objDead.DeadMotherNationality;
            UcMotherInfo2.ParentFirstName = objDead.DeadMotherFirstName;
            UcMotherInfo2.ParentFatherName = objDead.DeadMotherSecondName;
            UcMotherInfo2.ParentFamilyName = objDead.DeadMotherFamilyName;
            //UcMotherInfo2.ParentSureName = objDead.deadmo
            UcMotherInfo2.ParentRelegion = objDead.DeadMotherReligion;
            UcMotherInfo2.ParentJob = objDead.DeadMotherJob;
            UcNotifierInfo2.NotifierRelation = objDead.InformerRelation;
            UcNotifierInfo2.NotifierphoneNo = objDead.InformerPhone;
            UcNotifierInfo2.NotifierNID = objDead.InformerNID;
            UcNotifierInfo2.NotifierFName = objDead.InformerFirstName;
            UcNotifierInfo2.NotifierFatherName = objDead.InformerSecondName;
            UcMotherInfo2.ParentSureName = objDead.DaadMotherSureName;
            //objDead.InformerAddress = UcNotifierInfo2.
            drpRegestierNoList.Value = objDead.RegisterID.ToString();
            ManualRegister obj = new ManualRegister();
            obj.LoadByPrimaryKey(new Guid(objDead.RegisterID.ToString()));
            txtRegestierNoList.Text = obj.RegisterCode;

            txtRecordNumber.Text = objDead.RegisterNo.ToString();
            if (IsLostCase)
            {
                if (objDead.IsUnKown)
                {
                    rdTypeList.ClearSelection();
                    rdTypeList.Items.FindByValue("1").Selected = true;
                }
                DecisionControl1.NotesValue = objDead.DeadDecisionNotes;
                DecisionControl1.DecisionDate = objDead.DeadDecisionDate;
                DecisionControl1.DecisionDirectionValue = objDead.DeadDecisionDirection;
                DecisionControl1.DecisionNumber = objDead.DeadDecisionNo;
                if (rdTypeList.SelectedValue == "1")
                {
                    DecisionControl1.lblDecisionDirector = "نيابة";
                }
            }
        }
    }
 private void LoadGridData()
 {
     Dead objDead = new Dead();
     grdListDeadStatistcs.DataSource = objDead.ListDeadStatistcs(StarDate, EndDate);
     grdListDeadStatistcs.DataBind();
 }
예제 #42
0
    private void Filter()
    {
        Dead objDead = new Dead();

        DataTable res =
        objDead.FilterDead(MHOCommon.ConnString, MHOCommon.CurrentOrgID.Value,txtDeadName.Text,txtDeadNID.Text,txtInformerNID.Text, txtDateFrom.Text, txtDateTo.Text);

        grdDead.DataSource = res.DefaultView;
        grdDead.DataBind();
    }
    public void AddNewHealthInfo()
    {
        DeadMedicalInfo deadMedical = new DeadMedicalInfo();

        deadMedical.AddNew();

        deadMedical.DeadEventID = ParmDeadEventID;

        deadMedical.CauseOfDeathA = ucItemControlDeathReasonA.SelectedICD;
        deadMedical.CauseOfDeathAPeriod = ucItemControlDeathReasonA.Days + ucItemControlDeathReasonA.Months + ucItemControlDeathReasonA.Years;

        deadMedical.CauseOfDeathD = ucItemControlDeathReasonD.SelectedICD;
        deadMedical.CauseOfDeathDPeriod = ucItemControlDeathReasonD.Days + ucItemControlDeathReasonD.Months + ucItemControlDeathReasonD.Years;

        deadMedical.CauseOfDeathNotRelatedA = ucItemCauseOfDeathNotRelatedA.SelectedICD;
        deadMedical.CauseOfDeathNotRelatedAPeriod = ucItemCauseOfDeathNotRelatedA.Days + ucItemCauseOfDeathNotRelatedA.Months + ucItemCauseOfDeathNotRelatedA.Years;

        deadMedical.CauseOfDeathNotRelatedB = ucItemCauseOfDeathNotRelatedB.SelectedICD;
        deadMedical.CauseOfDeathNotRelatedBPeriod = ucItemCauseOfDeathNotRelatedB.Days + ucItemCauseOfDeathNotRelatedB.Months + ucItemCauseOfDeathNotRelatedB.Years;

        deadMedical.IsSmoker = radioListISSmoker.SelectedValue == "1" ? true : false;
        deadMedical.SmokeType = radioListSmokingType.SelectedValue;
        deadMedical.SmokePeriod = (txtsmokingPeriod1.Text.Length == 1 ? "0" + txtsmokingPeriod1.Text : txtsmokingPeriod1.Text) +
                                  (txtsmokingPeriod2.Text.Length == 1 ? "0" + txtsmokingPeriod2.Text : txtsmokingPeriod2.Text);

        deadMedical.IsCausedByAccedent = rdCauseByAccedenc.SelectedValue == "1" ? true : false;
        deadMedical.AccedentCause = int.Parse(drpReason.SelectedValue);
        deadMedical.AccedentPlace = txtAccidentLocation.Text;
        deadMedical.AccedentAnotherCause = txtAnotherReason.Text;
        deadMedical.VehicleType = int.Parse(dropCarType.SelectedValue);
        deadMedical.VehicleTypeOther = txtCarType.Text;
        deadMedical.DeadStatus = int.Parse(RdDeadPersonType.SelectedValue);

        deadMedical.HasTumor = rdTumorFlag.SelectedValue == "1" ? true : false;
        deadMedical.PlaceOfTumor = txtTumorLocation.Text;
        deadMedical.TypeOfTumor = int.Parse(dropTumorType.SelectedValue);
        deadMedical.PhaseOfTumor = int.Parse(dropTumorPhases.SelectedValue);

        deadMedical.DeadThroghCarry = rdDeathThroughCarry.SelectedValue == "1" ? true : false;
        deadMedical.DeadThroghBirth = rdDeadThroughBirth.SelectedValue == "1" ? true : false;
        deadMedical.AbortionPast6Weeks = rdAbortionPast6Weeks.SelectedValue == "1" ? true : false;
        //   deadMedical.DeadThroghBirth = rdDeadThroughBirth.SelectedValue == "1" ? true : false;
        deadMedical.BirthPast6Weeks = rdBirthPast6Weeks.SelectedValue == "1" ? true : false;
        DateTime testInputDate;
        if (DateTime.TryParse(txtDate.Text, out testInputDate))
        {
            IFormatProvider culture = new CultureInfo("en-US", true);
            deadMedical.BirthDate = DateTime.ParseExact(txtDate.Text, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture);
        }
        deadMedical.BirthResult = int.Parse(dropBirthOuput.SelectedValue);
        deadMedical.BirthPlace = txtBirthLocation.Text;
        deadMedical.BirthOperator = txtBirthOperator.Text;

        deadMedical.Save();

        // update Dead record to indecate about medical info completion.
        Dead dead = new Dead();
        dead.LoadByPrimaryKey(ParmDeadEventID);
        dead.HasHealthData = true;
        dead.Save();
    }
 protected void btnApprove_Click(object sender, EventArgs e)
 {
     Dead dead = new Dead();
     if (dead.ApproveDeadInfo(ParmDeadEventID))
     {
         Response.Redirect("BornResult.aspx?ApproveDead=1");
     }
     else
     {
         MHOCommon.ShowMessage("عفوا هناك خطا فى البيانات", this.Page);
     }
 }
예제 #45
0
    //Set stage for game, creating characters and the simple GUI implemented.
    public void Start()
    {
        instance = this;
        //construct our 2d array based on the value set in the editor
        distances = new float[numberOfvillagers, numberOfvillagers];

        //reference to Vehicle script component for each flocker
        //Flocking flocker; // reference to flocker scripts
        Villager villager;
        Werewolf werewolf;
        Follow follower;

        obstacles = GameObject.FindGameObjectsWithTag ("Obstacle");

        mayor = GameObject.FindGameObjectWithTag ("Mayor");

        for (int i = 0; i < numberOfvillagers; i++) {
            //Instantiate a flocker prefab, catch the reference, cast it to a GameObject
            //and add it to our list all in one line.
            villagers.Add ((GameObject)Instantiate (villagerPrefab,
                new Vector3 (600 + 5 * i, 5, 400), Quaternion.identity));
            //grab a component reference
            villager = villagers [i].GetComponent<Villager> ();
            // HOW ABOUT NO //villagers[i].GetComponent<MeshRenderer>().material.SetColor("_Color", Color.green);
            //set values in the Vehicle script
            villager.Index = i;

            VillageFollowers.Add((GameObject)Instantiate(followerPrefab,
                new Vector3(600 + 5 * i, 150,400), Quaternion.identity));

            //Create a follower for the minimap
            follower = VillageFollowers[i].GetComponent<Follow> ();
            follower.ToFollow = villagers[i];
            //VillageFollowers[i].GetComponent<MeshRenderer>().material.SetColor("_Color", Color.green);
            villager.Follower = follower;

        }

        for (int i=0; i < numberOfWerewolves; i++)
        {
            if(i == 0)
            {
                werewolves.Add( (GameObject)Instantiate(werewolfPrefab,
                new Vector3(491, 35, 931), Quaternion.identity));
            }
            else if(i == 1)
            {
                werewolves.Add( (GameObject)Instantiate(werewolfPrefab,
                new Vector3(930, 35, 441), Quaternion.identity));
            }
            else if(i == 2)
            {
                werewolves.Add( (GameObject)Instantiate(werewolfPrefab,
                new Vector3(385, 35, 50), Quaternion.identity));
            }
            else if(i == 3)
            {
                werewolves.Add( (GameObject)Instantiate(werewolfPrefab,
                new Vector3(89, 35, 489), Quaternion.identity));
            }
            else
            {
                werewolves.Add( (GameObject)Instantiate(werewolfPrefab,
                new Vector3(700 + 5 * i, 5, 600), Quaternion.identity));
            }

            //grab a component reference
            werewolf = werewolves [i].GetComponent<Werewolf>();
            werewolves[i].GetComponent<MeshRenderer>().material.SetColor("_Color",Color.red);
            //set value in the Vehicle script
            werewolf.Index = i;

            WerewolfFollowers.Add((GameObject)Instantiate(followerPrefab,
                new Vector3(600 + 5 * i, 150,400), Quaternion.identity));
            follower = WerewolfFollowers[i].GetComponent<Follow> ();
            follower.ToFollow = werewolves[i];
            WerewolfFollowers[i].GetComponent<MeshRenderer>().material.SetColor("_Color", Color.red);

        }

        //references to GUI texts in Game
        savedText = GameObject.FindGameObjectWithTag("Saved").GetComponent<Saved>();
        deadText = GameObject.FindGameObjectWithTag("Dead").GetComponent<Dead>();
    }
    protected void btnSearch_Click(object sender, EventArgs e)
    {
        lblSelectedICD.Text = "";
        int gender = 0;
        Guid eventid = new Guid(Request.QueryString["DeadEventID"].ToString());
        Dead dead = new Dead();
        dead.LoadByPrimaryKey(eventid);
        if (dead.DeadGender == 1)
            gender = 2;
        else
            gender = 1;
        //ICDCODE9000 objICD = new ICDCODE9000();
        ICD10_MainDeathReason objICD = new ICD10_MainDeathReason();
        if (txtSearch.Text != "")
        {
            DataTable dt = objICD.FilterICDcodes(txtSearch.Text.Trim(), gender);

            if (dt.Rows.Count > 0)
            {
                dropItem.DataSource = dt.DefaultView;
                //dropItem.DataTextField = ICDCODE9000.ColumnNames.DESCRENG;
                //dropItem.DataValueField = ICDCODE9000.ColumnNames.CODE;
                dropItem.DataTextField = ICD10_MainDeathReason.ColumnNames.Causename;
                dropItem.DataValueField = ICD10_MainDeathReason.ColumnNames.Code;
                dropItem.DataBind();

                ListItem item = new ListItem(" ", "0");
                dropItem.Items.Insert(0, item);
                dropItem.SelectedIndex = 0;
            }
            else
            {
                dropItem.Items.Clear();
                dropItem.DataSource = null;
                dropItem.DataBind();
            }
        }
        else
        {
            dropItem.Items.Clear();
            dropItem.DataSource = null;
            dropItem.DataBind();
        }
    }
    private bool LogicValidation()
    {
        #region Check If Death Case Exist

        Dead objDead = new Dead();
        if (DeadEventIDParameter != null)
        {
            // update case

            //now we want to be sure that we validating in not Unknown case.
            if (!IsLostCase || (IsLostCase && (rdTypeList.SelectedValue != "1" && rdTypeList.SelectedValue != "2")))
            {

                if ((UcDeathInfo2.EventDeadNID != currentDeadData.NationalIden)
                        ||
                        (
                        UcDeathInfo2.EventDeadFristName != currentDeadData.FirstName ||
                        UcDeathInfo2.EventDeadFatherName != currentDeadData.FatherName ||
                        UcDeathInfo2.EventDeadFamilyName != currentDeadData.FamilyName ||
                        UcDeathInfo2.EventDeadTitle != currentDeadData.SureName
                        )
                    )
                {
                    if (objDead.IsDeathCaseExist(UcDeathInfo2.EventDeadNID, UcDeathInfo2.EventDeadFristName
                                                , UcDeathInfo2.EventDeadFatherName,
                                                 UcDeathInfo2.EventDeadFamilyName,
                                                 UcDeathInfo2.EventDeadTitle, currentDeadData._oldRegDate))
                    {
                        MHOCommon.ShowMessage("بيانات المتوفى موجودة من قبل برجاء مراجعة البيانات و اعادة المحاولة", this.Page);
                        return false;
                    }
                }
            }
        }
        else
        {
            // add new case.
            // we want to be sure that we validating in not Unknown case.
            if (!IsLostCase || (IsLostCase && (rdTypeList.SelectedValue != "1" && rdTypeList.SelectedValue != "2")))
            {
                if (objDead.IsDeathCaseExist(UcDeathInfo2.EventDeadNID, UcDeathInfo2.EventDeadFristName
                                                , UcDeathInfo2.EventDeadFatherName,
                                                 UcDeathInfo2.EventDeadFamilyName,
                                                 UcDeathInfo2.EventDeadTitle, ""))
                {
                    MHOCommon.ShowMessage("بيانات المتوفى موجودة من قبل برجاء مراجعة البيانات و اعادة المحاولة", this.Page);
                    return false;
                }
            }
        }

        #endregion

        #region Check for Date versus National IDs

        if (UcDeathInfo2.EventDeadNID.Trim() != "0" && UcDeathInfo2.EventDeadNID.Trim().Length == 14)
        {
            // Dead has National ID
            if (MHOCommon.GetDateFromNID(UcDeathInfo2.EventDeadNID) != DateTime.Parse(UcDeathInfo2.EventDeadBirthDate))
            {
                MHOCommon.ShowMessage("تاريخ ميلاد المتوفى يجب ان يتوافق مع رقمه القومى", this.Page);
                return false;
            }

            if (UcMotherInfo2.ParentNID.Trim() != "0" && UcMotherInfo2.ParentNID.Trim().Length == 14)
            {
                if (MHOCommon.GetDateFromNID(UcDeathInfo2.EventDeadNID) <= MHOCommon.GetDateFromNID(UcMotherInfo2.ParentNID))
                {
                    MHOCommon.ShowMessage("سن المتوفى لابد ان يكون اصغر من سن الام", this.Page);
                    return false;
                }
            }
        }

        try
        {
            DateTime.Parse(UcDeathInfo2.EventDeadBirthDate.Trim());
        }
        catch (Exception ex)
        {
            MHOCommon.ShowMessage("خطأ فى تاريخ ميلاد المتوفى", this.Page);
            return false;
        }

        try
        {
            DateTime.Parse(UcGeneralDeathInfo1.EventDeadDieDate);
        }
        catch (Exception ex)
        {
            MHOCommon.ShowMessage("خطأ فى تاريخ الوفاة", this.Page);
            return false;
        }

        #endregion

        if (!IsLostCase && DeadEventIDParameter == null)
        {
            //if (DateTime.Today.AddDays(-3) > DateTime.Parse(UcGeneralDeathInfo1.EventDeadDieDate))
            //{
            //    MHOCommon.ShowMessage("تاريخ تسجيل الوفاة غير صحيح", this.Page);
            //    return false;
            //}
        }
        if (DateTime.Parse(UcDeathInfo2.EventDeadBirthDate) > DateTime.Today)
        {
            MHOCommon.ShowMessage("تاريخ ميلاد المتوفى غير صحيح", this.Page);
            return false;
        }
        if (UcDeathInfo2.EventDeadNID.Trim() == UcNotifierInfo2.NotifierNID.Trim())
        {
            MHOCommon.ShowMessage("الرقم القومى للمبلغ لا يمكن ان يكون نفس الرقم القومى للمتوفى", this.Page);
            return false;
        }

        if (UcDeathInfo2.EventDeadNID.Trim() == UcMotherInfo2.ParentNID.Trim() && UcMotherInfo2.ParentNID.Trim()  != "0")
        {
            MHOCommon.ShowMessage("الرقم القومى للام لا يمكن ان يكون نفس الرقم القومى للمتوفى", this.Page);
            return false;
        }

        if (DateTime.Parse(UcDeathInfo2.EventDeadBirthDate) > DateTime.Parse(UcGeneralDeathInfo1.EventDeadDieDate))
        {
            MHOCommon.ShowMessage("تاريخ الوفاة لابد ان يكون بعد تاريخ الميلاد", this.Page);
            return false;
        }
        if (DateTime.Parse(UcGeneralDeathInfo1.EventDeadDieDate).Date > DateTime.Today.Date)
        {
            MHOCommon.ShowMessage("تاريخ وفاة المتوفى غير صحيح", this.Page);
            return false;
        }
        if ((UcMotherInfo2.ParentNID == UcNotifierInfo2.NotifierNID) && UcNotifierInfo2.NotifierRelation == 4)
        {
            MHOCommon.ShowMessage("لقد قمت بادخال الرقم القومى للام فى بيانات المبلغ فى حين ان المبلغ هو الاخت", this.Page);
            return false;
        }
        if ((UcMotherInfo2.ParentNID == UcNotifierInfo2.NotifierNID) && UcNotifierInfo2.NotifierRelation != 2)
        {
            MHOCommon.ShowMessage("لقد قمت بادخال الرقم القومى للام فى بيانات المبلغ فى حين ان المبلغ ليس الأم", this.Page);
            return false;
        }

        if ((DateTime.Now.Year - DateTime.Parse(UcDeathInfo2.EventDeadBirthDate).Year < 18 ) && UcDeathInfo2.EventDeadCardType == 2)
        {
            MHOCommon.ShowMessage("نوع البطاقة غير متوافق مع سن المتوفى", this.Page);
            return false;
        }

        if (!IsLostCase && !MHOCommon.ValidateNationalIDInput(UcDeathInfo2.EventDeadNID, UcDeathInfo2.EventDeadGender != 1))
        {
            MHOCommon.ShowMessage(MHOCommon.NIDValidationMessage + "\\nبيانات المتوفى", this.Page);
            return false;
        }

        if (IsLostCase)
        {
            health_office objHealthOffice = new health_office();
            if (DeadEventIDParameter != null)
            {
                // update case
                if (currentDescisionNo != DecisionControl1.DecisionNumber)
                {
                    if (objHealthOffice.IsDecisionNumberExisit(DecisionControl1.DecisionNumber, MHOCommon.CurrentOrgID.Value, false))
                    {
                        MHOCommon.ShowMessage("عفوا رقم القرار موجود من قبل", this.Page);
                        return false;
                    }
                }
            }
            else
            {
                if (objHealthOffice.IsDecisionNumberExisit(DecisionControl1.DecisionNumber, MHOCommon.CurrentOrgID.Value, false))
                {
                    MHOCommon.ShowMessage("عفوا رقم القرار موجود من قبل", this.Page);
                    return false;
                }
            }

            if (rdTypeList.SelectedValue != "1")
            {
                if (DateTime.Today.AddYears(-1).Date > DateTime.Parse(UcGeneralDeathInfo1.EventDeadDieDate))
                {
                    MHOCommon.ShowMessage("تاريخ تسجيل الوفاة غير صحيح", this.Page);
                    return false;
                }
                if (DecisionControl1.DecisionDate == null)
                {
                    MHOCommon.ShowMessage("تاريخ القرار غير صحيح", this.Page);
                    return false;
                }
                if (DecisionControl1.DecisionDate.Value.Date > DateTime.Today.Date)
                {
                    MHOCommon.ShowMessage("تاريخ القرار غير صحيح", this.Page);
                    return false;
                }

                if (DateTime.Parse(UcDeathInfo2.EventDeadBirthDate) > DateTime.Today)
                {
                    MHOCommon.ShowMessage("تاريخ ميلاد المتوفى غير صحيح", this.Page);
                    return false;
                }

                if (DateTime.Today.AddDays(-1).Date <= DateTime.Parse(UcGeneralDeathInfo1.EventDeadDieDate))
                {
                    MHOCommon.ShowMessage("تاريخ تسجيل الوفاة غير صحيح", this.Page);
                    return false;
                }

                //TimeSpan dateDiff = UcBornInfo1.EventBirthDate.Subtract(DecisionControl1.DecisionDate);
                //if (dateDiff.Days < 15)
                if (DecisionControl1.DecisionDate.Value.AddDays(-1).Date < DateTime.Parse(UcGeneralDeathInfo1.EventDeadDieDate) ||
                    DateTime.Parse(UcDeathInfo2.EventDeadBirthDate) > DateTime.Parse(UcGeneralDeathInfo1.EventDeadDieDate))
                {
                    MHOCommon.ShowMessage("تاريخ القرار غير صحيح", this.Page);
                    return false;
                }

            }
            else
            {
                if (DecisionControl1.DecisionDate == null)
                {
                    MHOCommon.ShowMessage("تاريخ القرار غير صحيح", this.Page);
                    return false;
                }
                // مجهول الهوية
                if (DateTime.Parse(UcDeathInfo2.EventDeadBirthDate).Date > DateTime.Today.Date)
                {
                    MHOCommon.ShowMessage("تاريخ ميلاد المتوفى غير صحيح", this.Page);
                    return false;
                }
                if (DateTime.Parse(UcGeneralDeathInfo1.EventDeadDieDate).Date > DateTime.Today.Date)
                {
                    MHOCommon.ShowMessage("تاريخ وفاة المتوفى غير صحيح", this.Page);
                    return false;
                }
                if (DecisionControl1.DecisionDate.Value.Date > DateTime.Today.Date)
                {
                    MHOCommon.ShowMessage("تاريخ القرار غير صحيح", this.Page);
                    return false;
                }

                TimeSpan dateDiff = DateTime.Parse(UcGeneralDeathInfo1.EventDeadDieDate).Subtract(DecisionControl1.DecisionDate.Value);
                if (dateDiff.Days > 0)
                {
                    MHOCommon.ShowMessage("تاريخ القرار غير صحيح", this.Page);
                    return false;
                }
            }
        }
        return true;
    }
    protected void UpdateDeathData()
    {
        if (DeadEventIDParameter != null)
        {
            Dead objDead = new Dead();
            objDead.Where.DeadEventID.Value = DeadEventIDParameter.Value;
            objDead.Where.DeadEventID.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal;
            if (objDead.Query.Load())
            {
                objDead.OrgID = MHOCommon.CurrentOrgID.Value;
                objDead.DeadNID = UcDeathInfo2.EventDeadNID;
                objDead.DeadAge = "2";
                objDead.DeadGender = UcDeathInfo2.EventDeadGender;
                objDead.DeadFirstName = UcDeathInfo2.EventDeadFristName;
                objDead.DeadFatherName = UcDeathInfo2.EventDeadFatherName;
                objDead.DeadGrandName = UcDeathInfo2.EventDeadFamilyName;
                objDead.DeadFamilyName = UcDeathInfo2.EventDeadTitle;
                objDead.DeadNationality = UcDeathInfo2.EventDeadNationality;
                objDead.DeadReligion = UcDeathInfo2.EventDeadReligion;
                objDead.DeadMartialStatus = UcDeathInfo2.EventDeadMartialStatus;
                objDead.ProveText = UcDeathInfo2.ProveType;
                objDead.ProveNumber = UcDeathInfo2.ProveNo;
                objDead.PaperID = UcDeathInfo2.EventDeadCardNo;
                objDead.PaperIDType = UcDeathInfo2.EventDeadCardType;
                objDead.PaperIssuePlace = UcDeathInfo2.EventCardLocation;
                objDead.AddressNo = UcAddressInfo1.EventDeadAddressNo;
                objDead.AddressStreet = UcAddressInfo1.EventDeadAddressStreet;
                objDead.AddressFeatured = UcAddressInfo1.EventDeadAddressSign;
                objDead.DeadGovernorate = UcAddressInfo1.DeadAddressGovernate;
                objDead.DeadSection = UcAddressInfo1.DeadAddressPoliceStation;
                objDead.DeadArea = UcAddressInfo1.DeadAddressArea;
                objDead.DeadPhone = UcAddressInfo1.EventDeadAddressPhone;

                objDead.DeadFamilyPhone = UcAddressInfo1.EventDeadAddressFamilyPhone;

                objDead.DeadJob = UcAddressInfo1.EventDeadAddressJob;
                objDead.DeadJobDesc = UcGeneralDeathInfo1.EventDeadJobDescription;

                objDead.DeadBirthDate = DateTime.Parse(UcDeathInfo2.EventDeadBirthDate);
                objDead.DeadDieDate = DateTime.Parse(UcGeneralDeathInfo1.EventDeadDieDate);
                objDead.DiePlace = UcGeneralDeathInfo1.EventDeadPlace;
                objDead.DiePlaceDescription = UcGeneralDeathInfo1.EventDeadPlaceDescription;
                objDead.DeadDieHour = UcGeneralDeathInfo1.EventDeadDieHour;
                objDead.DeadDieMin = UcGeneralDeathInfo1.EventDeadDieMin;
                objDead.Approved = false;
                objDead.HasHealthData = false;
                objDead.IsBornDead = (rdTypeList.SelectedValue == "2");
                //objDead.DieGovernorate = 19;
                //objDead.DieSection = 43;
                //objDead.DieArea = 19;

                if (IsLostCase)
                {
                    if (DecisionControl1.DecisionNumber != string.Empty)
                    {
                        objDead.DeadDecisionNo = DecisionControl1.DecisionNumber;
                    }
                    if (DecisionControl1.DecisionDirectionValue != string.Empty)
                    {
                        objDead.DeadDecisionDirection = DecisionControl1.DecisionDirectionValue;
                    }
                    if (DecisionControl1.DecisionDate.Value.ToShortDateString() != string.Empty)
                    {
                        objDead.DeadDecisionDate = DateTime.Parse(DecisionControl1.DecisionDate.Value.ToShortDateString());
                    }
                    if (DecisionControl1.NotesValue == string.Empty)
                    {
                        objDead.DeadDecisionNotes = DecisionControl1.NotesValue;
                    }
                    objDead.IsUnKown = rdTypeList.SelectedValue == "1" ? true : false;
                }
                objDead.DeadMotherNID = UcMotherInfo2.ParentNID;
                objDead.DeadMotherNationality = UcMotherInfo2.ParentNationality;
                objDead.DeadMotherFirstName = UcMotherInfo2.ParentFirstName;
                objDead.DeadMotherSecondName = UcMotherInfo2.ParentFatherName;
                objDead.DeadMotherFamilyName = UcMotherInfo2.ParentFamilyName;
                objDead.DaadMotherSureName = UcMotherInfo2.ParentSureName;
                objDead.DeadMotherReligion = UcMotherInfo2.ParentRelegion;
                objDead.MotherProveNumber = UcMotherInfo2.ProveNo;
                objDead.MotherProveText = UcMotherInfo2.ProveType;
                objDead.DeadMotherJob = UcMotherInfo2.ParentJob;
                objDead.InformerRelation = UcNotifierInfo2.NotifierRelation;
                objDead.InformerPhone = UcNotifierInfo2.NotifierphoneNo;
                objDead.InformerNID = UcNotifierInfo2.NotifierNID;
                objDead.InformerFirstName = UcNotifierInfo2.NotifierFName;
                objDead.InformerSecondName = UcNotifierInfo2.NotifierFatherName;
                objDead.InformerAddress = UcNotifierInfo2.NotifierAddress;
                //objDead.InformerAddress = UcNotifierInfo2.
                objDead.RegisterID = new Guid(drpRegestierNoList.Value);
                //objDead.RegisterNo = Convert.ToInt32(txtRecordNumber.Text);
                objDead.RegisterNo = Convert.ToInt32(uiLabelRecordNo.Text);
                objDead.Save();
            }

        }
    }
예제 #49
0
    private void InsertDeathCase()
    {
        Dead objDead = new Dead();
        objDead.AddNew();
        objDead.OrgID = MHOCommon.CurrentOrgID.Value;
        objDead.DeadNID = UcDeathInfo2.EventDeadNID;
        objDead.DeadAge = "2";
        objDead.DeadGender = UcDeathInfo2.EventDeadGender;
        objDead.DeadFirstName = UcDeathInfo2.EventDeadFristName;
        objDead.DeadFatherName = UcDeathInfo2.EventDeadFatherName;
        objDead.DeadGrandName = UcDeathInfo2.EventDeadFamilyName;
        objDead.DeadFamilyName = UcDeathInfo2.EventDeadTitle;
        objDead.DeadNationality = UcDeathInfo2.EventDeadNationality;
        objDead.DeadReligion = UcDeathInfo2.EventDeadReligion;
        objDead.DeadMartialStatus = UcDeathInfo2.EventDeadMartialStatus;
        objDead.ProveText = UcDeathInfo2.ProveType;
        objDead.ProveNumber = UcDeathInfo2.ProveNo;
        objDead.IsUnKown = false;
        if (IsLostCase)
        {
            if (DecisionControl1.DecisionNumber != string.Empty)
            {
                objDead.DeadDecisionNo = DecisionControl1.DecisionNumber;
            }
            if (DecisionControl1.DecisionDirectionValue != string.Empty)
            {
                objDead.DeadDecisionDirection = DecisionControl1.DecisionDirectionValue;
            }
            if (DecisionControl1.DecisionDate.Value.ToShortDateString() != string.Empty)
            {
                objDead.DeadDecisionDate = DateTime.Parse(DecisionControl1.DecisionDate.Value.ToShortDateString());
            }
            if (DecisionControl1.NotesValue == string.Empty)
            {
                objDead.DeadDecisionNotes = DecisionControl1.NotesValue;
            }
            objDead.IsUnKown = rdTypeList.SelectedValue == "1" ? true : false;
        }

        objDead.PaperID = UcDeathInfo2.EventDeadCardNo;
        objDead.PaperIDType = UcDeathInfo2.EventDeadCardType;
        objDead.PaperIssuePlace = UcDeathInfo2.EventCardLocation;
        objDead.AddressNo = UcAddressInfo1.EventDeadAddressNo;
        objDead.AddressStreet = UcAddressInfo1.EventDeadAddressStreet;
        objDead.AddressFeatured = UcAddressInfo1.EventDeadAddressSign;
        objDead.DeadGovernorate = UcAddressInfo1.DeadAddressGovernate;
        objDead.DeadSection = UcAddressInfo1.DeadAddressPoliceStation;
        objDead.DeadArea = UcAddressInfo1.DeadAddressArea;
        objDead.DeadPhone = UcAddressInfo1.EventDeadAddressPhone;
        objDead.DeadJob = UcAddressInfo1.EventDeadAddressJob;
        objDead.DeadBirthDate = DateTime.Parse(UcDeathInfo2.EventDeadBirthDate);
        objDead.DeadDieDate = DateTime.Parse(UcGeneralDeathInfo1.EventDeadDieDate);
        objDead.DiePlace = UcGeneralDeathInfo1.EventDeadPlace;
        objDead.DiePlaceDescription = UcGeneralDeathInfo1.EventDeadPlaceDescription;
        objDead.DeadDieHour = UcGeneralDeathInfo1.EventDeadDieHour;
        objDead.DeadDieMin = UcGeneralDeathInfo1.EventDeadDieMin;
        objDead.Approved = false;
        objDead.HasHealthData = false;
        //TODO: uncomment me
        if (MHOCommon.CurrentOrgGovID != 0 && MHOCommon.CurrentOrgAreaID != 0 && MHOCommon.CurrentOrgPoliceStationID != 0)
        {
            objDead.DieGovernorate = MHOCommon.CurrentOrgGovID;
            objDead.DieSection = MHOCommon.CurrentOrgPoliceStationID;
            objDead.DieArea = MHOCommon.CurrentOrgAreaID;
        }

        objDead.DeadMotherNID = UcMotherInfo2.ParentNID;
        objDead.DeadMotherNationality = UcMotherInfo2.ParentNationality;
        objDead.DeadMotherFirstName = UcMotherInfo2.ParentFirstName;
        objDead.DeadMotherSecondName = UcMotherInfo2.ParentFatherName;
        objDead.DeadMotherFamilyName = UcMotherInfo2.ParentFamilyName;
        objDead.DeadMotherReligion = UcMotherInfo2.ParentRelegion;
        objDead.DaadMotherSureName = UcMotherInfo2.ParentSureName;
        objDead.MotherProveNumber = UcMotherInfo2.ProveNo;
        objDead.MotherProveText = UcMotherInfo2.ProveType;
        objDead.DeadMotherJob = UcMotherInfo2.ParentJob;
        objDead.InformerRelation = UcNotifierInfo2.NotifierRelation;
        objDead.InformerPhone = UcNotifierInfo2.NotifierphoneNo;
        objDead.InformerNID = UcNotifierInfo2.NotifierNID;
        objDead.InformerFirstName = UcNotifierInfo2.NotifierFName;
        objDead.InformerSecondName = UcNotifierInfo2.NotifierFatherName;
        //objDead.InformerAddress = UcNotifierInfo2.
        objDead.RegisterID = new Guid(drpRegestierNoList.Value);
        objDead.RegisterNo = Convert.ToInt32(txtRecordNumber.Text);
        objDead.RegisterDate = DateTime.Now.Date;
        objDead.Save();
        Response.Redirect("ProcessResult.aspx");
    }