public AstroObjectByName(string AstroObjectName)
            {
                strErrorMsg = "";
                SqlConnection myConnection2 = Database.GetConnectionAstroObjects();

                try
                {
                    myConnection2.Open();
                    SqlDataAdapter Cmd2 = new SqlDataAdapter("spGetAstroObjects", myConnection2);

                    Cmd2.SelectCommand.CommandType = CommandType.StoredProcedure;

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

                    ds = new AstroObjectsDataset();

                    Cmd2.Fill(ds, ds.Tables[0].TableName);
                }
                catch (Exception ex)
                {
                    throw
                        WWTWebService.RaiseException("GetAstroObjectsByName", "http://WWTWebServices", ex.Message, "2000", "GetAstroObjectsByName", WWTWebService.FaultCode.Client);
                }
                finally
                {
                    if (myConnection2.State == ConnectionState.Open)
                    {
                        myConnection2.Close();
                    }
                }
            }
            public AstroObjectDataByRaDec(float Ra, float Dec, float PlusMinusArcSecs)
            {
                strErrorMsg = "";
                SqlConnection myConnection2 = Database.GetConnectionAstroObjects();

                try
                {
                    myConnection2.Open();
                    SqlDataAdapter Cmd2 = new SqlDataAdapter("spGetAstroObjects", myConnection2);

                    Cmd2.SelectCommand.CommandType = CommandType.StoredProcedure;

                    SqlParameter CustParm = new SqlParameter("@pRa", SqlDbType.Float);
                    CustParm.Value = Ra;
                    Cmd2.SelectCommand.Parameters.Add(CustParm);

                    SqlParameter CustParm2 = new SqlParameter("@pDec", SqlDbType.Float);
                    CustParm2.Value = Dec;
                    Cmd2.SelectCommand.Parameters.Add(CustParm2);

                    SqlParameter CustParm3 = new SqlParameter("@pPlusMinusArcSecs", SqlDbType.Float);
                    CustParm3.Value = PlusMinusArcSecs;
                    Cmd2.SelectCommand.Parameters.Add(CustParm3);

                    ds = new AstroObjectsDataset();

                    Cmd2.Fill(ds, ds.Tables[0].TableName);
                }
                catch (Exception ex)
                {
                    throw
                        WWTWebService.RaiseException("GetAstroObjectByRADec", "http://WWTWebServices", ex.Message, "2000", "GetAstroObjectByRADec", WWTWebService.FaultCode.Client);
                }
                finally
                {
                    if (myConnection2.State == ConnectionState.Open)
                    {
                        myConnection2.Close();
                    }
                }
            }
Beispiel #3
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();
                    }
                }
            }
Beispiel #4
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();
                        }
                    }
                }
            }
Beispiel #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();
                        }
                    }
                }
            }
Beispiel #6
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();
                    }
                }
            }
Beispiel #7
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();
                    }
                }
            }
Beispiel #8
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);
                }
            }