Пример #1
0
        private void cmdJsonTest_Click(object sender, RoutedEventArgs e)
        {
            // 1. Serize Object to JSON format
            PointData p1 = new PointData();

            rawdata rd1 = new rawdata();

            rd1.chartid = "1";
            rd1.pointid = "1";
            rd1.waferid = "TEST.1";
            rd1.value   = 20.12324;

            rawdata rd2 = new rawdata();

            rd2.chartid = "1";
            rd2.pointid = "2";
            rd2.waferid = "TEST.1";
            rd2.value   = 18.12324;

            p1.chartid    = "1";
            p1.range      = 0;
            p1.sigma      = 0;
            p1.xbar       = 0;
            p1.chartseq   = 1;
            p1.lstRawData = new List <rawdata>();
            p1.lstRawData.Add(rd1);
            p1.lstRawData.Add(rd2);

            string jsonValue1 = JsonConvert.SerializeObject(p1);

            myRedisDB.SetAdd(txtKeyToStore.Text, jsonValue1);
            ShowLog("Json Test-add key[" + txtKeyToStore.Text + "]. data in json=" + jsonValue1);

            PointData p2 = new PointData();

            rawdata rd3 = new rawdata();

            rd3.chartid = "1";
            rd3.pointid = "3";
            rd3.waferid = "TEST.2";
            rd3.value   = 2.12324;

            rawdata rd4 = new rawdata();

            rd3.chartid   = "1";
            rd3.pointid   = "4";
            rd3.waferid   = "TEST.2";
            rd3.value     = 1.12324;
            p2.chartid    = "1";
            p2.range      = 1;
            p2.sigma      = 1;
            p2.xbar       = 1;
            p2.chartseq   = 2;
            p2.lstRawData = new List <rawdata>();
            p2.lstRawData.Add(rd3);
            p2.lstRawData.Add(rd4);

            string jsonValue2 = JsonConvert.SerializeObject(p2);

            myRedisDB.SetAdd(txtKeyToStore.Text, jsonValue2);
            ShowLog("Json Test-add key[" + txtKeyToStore.Text + "]. data in json=" + jsonValue2);

            // 2. De-serize JSON data to object
            if (!myRedisDB.KeyExists(txtKeyToStore.Text))
            {
                return;
            }

            foreach (RedisValue tValue in myRedisDB.SetMembers(txtKeyToStore.Text))
            {
                ShowLog("member in set[" + txtKeyToStore.Text + "] JSON= " + tValue.ToString());
                PointData jsondata = JsonConvert.DeserializeObject <PointData>(tValue.ToString());
                ShowLog("de-serize complete-jsondata=" + jsondata.ToString());
            }
        }
Пример #2
0
        //[EnableCors("MyPolicy")]
        public IActionResult AddPatientDetailsToDb([FromBody] rawdata rawdata)
        {
            var P_Details = new PatientDetailModel();

            P_Details.POBPatientID                 = rawdata.POBPatientID;
            P_Details.PatientID                    = rawdata.PatientID;
            P_Details.FirstName                    = rawdata.FirstName;
            P_Details.LastName                     = rawdata.LastName;
            P_Details.MiddleNames                  = rawdata.MiddleNames;
            P_Details.Email                        = rawdata.Email;
            P_Details.Title                        = rawdata.Title;
            P_Details.Gender                       = rawdata.Gender;
            P_Details.DateOfBirth                  = rawdata.DateOfBirth;
            P_Details.Height                       = rawdata.Height;
            P_Details.WeightKg                     = rawdata.WeightKg;
            P_Details.BMI                          = rawdata.BMI;
            P_Details.Handedness                   = rawdata.Handedness;
            P_Details.Mobile                       = rawdata.Mobile;
            P_Details.StreetAddressID              = rawdata.StreetAddressID;
            P_Details.FamilyDoctor                 = rawdata.FamilyDoctor;
            P_Details.LastVisit                    = rawdata.LastVisit;
            P_Details.WhyLastVisit                 = rawdata.WhyLastVisit;
            P_Details.CountryID                    = rawdata.CountryID;
            P_Details.CreateUserID                 = rawdata.CreateUserID;
            P_Details.KnownAsCode                  = rawdata.KnownAsCode;
            P_Details.FreeSearch                   = rawdata.FreeSearch;
            P_Details.OnboardCode                  = rawdata.OnboardCode;
            P_Details.SelectedEntityType           = rawdata.SelectedEntityType;
            P_Details.PreviousWorkCompClaim        = rawdata.PreviousWorkCompClaim;
            P_Details.PreviousWorkCompClaimDetails = rawdata.PreviousWorkCompClaimDetails;

            PatientDetailsService.AddPatientDetailsToDb(P_Details);


            var P_Emp_Details = new PatientEmploymentModel();

            P_Emp_Details.POBPatientEmploymentID = rawdata.POBPatientEmploymentID;
            P_Emp_Details.POBPatientID           = rawdata.POBPatientID;
            P_Emp_Details.CreateDate             = rawdata.CreateDate;
            P_Emp_Details.CreateUserID           = rawdata.CreateUserID;
            P_Emp_Details.CurrentPosition        = rawdata.CurrentPosition;
            P_Emp_Details.EmpStartDate           = rawdata.EmpStartDate;
            P_Emp_Details.EmpDepartment          = rawdata.EmpDepartment;
            P_Emp_Details.CurrentDutiesID        = rawdata.CurrentDutiesID;
            P_Emp_Details.EmploymentStatusID     = rawdata.EmploymentStatusID;
            P_Emp_Details.OccupationID           = rawdata.OccupationID;

            PatientEmploymentService.AddPatienEmploymentToDb(P_Emp_Details);



            var P_Loc_Details = new PatientLocationModel();

            P_Loc_Details.AddressID     = rawdata.AddressID;
            P_Loc_Details.Line1         = rawdata.Line1;
            P_Loc_Details.Line2         = rawdata.Line2;
            P_Loc_Details.Suburb        = rawdata.Suburb;
            P_Loc_Details.StateID       = rawdata.StateID;
            P_Loc_Details.PostCode      = rawdata.PostCode;
            P_Loc_Details.AddressRegion = rawdata.AddressRegion;
            P_Loc_Details.LogUserID     = rawdata.LogUserID;

            PatientLocationService.AddLocationToDB(P_Loc_Details);



            return(Ok());
        }