コード例 #1
0
        public bool UploadITPInfo(string sSessionId, string sUser, string sId, ref string sRtnMsg)
        {
            try
            {
                clsTabletDB.ITPDocumentSection ITP = new clsTabletDB.ITPDocumentSection();
                clsTabletDB.ITPHeaderTable ITPHdr = new clsTabletDB.ITPHeaderTable();
                DataSet ds = ITP.GetAllLocalITPSectionQuestions(sId);
                string sSendString = "ITPUploadQuestionnaireInfo~";
                int i;
                int iRows = ds.Tables[0].Rows.Count;
                int iCol;
                int iAutoId;
                string sProjId;
                int iSectionId;
                string sQuestion;
                int iYes;
                int iNo;
                int iNA;
                bool bYes;
                bool bNo;
                bool bNA;
                string sComments;
                string sAudit_DateStamp;

                for (i = 0; i < iRows; i++)
                {
                    iCol = ds.Tables[0].Columns["AutoId"].Ordinal;
                    iAutoId = Convert.ToInt32(ds.Tables[0].Rows[i].ItemArray[iCol]);

                    iCol = ds.Tables[0].Columns["Id"].Ordinal;
                    sProjId = ds.Tables[0].Rows[i].ItemArray[iCol].ToString();

                    iCol = ds.Tables[0].Columns["SectionId"].Ordinal;
                    iSectionId = Convert.ToInt32(ds.Tables[0].Rows[i].ItemArray[iCol]);

                    iCol = ds.Tables[0].Columns["Question"].Ordinal;
                    sQuestion = ds.Tables[0].Rows[i].ItemArray[iCol].ToString();

                    iCol = ds.Tables[0].Columns["Yes"].Ordinal;
                    bYes = Convert.ToBoolean(ds.Tables[0].Rows[i].ItemArray[iCol]);
                    if (bYes)
                    {
                        iYes = 1;
                    }
                    else
                    {
                        iYes = 0;
                    }

                    iCol = ds.Tables[0].Columns["No"].Ordinal;
                    bNo = Convert.ToBoolean(ds.Tables[0].Rows[i].ItemArray[iCol]);
                    if (bNo)
                    {
                        iNo = 1;
                    }
                    else
                    {
                        iNo = 0;
                    }

                    iCol = ds.Tables[0].Columns["NA"].Ordinal;
                    bNA = Convert.ToBoolean(ds.Tables[0].Rows[i].ItemArray[iCol]);
                    if (bNA)
                    {
                        iNA = 1;
                    }
                    else
                    {
                        iNA = 0;
                    }

                    iCol = ds.Tables[0].Columns["Comments"].Ordinal;
                    sComments = ds.Tables[0].Rows[i].ItemArray[iCol].ToString();

                    iCol = ds.Tables[0].Columns["Audit_DateStamp"].Ordinal;
                    sAudit_DateStamp = ds.Tables[0].Rows[i].ItemArray[iCol].ToString();

                    sSendString += iAutoId + "^" + sProjId + "^" + iSectionId + "^" + sQuestion + "^" + iYes + "^" + iNo + "^" + iNA + "^" + sComments + "^" + sAudit_DateStamp + "||";
                }

                if (sSendString.Length > 2)
                {
                    sSendString = sSendString.Substring(0, sSendString.Length - 2);
                }

                clsLocalUtils util = new clsLocalUtils();
                string sURL = util.GetEnvironment_wbsURL("wbsITP_External");
                wbsITP_External ws = new wbsITP_External();
                ws.Url = sURL;
                object[] objListITP = ws.SetITPUploadInfo(sSessionId, sUser, sSendString);
                if (objListITP[0].ToString() == "Success")
                {
                    object[] objListITPStatus = ws.SetITPStatus(sSessionId, sUser, sId, 0);
                    if (objListITPStatus[0].ToString() == "Success")
                    {
                        //Now also mark them the same locally
                        if (!ITPHdr.MarkLocalITPDownloaded(sId, 1, ref sRtnMsg))
                        {
                            return false;
                        }
                        else
                        {
                            return true;
                        }
                    }
                    else
                    {
                        sRtnMsg = objListITPStatus[1].ToString();
                        return false;
                    }
                }
                else
                {
                    sRtnMsg = objListITP[1].ToString();
                    return false;
                }
            }
            catch (Exception ex)
            {
                sRtnMsg = ex.Message.ToString();
                return false;
            }
        }
コード例 #2
0
 public bool MarkITPDownloaded(string sSessionId, string sUser, string sId, ref string sRtnMsg)
 {
     try
     {
         clsTabletDB.ITPHeaderTable ITP = new clsTabletDB.ITPHeaderTable();
         clsLocalUtils util = new clsLocalUtils();
         string sURL = util.GetEnvironment_wbsURL("wbsITP_External");
         wbsITP_External ws = new wbsITP_External();
         ws.Url = sURL;
         object[] objListITP = ws.SetITPStatus(sSessionId, sUser, sId, 1);
         if (objListITP[0].ToString() == "Success")
         {
             //Now also mark them the same locally
             if (!ITP.MarkLocalITPDownloaded(sId, 0, ref sRtnMsg))
             {
                 return false;
             }
             else
             {
                 return true;
             }
         }
         else
         {
             sRtnMsg = objListITP[1].ToString();
             return false;
         }
     }
     catch (Exception ex)
     {
         sRtnMsg = ex.Message.ToString();
         return false;
     }
 }