示例#1
0
        int GetSQLTourArrayList(List<Tour> sqlTours, string query)
        {
            StoredProc sp = new StoredProc(query);
            DataTable dt = new DataTable();
            int nRet = sp.RunQuery(dt);
            sp.Dispose();
            foreach (DataRow dr in dt.Rows)
            {
                Tour tr = new Tour();
                tr.TourTitle = Convert.ToString(dr["TourTitle"]);
                tr.TourGuid = new Guid(dr["TourGUID"].ToString());
                tr.TourDescription = Convert.ToString(dr["TourDescription"]);
                tr.AuthorEmailAddress = Convert.ToString(dr["AuthorEmailAddress"]);
                tr.AuthorName = Convert.ToString(dr["AuthorName"]);
                tr.AuthorURL = Convert.ToString(dr["AuthorURL"]);
                tr.AverageRating = Convert.ToDouble(dr["AverageRating"]);
                tr.LengthInSecs = Convert.ToInt32(dr["LengthInSecs"]);
                tr.OrganizationURL = Convert.ToString(dr["OrganizationURL"]);
                tr.OrganizationName = Convert.ToString(dr["OrganizationName"]);
                sqlTours.Add(tr);
            }

            return 0;
        }
示例#2
0
        public static int GetSQLTourArrayList(List<Tour> sqlTours)
        {
            string strErrorMsg;
            //int version = -1;
            DateTime dtBeginDateTime;
            DateTime dtEndDateTime;
            int ordCol;
            Guid tourguid;
            string tourtitle;
            string workflowstatuscode;
            DateTime toursubmitteddatetime;
            DateTime tourapproveddatetime;
            DateTime tourrejecteddatetime;
            string tourapprovedrejectedbyname;
            string tourdescription;
            string tourattributionandcredits;
            string authorname;
            string authoremailaddress;
            string authorurl;
            string authorsecondaryemailaddress;
            string authorcontactphonenumber;
            string authorcontacttext;
            string organizationname;
            string organizationurl;
            string tourkeywordlist;
            string tourithlist;
            string tourastroobjectlist;
            string tourexplicittourlinklist;
            int lengthinsecs;
            string tourxml;
            double averageRating;

            strErrorMsg = "";
            SqlConnection myConnection5 = GetConnectionWwtTours();

            dtBeginDateTime = Convert.ToDateTime("1/1/1900");
            dtEndDateTime = Convert.ToDateTime("1/1/2100");

            try
            {
                myConnection5.Open();

                SqlCommand cmd = null;
                cmd = new SqlCommand();
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandTimeout = 20;
                cmd.Connection = myConnection5;

                cmd.CommandText = "spGetWWTToursForDateRange";

                SqlParameter custParm = new SqlParameter("@pBeginDateTime", SqlDbType.DateTime);
                custParm.Value = dtBeginDateTime;
                cmd.Parameters.Add(custParm);

                SqlParameter custParm2 = new SqlParameter("@pEndDateTime", SqlDbType.DateTime);
                custParm2.Value = dtEndDateTime;
                cmd.Parameters.Add(custParm2);

                System.Data.SqlClient.SqlDataReader mySqlReader;
                mySqlReader = cmd.ExecuteReader();
                while (mySqlReader.Read())
                {
                    ordCol = mySqlReader.GetOrdinal("TourGUID");
                    tourguid = mySqlReader.GetGuid(ordCol);
                    ordCol = mySqlReader.GetOrdinal("TourTitle");
                    if (mySqlReader[ordCol] != DBNull.Value)
                    {
                        tourtitle = mySqlReader.GetString(ordCol);
                    }
                    else
                    {
                        tourtitle = null;
                    }

                    ordCol = mySqlReader.GetOrdinal("WorkFlowStatusCode");
                    if (mySqlReader[ordCol] != DBNull.Value)
                    {
                        workflowstatuscode = mySqlReader.GetString(ordCol);
                    }
                    else
                    {
                        workflowstatuscode = null;
                    }

                    ordCol = mySqlReader.GetOrdinal("TourSubmittedDateTime");
                    if (mySqlReader[ordCol] != DBNull.Value)
                    {
                        toursubmitteddatetime = Convert.ToDateTime(mySqlReader.GetSqlDateTime(ordCol).ToString());
                    }
                    else
                    {
                        toursubmitteddatetime = DateTime.MinValue;
                    }

                    ordCol = mySqlReader.GetOrdinal("TourApprovedDateTime");
                    if (mySqlReader[ordCol] != DBNull.Value)
                    {
                        tourapproveddatetime = Convert.ToDateTime(mySqlReader.GetSqlDateTime(ordCol).ToString());
                    }
                    else
                    {
                        tourapproveddatetime = DateTime.MinValue;
                    }

                    ordCol = mySqlReader.GetOrdinal("TourRejectedDateTime");
                    if (mySqlReader[ordCol] != DBNull.Value)
                    {
                        tourrejecteddatetime = Convert.ToDateTime(mySqlReader.GetSqlDateTime(ordCol).ToString());
                    }
                    else
                    {
                        tourrejecteddatetime = DateTime.MinValue;
                    }

                    ordCol = mySqlReader.GetOrdinal("TourApprovedRejectedByName");
                    if (mySqlReader[ordCol] != DBNull.Value)
                    {
                        tourapprovedrejectedbyname = mySqlReader.GetString(ordCol);
                    }
                    else
                    {
                        tourapprovedrejectedbyname = null;
                    }

                    ordCol = mySqlReader.GetOrdinal("TourDescription");
                    if (mySqlReader[ordCol] != DBNull.Value)
                    {
                        tourdescription = mySqlReader.GetString(ordCol);
                    }
                    else
                    {
                        tourdescription = null;
                    }

                    ordCol = mySqlReader.GetOrdinal("TourAttributionAndCredits");
                    if (mySqlReader[ordCol] != DBNull.Value)
                    {
                        tourattributionandcredits = mySqlReader.GetString(ordCol);
                    }
                    else
                    {
                        tourattributionandcredits = null;
                    }

                    ordCol = mySqlReader.GetOrdinal("AuthorName");
                    if (mySqlReader[ordCol] != DBNull.Value)
                    {
                        authorname = mySqlReader.GetString(ordCol);
                    }
                    else
                    {
                        authorname = null;
                    }

                    ordCol = mySqlReader.GetOrdinal("AuthorEmailAddress");
                    if (mySqlReader[ordCol] != DBNull.Value)
                    {
                        authoremailaddress = mySqlReader.GetString(ordCol);
                    }
                    else
                    {
                        authoremailaddress = null;
                    }

                    ordCol = mySqlReader.GetOrdinal("AuthorURL");
                    if (mySqlReader[ordCol] != DBNull.Value)
                    {
                        authorurl = mySqlReader.GetString(ordCol);
                    }
                    else
                    {
                        authorurl = null;
                    }

                    ordCol = mySqlReader.GetOrdinal("AuthorSecondaryEmailAddress");
                    if (mySqlReader[ordCol] != DBNull.Value)
                    {
                        authorsecondaryemailaddress = mySqlReader.GetString(ordCol);
                    }
                    else
                    {
                        authorsecondaryemailaddress = null;
                    }

                    ordCol = mySqlReader.GetOrdinal("AuthorContactPhoneNumber");
                    if (mySqlReader[ordCol] != DBNull.Value)
                    {
                        authorcontactphonenumber = mySqlReader.GetString(ordCol);
                    }
                    else
                    {
                        authorcontactphonenumber = null;
                    }

                    ordCol = mySqlReader.GetOrdinal("AuthorContactText");
                    if (mySqlReader[ordCol] != DBNull.Value)
                    {
                        authorcontacttext = mySqlReader.GetString(ordCol);
                    }
                    else
                    {
                        authorcontacttext = null;
                    }

                    ordCol = mySqlReader.GetOrdinal("OrganizationName");
                    if (mySqlReader[ordCol] != DBNull.Value)
                    {
                        organizationname = mySqlReader.GetString(ordCol);
                    }
                    else
                    {
                        organizationname = null;
                    }

                    ordCol = mySqlReader.GetOrdinal("OrganizationURL");
                    if (mySqlReader[ordCol] != DBNull.Value)
                    {
                        organizationurl = mySqlReader.GetString(ordCol);
                    }
                    else
                    {
                        organizationurl = null;
                    }

                    ordCol = mySqlReader.GetOrdinal("TourKeywordList");
                    if (mySqlReader[ordCol] != DBNull.Value)
                    {
                        tourkeywordlist = mySqlReader.GetString(ordCol);
                    }
                    else
                    {
                        tourkeywordlist = null;
                    }

                    ordCol = mySqlReader.GetOrdinal("TourITHList");
                    if (mySqlReader[ordCol] != DBNull.Value)
                    {
                        tourithlist = mySqlReader.GetString(ordCol);
                    }
                    else
                    {
                        tourithlist = null;
                    }

                    ordCol = mySqlReader.GetOrdinal("TourAstroObjectList");
                    if (mySqlReader[ordCol] != DBNull.Value)
                    {
                        tourastroobjectlist = mySqlReader.GetString(ordCol);
                    }
                    else
                    {
                        tourastroobjectlist = null;
                    }

                    ordCol = mySqlReader.GetOrdinal("TourExplicitTourLinkList");
                    if (mySqlReader[ordCol] != DBNull.Value)
                    {
                        tourexplicittourlinklist = mySqlReader.GetString(ordCol);
                    }
                    else
                    {
                        tourexplicittourlinklist = null;
                    }

                    ordCol = mySqlReader.GetOrdinal("LengthInSecs");
                    if (mySqlReader[ordCol] != DBNull.Value)
                    {
                        lengthinsecs = mySqlReader.GetInt32(ordCol);
                    }
                    else
                    {
                        lengthinsecs = -1;
                    }

                    ordCol = mySqlReader.GetOrdinal("AverageRating");
                    if (mySqlReader[ordCol] != DBNull.Value)
                    {
                        averageRating = mySqlReader.GetDouble(ordCol);
                    }
                    else
                    {
                        averageRating = 0;
                    }
                    //OrdCol = MySQLReader.GetOrdinal("TourXML");
                    //if (MySQLReader[OrdCol] != DBNull.Value)
                    //{
                    //    tourxml = MySQLReader.GetString(OrdCol);
                    //}
                    //else
                    //{
                    //    tourxml = null;
                    //}



                    Tour loadTour = new Tour();

                    loadTour.TourGuid = tourguid;
                    loadTour.TourTitle = tourtitle;
                    if (workflowstatuscode != null)
                    { loadTour.WorkFlowStatusCode = workflowstatuscode; }
                    if (toursubmitteddatetime != null)
                    { loadTour.TourSubmittedDateTime = toursubmitteddatetime; }
                    if (tourapproveddatetime != null)
                    { loadTour.TourApprovedDateTime = tourapproveddatetime; }
                    if (tourrejecteddatetime != null)
                    { loadTour.TourRejectedDateTime = tourrejecteddatetime; }

                    //loadTour.TourApprovedRejectedByName = tourapprovedrejectedbyname;
                    loadTour.TourDescription = tourdescription;
                    loadTour.TourAttributionAndCredits = tourattributionandcredits;
                    loadTour.AuthorName = authorname;
                    loadTour.AuthorEmailAddress = authoremailaddress;
                    loadTour.AuthorURL = authorurl;
                    loadTour.AuthorSecondaryEmailAddress = authorsecondaryemailaddress;
                    loadTour.AuthorContactPhoneNumber = authorcontactphonenumber;
                    loadTour.AuthorContactText = authorcontacttext;
                    loadTour.OrganizationName = organizationname;
                    loadTour.OrganizationURL = organizationurl;
                    loadTour.TourKeywordList = tourkeywordlist;
                    //loadTour.TourITHList - tourithlist;
                    loadTour.TourAstroObjectList = tourastroobjectlist;
                    loadTour.TourExplicitTourLinkList = tourexplicittourlinklist;
                    loadTour.LengthInSecs = lengthinsecs;
                    loadTour.AverageRating = averageRating;
                    //loadTour.TourXML = tourxml;

                    sqlTours.Add(loadTour);
                }

            }
            catch (InvalidCastException)
            { }

            catch (Exception ex)
            {
                //throw ex.GetBaseException();
                strErrorMsg = ex.Message;
                return -1;
            }
            finally
            {
                if (myConnection5.State == ConnectionState.Open)
                    myConnection5.Close();
            }

            return 0;
        }
示例#3
0
            public WWTTourForDateRange(string BeginDateTime, string EndDateTime)
            {
                Tour cacheTour;
                int  TourFoundPtr = -1;

                int x = UpdateCache();

                List <Tour> whatiscache = GetCache();

                List <Tour> SelectedTours = new List <Tour>();

                DateTime dtBeginDateTime;
                DateTime dtEndDateTime;

                try
                {
                    dtBeginDateTime = Convert.ToDateTime(BeginDateTime);
                }
                catch
                {
                    dtBeginDateTime = Convert.ToDateTime("1/1/1900");
                }

                try
                {
                    dtEndDateTime = Convert.ToDateTime(EndDateTime);
                }
                catch
                {
                    dtEndDateTime = Convert.ToDateTime("1/1/2100");
                }

                // loop thru cache - find the matching keywords
                for (int c = 0; c < whatiscache.Count; c++)
                {
                    cacheTour = new Tour();
                    cacheTour = (Tour)whatiscache[c];
                    DateTime myDateTime = cacheTour.TourSubmittedDateTime;
                    if (myDateTime >= dtBeginDateTime & myDateTime <= dtEndDateTime)  //(myGuidStr == TourGUID)
                    {
                        TourFoundPtr = c;
                        SelectedTours.Add(cacheTour);
                    }
                }
                if (TourFoundPtr > -1)
                {
                    ds2 = SelectedTours;
                }
                else
                {
                    strErrorMsg = "";

                    SqlConnection myConnection5 = Database.GetConnectionWWTTours();


                    try
                    {
                        myConnection5.Open();
                        SqlDataAdapter Cmd2 = new SqlDataAdapter("spGetWWTToursForDateRange", myConnection5);

                        Cmd2.SelectCommand.CommandType = CommandType.StoredProcedure;

                        SqlParameter CustParm = new SqlParameter("@pBeginDateTime", SqlDbType.DateTime);
                        CustParm.Value = dtBeginDateTime;
                        Cmd2.SelectCommand.Parameters.Add(CustParm);

                        SqlParameter CustParm2 = new SqlParameter("@pEndDateTime", SqlDbType.DateTime);
                        CustParm2.Value = dtEndDateTime;
                        Cmd2.SelectCommand.Parameters.Add(CustParm2);

                        ds = new WWTToursDataset();

                        Cmd2.Fill(ds, ds.Tables[0].TableName);
                    }
                    catch (Exception ex)
                    {
                        throw
                            WWTWebService.RaiseException("GetToursForDateRange", "http://WWTWebServices", ex.Message, "2000", "GetToursForDateRange", WWTWebService.FaultCode.Client);
                    }
                    finally
                    {
                        if (myConnection5.State == ConnectionState.Open)
                        {
                            myConnection5.Close();
                        }
                    }
                }
            }
示例#4
0
            public WWTTourForGUID(string TourGUID)
            {
                strErrorMsg = "";
                SqlConnection myConnection5 = Database.GetConnectionWWTTours();

                Tour cacheTour;
                int  GuidFoundPtr = -1;

                try
                {
                    int x = UpdateCache();

                    List <Tour> whatiscache = GetCache();

                    List <Tour> SelectedTours = new List <Tour>();

                    // loop thru cache - find the GUID
                    for (int c = 0; c < whatiscache.Count; c++)
                    {
                        cacheTour = new Tour();
                        cacheTour = (Tour)whatiscache[c];
                        string myGuidStr = cacheTour.TourGuid.ToString();
                        if (myGuidStr == TourGUID)
                        {
                            GuidFoundPtr = c;
                            SelectedTours.Add(cacheTour);
                        }
                    }
                    if (GuidFoundPtr > -1)
                    {
                        ds2 = SelectedTours;
                    }
                    else
                    {
                        myConnection5.Open();
                        SqlDataAdapter Cmd2 = new SqlDataAdapter("spGetWWTToursForGUID", myConnection5);

                        Cmd2.SelectCommand.CommandType = CommandType.StoredProcedure;

                        SqlParameter CustParm = new SqlParameter("@pWWTTourGUID", SqlDbType.VarChar);
                        CustParm.Value = TourGUID;
                        Cmd2.SelectCommand.Parameters.Add(CustParm);

                        ds = new WWTToursDataset();

                        Cmd2.Fill(ds, ds.Tables[0].TableName);
                    }

                    //cacheTour = new Tour();
                    //cacheTour = (Tour)whatiscache[0];
                    //string myName = cacheTour.AuthorName;
                }
                catch (Exception ex)
                {
                    throw
                        WWTWebService.RaiseException("WWTTourForGUID", "http://WWTWebServices", ex.Message, "2000", "WWTTourForGUID", WWTWebService.FaultCode.Client);
                }
                finally
                {
                    if (myConnection5.State == ConnectionState.Open)
                    {
                        myConnection5.Close();
                    }
                }
            }
示例#5
0
            public WWTTourForKeyword(string Keyword)
            {
                Tour cacheTour;
                int  TourFoundPtr = -1;

                int x = UpdateCache();

                List <Tour> whatiscache = GetCache();

                List <Tour> SelectedTours = new List <Tour>();

                // loop thru cache - find the matching keywords
                for (int c = 0; c < whatiscache.Count; c++)
                {
                    cacheTour = new Tour();
                    cacheTour = (Tour)whatiscache[c];
                    string myKeywords     = cacheTour.TourKeywordList;
                    char[] delimiterChars = { ' ' };
                    if (myKeywords != null)
                    {
                        string[] singleWord = myKeywords.Split(delimiterChars);
                        foreach (string s in singleWord)
                        {
                            if (s == Keyword)
                            {
                                if (TourFoundPtr != c)
                                {
                                    TourFoundPtr = c;
                                    SelectedTours.Add(cacheTour);
                                }
                            }
                        }
                    }
                }
                if (TourFoundPtr > -1)
                {
                    ds2 = SelectedTours;
                }
                else
                {
                    strErrorMsg = "";
                    SqlConnection myConnection5 = Database.GetConnectionWWTTours();

                    try
                    {
                        myConnection5.Open();
                        SqlDataAdapter Cmd2 = new SqlDataAdapter("spGetWWTToursForKeyword", myConnection5);

                        Cmd2.SelectCommand.CommandType = CommandType.StoredProcedure;

                        SqlParameter CustParm = new SqlParameter("@pKeyword", SqlDbType.NVarChar);
                        CustParm.Value = Keyword;
                        Cmd2.SelectCommand.Parameters.Add(CustParm);

                        ds = new WWTToursDataset();

                        Cmd2.Fill(ds, ds.Tables[0].TableName);
                    }
                    catch (Exception ex)
                    {
                        throw
                            WWTWebService.RaiseException("GetToursForKeyword", "http://WWTWebServices", ex.Message, "2000", "GetToursForKeyword", WWTWebService.FaultCode.Client);
                    }
                    finally
                    {
                        if (myConnection5.State == ConnectionState.Open)
                        {
                            myConnection5.Close();
                        }
                    }
                }
            }
示例#6
0
        public static int GetSQLTourArrayList(List <Tour> sqlTours)
        {
            string strErrorMsg;
            //int version = -1;
            DateTime dtBeginDateTime;
            DateTime dtEndDateTime;
            int      OrdCol;
            Guid     tourguid;
            string   tourtitle;
            string   workflowstatuscode;
            DateTime toursubmitteddatetime;
            DateTime tourapproveddatetime;
            DateTime tourrejecteddatetime;
            string   tourapprovedrejectedbyname;
            string   tourdescription;
            string   tourattributionandcredits;
            string   authorname;
            string   authoremailaddress;
            string   authorurl;
            string   authorsecondaryemailaddress;
            string   authorcontactphonenumber;
            string   authorcontacttext;
            string   organizationname;
            string   organizationurl;
            string   tourkeywordlist;
            string   tourithlist;
            string   tourastroobjectlist;
            string   tourexplicittourlinklist;
            int      lengthinsecs;
            double   averageRating;
            int      numberOfRatings;
            int      numberOfObjections;



            strErrorMsg = "";
            SqlConnection myConnection5 = Database.GetConnectionWWTTours();

            dtBeginDateTime = Convert.ToDateTime("1/1/1900");
            dtEndDateTime   = Convert.ToDateTime("1/1/2100");

            try
            {
                myConnection5.Open();

                SqlCommand Cmd = null;
                Cmd                = new SqlCommand();
                Cmd.CommandType    = CommandType.StoredProcedure;
                Cmd.CommandTimeout = 20;
                Cmd.Connection     = myConnection5;

                Cmd.CommandText = "spGetWWTToursForDateRange";

                SqlParameter CustParm = new SqlParameter("@pBeginDateTime", SqlDbType.DateTime);
                CustParm.Value = dtBeginDateTime;
                Cmd.Parameters.Add(CustParm);

                SqlParameter CustParm2 = new SqlParameter("@pEndDateTime", SqlDbType.DateTime);
                CustParm2.Value = dtEndDateTime;
                Cmd.Parameters.Add(CustParm2);

                System.Data.SqlClient.SqlDataReader MySQLReader;
                MySQLReader = Cmd.ExecuteReader();
                while (MySQLReader.Read())
                {
                    OrdCol   = MySQLReader.GetOrdinal("TourGUID");
                    tourguid = MySQLReader.GetGuid(OrdCol);
                    OrdCol   = MySQLReader.GetOrdinal("TourTitle");
                    if (MySQLReader[OrdCol] != DBNull.Value)
                    {
                        tourtitle = MySQLReader.GetString(OrdCol);
                    }
                    else
                    {
                        tourtitle = null;
                    }

                    OrdCol = MySQLReader.GetOrdinal("WorkFlowStatusCode");
                    if (MySQLReader[OrdCol] != DBNull.Value)
                    {
                        workflowstatuscode = MySQLReader.GetString(OrdCol);
                    }
                    else
                    {
                        workflowstatuscode = null;
                    }

                    OrdCol = MySQLReader.GetOrdinal("TourSubmittedDateTime");
                    if (MySQLReader[OrdCol] != DBNull.Value)
                    {
                        toursubmitteddatetime = Convert.ToDateTime(MySQLReader.GetSqlDateTime(OrdCol).ToString());
                    }
                    else
                    {
                        toursubmitteddatetime = DateTime.MinValue;
                    }

                    OrdCol = MySQLReader.GetOrdinal("TourApprovedDateTime");
                    if (MySQLReader[OrdCol] != DBNull.Value)
                    {
                        tourapproveddatetime = Convert.ToDateTime(MySQLReader.GetSqlDateTime(OrdCol).ToString());
                    }
                    else
                    {
                        tourapproveddatetime = DateTime.MinValue;
                    }

                    OrdCol = MySQLReader.GetOrdinal("TourRejectedDateTime");
                    if (MySQLReader[OrdCol] != DBNull.Value)
                    {
                        tourrejecteddatetime = Convert.ToDateTime(MySQLReader.GetSqlDateTime(OrdCol).ToString());
                    }
                    else
                    {
                        tourrejecteddatetime = DateTime.MinValue;
                    }

                    OrdCol = MySQLReader.GetOrdinal("TourApprovedRejectedByName");
                    if (MySQLReader[OrdCol] != DBNull.Value)
                    {
                        tourapprovedrejectedbyname = MySQLReader.GetString(OrdCol);
                    }
                    else
                    {
                        tourapprovedrejectedbyname = null;
                    }

                    OrdCol = MySQLReader.GetOrdinal("TourDescription");
                    if (MySQLReader[OrdCol] != DBNull.Value)
                    {
                        tourdescription = MySQLReader.GetString(OrdCol);
                    }
                    else
                    {
                        tourdescription = null;
                    }

                    OrdCol = MySQLReader.GetOrdinal("TourAttributionAndCredits");
                    if (MySQLReader[OrdCol] != DBNull.Value)
                    {
                        tourattributionandcredits = MySQLReader.GetString(OrdCol);
                    }
                    else
                    {
                        tourattributionandcredits = null;
                    }

                    OrdCol = MySQLReader.GetOrdinal("AuthorName");
                    if (MySQLReader[OrdCol] != DBNull.Value)
                    {
                        authorname = MySQLReader.GetString(OrdCol);
                    }
                    else
                    {
                        authorname = null;
                    }

                    OrdCol = MySQLReader.GetOrdinal("AuthorEmailAddress");
                    if (MySQLReader[OrdCol] != DBNull.Value)
                    {
                        authoremailaddress = MySQLReader.GetString(OrdCol);
                    }
                    else
                    {
                        authoremailaddress = null;
                    }

                    OrdCol = MySQLReader.GetOrdinal("AuthorURL");
                    if (MySQLReader[OrdCol] != DBNull.Value)
                    {
                        authorurl = MySQLReader.GetString(OrdCol);
                    }
                    else
                    {
                        authorurl = null;
                    }

                    OrdCol = MySQLReader.GetOrdinal("AuthorSecondaryEmailAddress");
                    if (MySQLReader[OrdCol] != DBNull.Value)
                    {
                        authorsecondaryemailaddress = MySQLReader.GetString(OrdCol);
                    }
                    else
                    {
                        authorsecondaryemailaddress = null;
                    }

                    OrdCol = MySQLReader.GetOrdinal("AuthorContactPhoneNumber");
                    if (MySQLReader[OrdCol] != DBNull.Value)
                    {
                        authorcontactphonenumber = MySQLReader.GetString(OrdCol);
                    }
                    else
                    {
                        authorcontactphonenumber = null;
                    }

                    OrdCol = MySQLReader.GetOrdinal("AuthorContactText");
                    if (MySQLReader[OrdCol] != DBNull.Value)
                    {
                        authorcontacttext = MySQLReader.GetString(OrdCol);
                    }
                    else
                    {
                        authorcontacttext = null;
                    }

                    OrdCol = MySQLReader.GetOrdinal("OrganizationName");
                    if (MySQLReader[OrdCol] != DBNull.Value)
                    {
                        organizationname = MySQLReader.GetString(OrdCol);
                    }
                    else
                    {
                        organizationname = null;
                    }

                    OrdCol = MySQLReader.GetOrdinal("OrganizationURL");
                    if (MySQLReader[OrdCol] != DBNull.Value)
                    {
                        organizationurl = MySQLReader.GetString(OrdCol);
                    }
                    else
                    {
                        organizationurl = null;
                    }

                    OrdCol = MySQLReader.GetOrdinal("TourKeywordList");
                    if (MySQLReader[OrdCol] != DBNull.Value)
                    {
                        tourkeywordlist = MySQLReader.GetString(OrdCol);
                    }
                    else
                    {
                        tourkeywordlist = null;
                    }

                    OrdCol = MySQLReader.GetOrdinal("TourITHList");
                    if (MySQLReader[OrdCol] != DBNull.Value)
                    {
                        tourithlist = MySQLReader.GetString(OrdCol);
                    }
                    else
                    {
                        tourithlist = null;
                    }

                    OrdCol = MySQLReader.GetOrdinal("TourAstroObjectList");
                    if (MySQLReader[OrdCol] != DBNull.Value)
                    {
                        tourastroobjectlist = MySQLReader.GetString(OrdCol);
                    }
                    else
                    {
                        tourastroobjectlist = null;
                    }

                    OrdCol = MySQLReader.GetOrdinal("TourExplicitTourLinkList");
                    if (MySQLReader[OrdCol] != DBNull.Value)
                    {
                        tourexplicittourlinklist = MySQLReader.GetString(OrdCol);
                    }
                    else
                    {
                        tourexplicittourlinklist = null;
                    }

                    OrdCol = MySQLReader.GetOrdinal("LengthInSecs");
                    if (MySQLReader[OrdCol] != DBNull.Value)
                    {
                        lengthinsecs = MySQLReader.GetInt32(OrdCol);
                    }
                    else
                    {
                        lengthinsecs = -1;
                    }

                    OrdCol = MySQLReader.GetOrdinal("AverageRating");
                    if (MySQLReader[OrdCol] != DBNull.Value)
                    {
                        averageRating = MySQLReader.GetDouble(OrdCol);
                    }
                    else
                    {
                        averageRating = -1;
                    }

                    OrdCol = MySQLReader.GetOrdinal("NumberOfRatings");
                    if (MySQLReader[OrdCol] != DBNull.Value)
                    {
                        numberOfRatings = MySQLReader.GetInt32(OrdCol);
                    }
                    else
                    {
                        numberOfRatings = -1;
                    }

                    OrdCol = MySQLReader.GetOrdinal("NumberOfObjections");
                    if (MySQLReader[OrdCol] != DBNull.Value)
                    {
                        numberOfObjections = MySQLReader.GetInt32(OrdCol);
                    }
                    else
                    {
                        numberOfObjections = -1;
                    }

                    //OrdCol = MySQLReader.GetOrdinal("TourXML");
                    //if (MySQLReader[OrdCol] != DBNull.Value)
                    //{
                    //    tourxml = MySQLReader.GetString(OrdCol);
                    //}
                    //else
                    //{
                    //    tourxml = null;
                    //}



                    Tour loadTour = new Tour();

                    loadTour.TourGuid  = tourguid;
                    loadTour.TourTitle = tourtitle;
                    if (workflowstatuscode != null)
                    {
                        loadTour.WorkFlowStatusCode = workflowstatuscode;
                    }
                    if (toursubmitteddatetime != null)
                    {
                        loadTour.TourSubmittedDateTime = toursubmitteddatetime;
                    }
                    if (tourapproveddatetime != null)
                    {
                        loadTour.TourApprovedDateTime = tourapproveddatetime;
                    }
                    if (tourrejecteddatetime != null)
                    {
                        loadTour.TourRejectedDateTime = tourrejecteddatetime;
                    }

                    //loadTour.TourApprovedRejectedByName = tourapprovedrejectedbyname;
                    loadTour.TourDescription           = tourdescription;
                    loadTour.TourAttributionAndCredits = tourattributionandcredits;
                    loadTour.AuthorName                  = authorname;
                    loadTour.AuthorEmailAddress          = authoremailaddress;
                    loadTour.AuthorURL                   = authorurl;
                    loadTour.AuthorSecondaryEmailAddress = authorsecondaryemailaddress;
                    loadTour.AuthorContactPhoneNumber    = authorcontactphonenumber;
                    loadTour.AuthorContactText           = authorcontacttext;
                    loadTour.OrganizationName            = organizationname;
                    //loadTour.OrganizationURL = organizationurl;
                    loadTour.TourKeywordList = tourkeywordlist;
                    //loadTour.TourITHList - tourithlist;
                    loadTour.TourAstroObjectList      = tourastroobjectlist;
                    loadTour.TourExplicitTourLinkList = tourexplicittourlinklist;
                    loadTour.LengthInSecs             = lengthinsecs;
                    loadTour.AverageRating            = averageRating;
                    //loadTour.NumberOfRatings = numberOfRatings;
                    //loadTour.NumberOfObjections = numberOfObjections;
                    //loadTour.TourXML = tourxml;

                    sqlTours.Add(loadTour);
                }
            }
            catch (InvalidCastException)
            { }

            catch (Exception ex)
            {
                //throw ex.GetBaseException();
                strErrorMsg = ex.Message;
                return(-1);
            }
            finally
            {
                if (myConnection5.State == ConnectionState.Open)
                {
                    myConnection5.Close();
                }
            }

            return(0);
        }
示例#7
0
            public WWTTourInsertRatingOrComment(string UserGUID, string TourGUID, int Rating, string Comment, int UserSelfRatingID, string UserContactInfo, int ObjectionTypeID, string ObjectionComment)
            {
                strErrorMsg = "";
                SqlConnection myConnection5 = Database.GetConnectionWWTTours();

                try
                {
                    myConnection5.Open();
                    SqlDataAdapter Cmd2 = new SqlDataAdapter("spInsertTourRatingOrComment", myConnection5);

                    Cmd2.SelectCommand.CommandType = CommandType.StoredProcedure;

                    SqlParameter CustParm = new SqlParameter("@pUserGUID", SqlDbType.VarChar);
                    CustParm.Value = UserGUID;
                    Cmd2.SelectCommand.Parameters.Add(CustParm);

                    SqlParameter CustParm1 = new SqlParameter("@pTourGUID", SqlDbType.VarChar);
                    CustParm1.Value = TourGUID;
                    Cmd2.SelectCommand.Parameters.Add(CustParm1);

                    SqlParameter CustParm2 = new SqlParameter("@pRating", SqlDbType.Int);
                    if (Rating == -999)
                    {
                        CustParm2.Value = null;
                    }
                    else
                    {
                        CustParm2.Value = Rating;
                    }
                    Cmd2.SelectCommand.Parameters.Add(CustParm2);

                    SqlParameter CustParm3 = new SqlParameter("@pComment", SqlDbType.NVarChar);
                    CustParm3.Value = Comment;
                    Cmd2.SelectCommand.Parameters.Add(CustParm3);

                    SqlParameter CustParm4 = new SqlParameter("@pUserSelfRatingID", SqlDbType.Int);
                    if (UserSelfRatingID == -999)
                    {
                        CustParm4.Value = null;
                    }
                    else
                    {
                        CustParm4.Value = UserSelfRatingID;
                    }
                    Cmd2.SelectCommand.Parameters.Add(CustParm4);

                    SqlParameter CustParm5 = new SqlParameter("@pUserContactInfo", SqlDbType.NVarChar);
                    CustParm5.Value = UserContactInfo;
                    Cmd2.SelectCommand.Parameters.Add(CustParm5);

                    SqlParameter CustParm6 = new SqlParameter("@pObjectionTypeID", SqlDbType.Int);
                    if (ObjectionTypeID == -999)
                    {
                        CustParm6.Value = null;
                    }
                    else
                    {
                        CustParm6.Value = ObjectionTypeID;
                    }
                    Cmd2.SelectCommand.Parameters.Add(CustParm6);

                    SqlParameter CustParm7 = new SqlParameter("@pObjectionComment", SqlDbType.NVarChar);
                    CustParm7.Value = ObjectionComment;
                    Cmd2.SelectCommand.Parameters.Add(CustParm7);


                    ds = new TourRatingDataset();

                    Cmd2.Fill(ds, ds.Tables[0].TableName);

                    int x = UpdateCache();

                    List <Tour> whatiscache = GetCache();

                    List <Tour> SelectedTours = new List <Tour>();

                    // loop thru cache - find the GUID
                    for (int c = 0; c < whatiscache.Count; c++)
                    {
                        cacheTour = new Tour();
                        cacheTour = (Tour)whatiscache[c];
                        string myGuidStr = cacheTour.TourGuid.ToString().ToUpper();
                        if (myGuidStr == TourGUID)
                        {
                            GuidFoundPtr = c;
                            SelectedTours.Add(cacheTour);
                        }
                    }
                    if (GuidFoundPtr > -1)
                    {
                        ds2 = SelectedTours;
                    }
                }
                catch (Exception ex)
                {
                    throw
                        WWTWebService.RaiseException("InsertTourRatingOrComment", "http://WWTWebServices", ex.Message, "2000", "InsertTourRatingOrComment", WWTWebService.FaultCode.Client);
                }
                finally
                {
                    if (myConnection5.State == ConnectionState.Open)
                    {
                        myConnection5.Close();
                    }
                }
            }
示例#8
0
            public WWTTourUpdtStatus(string TourGUID, char WorkFlowStatusCode, string ApprovedRejectedByName)
            {
                strErrorMsg = "";
                SqlConnection myConnection5 = Database.GetConnectionWWTTours();

                try
                {
                    myConnection5.Open();
                    SqlDataAdapter Cmd2 = new SqlDataAdapter("spUpdateTourWorkFlowStatus", myConnection5);

                    Cmd2.SelectCommand.CommandType = CommandType.StoredProcedure;

                    SqlParameter CustParm = new SqlParameter("@pWWTTourGUID", SqlDbType.VarChar);
                    CustParm.Value = TourGUID;
                    Cmd2.SelectCommand.Parameters.Add(CustParm);

                    SqlParameter CustParm2 = new SqlParameter("@pWorkFlowStatusCode", SqlDbType.Char);
                    CustParm2.Value = WorkFlowStatusCode;
                    Cmd2.SelectCommand.Parameters.Add(CustParm2);

                    SqlParameter CustParm3 = new SqlParameter("@pTourApprovedRejectedByName", SqlDbType.NVarChar);
                    CustParm3.Value = ApprovedRejectedByName;
                    Cmd2.SelectCommand.Parameters.Add(CustParm3);

                    ds = new WWTToursDataset();

                    Cmd2.Fill(ds, ds.Tables[0].TableName);

                    int x = UpdateCache();

                    List <Tour> whatiscache = GetCache();

                    List <Tour> SelectedTours = new List <Tour>();

                    // loop thru cache - find the GUID
                    for (int c = 0; c < whatiscache.Count; c++)
                    {
                        cacheTour = new Tour();
                        cacheTour = (Tour)whatiscache[c];
                        string myGuidStr = cacheTour.TourGuid.ToString();
                        if (myGuidStr == TourGUID)
                        {
                            GuidFoundPtr = c;
                            SelectedTours.Add(cacheTour);
                        }
                    }
                    if (GuidFoundPtr > -1)
                    {
                        ds2 = SelectedTours;
                    }
                }
                catch (Exception ex)
                {
                    throw
                        WWTWebService.RaiseException("UpdateTourWorkFlowStatus", "http://WWTWebServices", ex.Message, "2000", "UpdateTourWorkFlowStatus", WWTWebService.FaultCode.Client);
                }
                finally
                {
                    if (myConnection5.State == ConnectionState.Open)
                    {
                        myConnection5.Close();
                    }
                }
            }
示例#9
0
            public WWTTour(string TourXML, byte[] TourBlob, byte[] TourThumbnail, byte[] AuthorThumbnail)
            {
                strErrorMsg = "";
                SqlConnection myConnection5 = Database.GetConnectionWWTTours();


                // cut file stuff from here

                try
                {
                    //
                    SqlCommand Cmd5 = null;

                    Cmd5                = new SqlCommand();
                    Cmd5.Connection     = myConnection5;
                    Cmd5.CommandType    = CommandType.StoredProcedure;
                    Cmd5.CommandTimeout = 10000;

                    SqlParameter CustParm = Cmd5.CreateParameter();
                    CustParm.SqlDbType     = SqlDbType.NVarChar;
                    CustParm.ParameterName = "@pInputXMLStream";
                    Cmd5.Parameters.Add(CustParm);
                    CustParm.Value = TourXML;

                    Cmd5.CommandText = "spImportTour";
                    myConnection5.Open();

                    ds = new WWTToursDataset();
                    System.Data.SqlClient.SqlDataReader MySQLReader;

                    MySQLReader = Cmd5.ExecuteReader();


                    while (MySQLReader.Read())
                    {
                        int OrdTourGUID = MySQLReader.GetOrdinal("TourGUID");
                        outTourGuid       = MySQLReader.GetGuid(OrdTourGUID);
                        outTourGuidString = outTourGuid.ToString();

                        int OrdTourTitle = MySQLReader.GetOrdinal("TourTitle");
                        outTourTitle = MySQLReader.GetString(OrdTourTitle);
                    }


                    List <Tour> SelectedTours = new List <Tour>();

                    cacheTour                       = new Tour();
                    cacheTour.TourGuid              = outTourGuid;
                    cacheTour.TourTitle             = outTourTitle;
                    cacheTour.WorkFlowStatusCode    = "0";
                    cacheTour.TourSubmittedDateTime = System.DateTime.Now;

                    SelectedTours.Add(cacheTour);
                    ds2 = SelectedTours;
                }
                catch (Exception ex)
                {
                    throw
                        WWTWebService.RaiseException("ImportTour", "http://WWTWebServices", ex.Message, "2000", "ImportTour", WWTWebService.FaultCode.Client);
                }
                finally
                {
                    if (myConnection5.State == ConnectionState.Open)
                    {
                        myConnection5.Close();
                    }
                }

                try
                {
                    // Tour Thumbnail

                    string strTourUNC = GetToursUNC();
                    TourGUIDString = outTourGuidString;  // WAS :  GetTourGUIDFromXML(TourXML);
                    string NewFileName = "fail";

                    if (TourThumbnail.Length > 0)
                    {
                        NewFileName = strTourUNC + "\\" + TourGUIDString + "_TourThumb.bin";
                        Stream       t = new FileStream(NewFileName, FileMode.Create);
                        BinaryWriter b = new BinaryWriter(t);
                        b.Write(TourThumbnail);
                        t.Close();
                    }

                    // Tour Blob
                    if (TourBlob.Length > 0)
                    {
                        NewFileName = strTourUNC + "\\" + TourGUIDString + ".bin";
                        Stream       t2 = new FileStream(NewFileName, FileMode.Create);
                        BinaryWriter b2 = new BinaryWriter(t2);
                        b2.Write(TourBlob);
                        t2.Close();
                    }


                    // Author Thumbnail

                    if (AuthorThumbnail.Length > 0)
                    {
                        NewFileName = strTourUNC + "\\" + TourGUIDString + "_AuthorThumb.bin";
                        Stream       t3 = new FileStream(NewFileName, FileMode.Create);
                        BinaryWriter b3 = new BinaryWriter(t3);
                        b3.Write(AuthorThumbnail);
                        t3.Close();
                    }
                }
                catch (Exception ex)
                {
                    throw
                        WWTWebService.RaiseException("ImportTour", "http://WWTWebServices", ex.Message, "1000", "ImportTour", WWTWebService.FaultCode.Client);
                }
            }