Exemplo n.º 1
0
        private void playPossitionIfEmpty(Point pointPlayed)//checking if move is playable and returns the outcome
        {
            bool    sucessfull = true;
            OutCome outCome = new OutCome();
            int     x = pointPlayed.X, y = pointPlayed.Y;

            if (x < 0 || y < 0 || x > BoardSize || y > BoardSize)
            {
                sucessfull = false;
            }
            if (boardInt[x, y] != empty)
            {
                sucessfull = false;
            }
            movesAvelable--;
            boardInt[x, y] = currentPlayer.id;
            outCome        = new OutCome(currentPlayer, boardInt, false, false, false, pointPlayed);
            if (checkWin(x, y))
            {
                outCome.victory = true;
                outCome.ended   = true;
            }
            if (checkdraw())
            {
                outCome.ended = true;
            }
            sucessfull         = true;
            outCome.succesfull = sucessfull;
            output(outCome);
        }
Exemplo n.º 2
0
        public void addOutcome(string id, OutCome outcome)
        {
            var obId = ObjectId.GenerateNewId();
            CProgramOutStandards cStandard = new CProgramOutStandards();
            var POSExist = cStandard.findfromsubject(id);

            if (!(POSExist is null))
            {
                POSExist.OutComes.Add(outcome);
                this.mongo.Update <ProgramOutStandards>("ProgramOutStandards", POSExist._id, POSExist);
            }
Exemplo n.º 3
0
        private void outcomeListRandomizer(List <OutCome> listToRandomize)
        {
            Random r = new Random();

            //  Randomize items in list
            //  http://en.wikipedia.org/wiki/Fisher-Yates_shuffle
            Console.WriteLine("Randomizing list");
            for (int n = listToRandomize.Count - 1; n > 0; --n)
            {
                int     k    = r.Next(n + 1);
                OutCome temp = listToRandomize[n];
                listToRandomize[n] = listToRandomize[k];
                listToRandomize[k] = temp;
            }
        }
Exemplo n.º 4
0
        public UCProgramOutStandardsEdit(string subId, string POSId, Panel pnl_container, string isAdmin)
        {
            InitializeComponent();
            count                     = 0;
            this.isAdmin              = isAdmin;
            this.subId                = subId;
            this.POSId                = POSId;
            this.pnl_container        = pnl_container;
            outcome                   = cPOS.findfromsubject(subId).OutComes.Where(c => c.ID_CDR == POSId).SingleOrDefault();
            this.txt_CDRID.Text       = outcome.ID_CDR;
            this.txt_Description.Text = outcome.Description_CDR;
            this.txt_CDR.Text         = outcome.ID_CDIO[0].ToString();

            CDIOs = outcome.ID_CDIO;
            max   = outcome.ID_CDIO.Count();
            if (max != 0)
            {
                min = 1;
            }
            else
            {
                min = 0;
            }
        }
        public string GetPatientMasterVisitId(int PatientId, DateTime visitDate, string EncounterType, int ServiceAreaId, int UserId)
        {
            PatientMasterVisitManager pmvManager       = new PatientMasterVisitManager();
            List <PatientMasterVisit> pmv              = new List <PatientMasterVisit>();
            PatientEncounterLogic     patientEncounter = new PatientEncounterLogic();
            OutCome ResultOutcome = new OutCome();

            pmv = pmvManager.GetPatientMasterVisitBasedonVisitDate(PatientId, visitDate);
            if (pmv != null)
            {
                if (pmv.Count > 0)
                {
                    MasterVisitId = pmv[0].Id;
                }
            }


            if (MasterVisitId > 0)
            {
                Result = patientEncounter.SavePatientPreviousEncounter(PatientId, MasterVisitId, EncounterType, ServiceAreaId, Convert.ToInt32(Session["AppUserId"]), visitDate);
                if (Result > 0)
                {
                    ResultOutcome.Result = MasterVisitId;
                    ResultOutcome.Msg    = EncounterType + " Encounter Saved";
                }
            }
            else
            {
                var lookupLogic = new LookupLogic();
                var facility    = lookupLogic.GetFacility(Session["AppPosID"].ToString());
                if (facility == null)
                {
                    facility = lookupLogic.GetFacility();
                }

                PatientMasterVisit pm = new PatientMasterVisit();
                pm.ServiceId  = 1;
                pm.VisitDate  = visitDate;
                pm.VisitBy    = UserId;
                pm.Start      = visitDate;
                pm.End        = visitDate;
                pm.PatientId  = PatientId;
                pm.CreatedBy  = UserId;
                pm.Active     = true;
                pm.Status     = 2;
                pm.FacilityId = facility.FacilityID;

                int PatientMasterVisitId = pmvManager.AddPatientMasterVisit(pm);

                int res = patientEncounter.SavePatientPreviousEncounter(PatientId, PatientMasterVisitId, EncounterType, ServiceAreaId, Convert.ToInt32(Session["AppUserId"]), visitDate);
                if (res > 0)
                {
                    Result = PatientMasterVisitId;
                    ResultOutcome.Result = Result;
                    ResultOutcome.Msg    = EncounterType + "Encounter Saved";
                }
            }
            string jsonScreeningObject = "[]";

            jsonScreeningObject = new JavaScriptSerializer().Serialize(ResultOutcome);
            return(jsonScreeningObject);
        }
Exemplo n.º 6
0
        //****************Helpers Functions***********************************

        // function used as delegate for converting all items in outcome list to string
        private String outComeToString(OutCome outcome)
        {
            return(outcome.ToString());
        }