示例#1
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();
                    }
                }
            }
示例#2
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();
                }

            }