Пример #1
0
        private string CreateUpdateTestMsg(SampleTestMsg data, List <Sample_QA_Resultdet> sUB_RES)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("{");
            sb.Append("\r\n\t\"DOCNO\":");
            sb.Append("\"" + data.hdnQaDOCNO + "\",");
            //sb.Append("\r\n\t\"CURDATE\":");
            //sb.Append("\"" + GetDateTimeOffset(DateTime.Now.ToString(), "00:00") + "\",");
            sb.Append("\r\n\t\"PARTNAME\":");
            sb.Append("\"" + data.hdnQaPARTNAME + "\",");
            sb.Append("\r\n\t\"SUPNAME\":");
            sb.Append("\"" + data.hdnQaSUPNAME + "\",");
            if (data.txtQaRESULTANT.ToLower().Equals("on") && Convert.ToInt32(data.hdnQaREPETITION) == 0)
            {
                Update_Normal_MED_RESULTDET_SUBFORM(data, sUB_RES, ref sb);
            }
            else if (data.txtQaRESULTANT.ToLower().Equals("on") && Convert.ToInt32(data.hdnQaREPETITION) > 0)
            {
                Update_Normal_MED_RESULTDET_SUBFORM(data, sUB_RES, ref sb);
            }
            else
            {
                Update_Normal_MED_RESULTDET_SUBFORM(data, sUB_RES, ref sb);
            }

            sb.Append("}"); // End msg

            AppLogger.log.Info("CreateUpdateTestMsg ==> msg = " + sb.ToString());
            return(sb.ToString());
        }
Пример #2
0
        private string CreateJsonMsg(SampleTestMsg sampleTestMsg, List <Attachments> files)
        {
            StringBuilder sb  = new StringBuilder();
            int           idx = 0;

            sb.Append("{");
            sb.Append("\r\n\t\"DOCNO\":");
            sb.Append("\"" + sampleTestMsg.hdnQaDOCNO + "\",");
            sb.Append("\r\n\t\"PARTNAME\":");
            sb.Append("\"" + sampleTestMsg.hdnQaPARTNAME + "\",");
            sb.Append("\r\n\t\"SUPNAME\":");
            sb.Append("\"" + sampleTestMsg.hdnQaSUPNAME + "\",");
            sb.Append("\r\n\t\"MED_EXTFILES_SUBFORM\": [");
            foreach (Attachments item in files)
            {
                idx++;
                if ((idx > 1) && (idx <= files.Count))
                {
                    sb.Append(",");
                }

                sb.Append("\r\n\t{");
                sb.Append("\r\n\t\"EXTFILEDES\":");
                sb.Append("\"" + sampleTestMsg.hdnQaDOCNO + "_" + item.FILE_NAME + "\",");
                sb.Append("\r\n\t\"EXTFILENAME\":");
                sb.Append("\"" + item.EXTFILENAME.Replace(@"\", @"\\") + "\",");
                sb.Append("\r\n\t\"SUFFIX\":");
                sb.Append("\"" + item.EXTFILENAME.Split('.')[1] + "\"");
                sb.Append("\r\n\t}");
            }
            sb.Append("\r\n\t]"); //End Sub form
            sb.Append("}");       // End msg

            return(sb.ToString());
        }
Пример #3
0
        internal ResultAPI UpdateTest(SampleTestMsg data, List <Sample_QA_Resultdet> sUB_RES)
        {
            string    reqBody = CreateUpdateTestMsg(data, sUB_RES);
            ResultAPI ra      = Call_PATCH(reqBody);

            return(ra);
        }
Пример #4
0
        internal ResultAPI UploadSampleAttachments(SampleTestMsg sampleTestMsg, List <Attachments> files)
        {
            ResultAPI ra    = null;
            string    query = CreateJsonMsg(sampleTestMsg, files);

            ra = Call_PATCH(query);

            return(ra);
        }
Пример #5
0
        private void Update_Normal_MED_RESULTDET_SUBFORM(SampleTestMsg data, List <Sample_QA_Resultdet> sUB_RES, ref StringBuilder sb)
        {
            /*
             * {
             * "DOCNO": "C2000001488",
             * "CURDATE": "2020-03-24T00:00:00+02:00",
             * "PARTNAME": "23559000",
             * "SUPNAME": "20523",
             * "MED_TRANSSAMPLEQA_SUBFORM": [
             * {
             * "QA": 7,
             * "QACODE": "007",
             * "LOCATION": "2",
             * "RESULT": 12.00000,
             * "REMARK": null
             * }]
             * }
             */
            //SubForm
            sb.Append("\r\n\t\"MED_TRANSSAMPLEQA_SUBFORM\": [");
            sb.Append("\r\n\t{");
            sb.Append("\r\n\t\"QA\":");
            sb.Append(Convert.ToInt32(data.hdnQA) + ",");
            sb.Append("\r\n\t\"QACODE\":");
            sb.Append("\"" + data.hdnQACODE + "\",");
            sb.Append("\r\n\t\"LOCATION\":");
            sb.Append("\"" + data.hdnLOCATION + "\",");
            if (data.txtQaRESULTANT.ToLower().Equals("on"))     //אם תוצאתית
            {
                if (Convert.ToInt32(data.hdnQaREPETITION) == 0) // אם מספר חזרות = 0
                {
                    sb.Append("\r\n\t\"RESULT\":");
                    sb.Append(Convert.ToDouble(data.txtQaRESULT) + ",");
                }
            }
            else
            {
                if (data.txtQaNORMAL.ToLower().Equals("y"))// עדכון ערך בשדה 'תקין'  בלבד
                {
                    sb.Append("\r\n\t\"NORMAL\":");
                    sb.Append("\"Y\",");
                }
                else if (data.txtQaNORMAL.ToLower().Equals("n"))
                {
                    sb.Append("\r\n\t\"NORMAL\":");
                    sb.Append("\"N\",");
                }
                else
                {
                    sb.Append("\r\n\t\"NORMAL\":");
                    sb.Append("\"\",");
                }
            }
            sb.Append("\r\n\t\"EFI_MEASURESUPTOOLS\":");
            sb.Append("\"" + data.txtQaEFI_MEASURESUPTOOLS + "\",");
            sb.Append("\r\n\t\"REMARK\":");
            sb.Append("\"" + data.txtQaREMARK + "\",");
            sb.Append("\r\n\t\"EFI_CRITICALFLAG\":");
            sb.Append("\"" + data.txtQaEFI_CRITICALFLAG + "\"");
            //If needed then creat sub form for MED_RESULTDET_SUBFORM
            if ((data.txtQaRESULTANT.ToLower().Equals("on") && (Convert.ToInt32(data.hdnQaREPETITION) > 0)) && ((null != sUB_RES) && (sUB_RES.Count > 0)))
            {
                sb.Append(",");
                // To do: Update grandsun screen
                sb.Append("\r\n\t\"MED_RESULTDET_SUBFORM\": [");
                int ind = 0;
                foreach (Sample_QA_Resultdet item in sUB_RES)
                {
                    ind++;
                    if ((null == item.KLINE) || (null == item.RESULT))
                    {
                        continue;
                    }

                    if ((ind > 1) && (ind <= sUB_RES.Count))
                    {
                        sb.Append(",");
                    }

                    sb.Append("\r\n\t{");
                    sb.Append("\r\n\t\"KLINE\":");
                    sb.Append(item.KLINE.Value + ",");
                    sb.Append("\r\n\t\"RESULT\":");
                    sb.Append(item.RESULT.Value);
                    sb.Append("\r\n\t}");
                }
                sb.Append("\r\n\t]"); //End Sub form
            }
            sb.Append("\r\n\t}");
            sb.Append("\r\n\t]"); //End Sub form
        }