예제 #1
0
 public object[] DownloadProjectITPSection10(string sSessionId, string sUser, string sId)
 {
     try
     {
         clsLocalUtils util = new clsLocalUtils();
         string sURL = util.GetEnvironment_wbsURL("wbsITP_External");
         wbsITP_External ws = new wbsITP_External();
         ws.Url = sURL;
         object[] objListITPs = ws.GetITPProjectSection10Info(sSessionId, sUser, sId);
         return objListITPs;
     }
     catch (Exception ex)
     {
         object[] objListITPs = new object[2];
         objListITPs[0] = "Failure";
         objListITPs[1] = ex.Message.ToString();
         return objListITPs;
     }
 }
예제 #2
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;
            }
        }
예제 #3
0
 public object[] GetITPsForDownload(string sSessionId, string sUser)
 {
     try
     {
         clsLocalUtils util = new clsLocalUtils();
         string sURL = util.GetEnvironment_wbsURL("wbsITP_External");
         wbsITP_External ws = new wbsITP_External();
         ws.Url = sURL;
         object[] objListITPs = ws.GetSubcontractorITPsForDownload(sSessionId, sUser);
         return objListITPs;
     }
     catch (Exception ex)
     {
         object[] objListITPs = new object[2];
         objListITPs[0] = "Failure";
         objListITPs[1] = ex.Message.ToString();
         return objListITPs;
     }
 }
예제 #4
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;
     }
 }
예제 #5
0
 public bool FillITPTypeMainTable(string sSessionId, string sUser, ref string sRtnMsg)
 {
     try
     {
         ITPStaticTable Static = new ITPStaticTable();
         double dNewVersionNumber = 0.0;
         //Only do all of this if the version has changed. So get the local versoin umber and compare to that on the DB. If different do all of this. - WRITE LATER as a general function
         bool bNewVersion = Static.IsNewVersionOfTable(sSessionId, sUser, sITPTypeTableName, ref dNewVersionNumber);
         if (!DB.TableExists(sITPTypeTableName) || bNewVersion)
         {
             clsLocalUtils util = new clsLocalUtils();
             string sURL = util.GetEnvironment_wbsURL("wbsITP_External");
             wbsITP_External ws = new wbsITP_External();
             ws.Url = sURL;
             object[] objQuestions = ws.GetITPFullITPTypeInfo(sSessionId, sUser);
             if (objQuestions[0].ToString() == "Success")
             {
                 if (TableITPTypeDeleteAllRecords(ref sRtnMsg))
                 {
                     string sITPDocumentQuestionnaireInfo = objQuestions[1].ToString();
                     string[] sHeaderInfo = sITPDocumentQuestionnaireInfo.Split('~');
                     if (sHeaderInfo[0] == "ITPTypeInfo")
                     {
                         string[] delimiters = new string[] { "||" };
                         string[] sQuestionnaireItems = sHeaderInfo[1].Split(delimiters, StringSplitOptions.RemoveEmptyEntries);
                         int iQuestionCount = sQuestionnaireItems.Length;
                         if (iQuestionCount > 0)
                         {
                             //First check if the ITPType table exists and if not create it
                             if (CheckFullITPTypeTable())
                             {
                                 for (int i = 0; i < iQuestionCount; i++)
                                 {
                                     string[] delimiters2 = new string[] { "^" };
                                     string[] sQuestionItems = sQuestionnaireItems[i].Split(delimiters2, StringSplitOptions.None);
                                     TableITPTypeAddRecord(sQuestionItems);
                                 }
                             }
                         }
                     }
                 }
                 //Update the version number locally
                 Static.UpdateVersionNumber(sITPTypeTableName, dNewVersionNumber);
                 return true;
             }
             else
             {
                 sRtnMsg = objQuestions[1].ToString();
                 return false;
             }
         }
         else
         {
             //This means you don't have to fill this static table
             return true;
         }
     }
     catch (Exception ex)
     {
         sRtnMsg = "Failure" + ex.Message.ToString();
         return false;
     }
 }