当前位置: 首页>>代码示例>>C#>>正文


C# Data.GetData方法代码示例

本文整理汇总了C#中Data.GetData方法的典型用法代码示例。如果您正苦于以下问题:C# Data.GetData方法的具体用法?C# Data.GetData怎么用?C# Data.GetData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Data的用法示例。


在下文中一共展示了Data.GetData方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        HttpCookie cookie = Request.Cookies["BrowserDate"];
        string tags = "";
        Data d = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
        DataSet ds = new DataSet();
        TopLiteral.Text = "<div style=\" width: 215px;\">";
        switch (tag_type)
        {
            case tagType.AD:
                ds = d.GetData("SELECT DISTINCT C.ID, ACM.ID AS AID, C.Name AS CategoryName, ACM.tagSize FROM Ad_Category_Mapping ACM, AdCategories C WHERE ACM.CategoryID=C.ID AND ACM.AdID=" + theID +" ORDER BY ACM.ID");
                d.TAG_TYPE = Data.tagType.AD;
                break;
            case tagType.EVENT:
                ds = d.GetData("SELECT DISTINCT C.ID, ECM.ID AS EID, C.Name AS CategoryName, ECM.tagSize FROM Event_Category_Mapping ECM, EventCategories C WHERE ECM.CategoryID=C.ID AND ECM.EventID=" + theID + " ORDER BY ECM.ID ");
                d.TAG_TYPE = Data.tagType.EVENT;
                break;
            case tagType.VENUE:
                ds = d.GetData("SELECT DISTINCT C.ID, C.Name AS CategoryName, VC.tagSize FROM Venue_Category VC, VenueCategories C WHERE VC.CATEGORY_ID=C.ID AND VC.VENUE_ID=" + theID);
                d.TAG_TYPE = Data.tagType.VENUE;
                break;
            case tagType.TRIP:
                ds = d.GetData("SELECT DISTINCT C.ID, C.Name AS CategoryName, VC.TagSize FROM Trip_Category VC, TripCategories C WHERE VC.CategoryID=C.ID AND VC.TripID=" + theID);
                d.TAG_TYPE = Data.tagType.TRIP;
                break;
            default: break;
        }

        if (ds.Tables.Count > 0)
            if (ds.Tables[0].Rows.Count > 0)
            {
                TagsLiteral.Text = d.getTags(ds, true, false);
            }
    }
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:34,代码来源:TagCloud.ascx.cs

示例2: DataBind2

    public void DataBind2()
    {
        HttpCookie cookie = Request.Cookies["BrowserDate"];
        if (pollID != -1)
        {
            int pollCount = 0;
            Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
            DataSet pollsDS;
            if (Session["User"] != null)
            {
                string commentPrefs = dat.GetData("SELECT * FROM UserPreferences WHERE UserID=" + Session["User"].ToString()).Tables[0].Rows[0]["PollPreferences"].ToString();
                if (commentPrefs == "1")
                {
                    pollsDS = dat.GetData("SELECT * FROM PollAnswers WHERE PollID=" + pollID.ToString() + " AND UserID <> " + Session["User"].ToString());
                }
                else
                {
                    pollsDS = dat.GetData("SELECT  * FROM PollAnswers PA, Users U, User_Friends UF WHERE UF.UserID=" + Session["User"].ToString() + " AND UF.FriendID=U.User_ID AND U.User_ID=PA.UserID AND PA.PollID=" + pollID.ToString());
                }
            }
            else
            {
                pollsDS = dat.GetData("SELECT * FROM PollAnswers WHERE PollID=" + pollID.ToString() + " AND UserID <> " + Session["User"].ToString());
            }
            if (pollsDS.Tables.Count > 0)
            {
                pollCount = pollsDS.Tables[0].Rows.Count;
                Label title = new Label();
                title.CssClass = "EventHeader";
                title.Text = "Answers:";
                PollElementsPanel.Controls.Add(title);
            }

            ArrayList a = new ArrayList(pollCount);

            for (int i = 0; i < pollCount; i++)
            {
                if (pollsDS.Tables[0].Rows[i]["Answer"].ToString() == "" && pollsDS.Tables[0].Rows[i]["MediaCategory"].ToString() == "0")
                {

                }
                else
                {
                    ASP.controls_pollanswer_ascx pollElement = new ASP.controls_pollanswer_ascx();
                    pollElement.ANSWER_ID = int.Parse(pollsDS.Tables[0].Rows[i]["AnswerID"].ToString());
                    pollElement.POLL_ID = pollID;
                    pollElement.USER_ID = int.Parse(pollsDS.Tables[0].Rows[i]["UserID"].ToString());

                    a.Add(pollElement);
                }
                //pagerPanel.Add(searchElement);

            }
            ASP.controls_pager_ascx pagerPanel = new ASP.controls_pager_ascx();
            pagerPanel.NUMBER_OF_ITEMS_PER_PAGE = 10;
            pagerPanel.DATA = a;
            pagerPanel.DataBind2();
            PollElementsPanel.Controls.Add(pagerPanel);
        }
    }
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:60,代码来源:PollAnswers.ascx.cs

示例3: DataBind2

    public void DataBind2()
    {
        //Session["Type"] = "Calendar";
        HttpCookie cookie = Context.Request.Cookies["BrowserDate"];
        Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
        string cookieName = FormsAuthentication.FormsCookieName;
        HttpCookie authCookie = Context.Request.Cookies[cookieName];

        //    MessageRadWindowManager.VisibleOnPageLoad = false;

        FormsAuthenticationTicket authTicket = null;
        try
        {
            string group = "";
            if (authCookie != null)
            {
                authTicket = FormsAuthentication.Decrypt(authCookie.Value);
                group = authTicket.UserData.ToString();
            }

            if (group.Contains("User"))
            {
                Session["User"] = authTicket.Name;
                DataSet ds1 = dat.GetData("SELECT UserName FROM Users WHERE User_ID=" + authTicket.Name);
                Session["UserName"] = ds1.Tables[0].Rows[0]["UserName"].ToString();
                DataSet ds = dat.GetData("SELECT EEL.ExcitmentLevel AS Level FROM User_Calendar UC, Event_ExcitmentLevel EEL WHERE UC.UserID="
            + Session["User"].ToString() + " AND UC.EventID = " + Session["EventID"].ToString() + " AND UC.ExcitmentID=EEL.ID ");

                if (ds.Tables.Count > 0)
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        AddToLabel.Text = "This event is in your calendar";
                        AddToLabel.CssClass = "AddLinkGoing";
                        ImagePanel.Visible = false;
                        AddToLabel.Visible = true;
                        AddLiteral.Text = "";
                    }
                    else
                    {
                        AddLiteral.Text = "<a style=\"cursor: pointer; color: White;\" class=\"AddLink\" onclick=\"OpenRad_Add();\">&nbsp;Add this event to your calendar</a>";
                        ImagePanel.Visible = true;
                    }
                else
                {
                    AddLiteral.Text = "<a style=\"cursor: pointer; color: White;\" class=\"AddLink\" onclick=\"OpenRad_Add();\">&nbsp;Add this event to your calendar</a>";
                    ImagePanel.Visible = true;
                }
            }
            else
            {
                LoggedInPanel.Visible = false;
            }
        }
        catch (Exception ex)
        {
        }
    }
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:57,代码来源:AddToCalendar.ascx.cs

示例4: AddFriend_Click

    protected void AddFriend_Click(object sender, EventArgs e)
    {
        HttpCookie cookie = Request.Cookies["BrowserDate"];
        Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
        LinkButton theButton = (LinkButton)sender;
        string friendID = theButton.ID.Replace("link", "");
        DataSet dsSend = dat.GetData("SELECT * FROM Users WHERE User_ID=" + Session["User"].ToString());
        DataSet dsTo = dat.GetData("SELECT * FROM Users U, UserPreferences UP WHERE UP.UserID=U.User_ID AND U.User_ID=" + friendID);
        try
        {
            //only send to email if users preferences are set to do so.
            if (dsTo.Tables[0].Rows[0]["EmailPrefs"].ToString().Contains("5"))
            {

                dat.SendEmail(System.Configuration.ConfigurationManager.AppSettings["emailemail"].ToString(),
                    System.Configuration.ConfigurationManager.AppSettings["emailName"].ToString(),
                    dsTo.Tables[0].Rows[0]["Email"].ToString(), Session["UserName"].ToString() +
                    " would like to extend a Hippo Happ friend invitation to you. You can find out " +
                    "about this user <a target=\"_blank\" class=\"AddLink\" href=\"http://hippohappenings.com/" + Session["UserName"].ToString() +"_Friend"
                     + "\">here</a>. To accept this Hippo user as a friend, please log onto <a href=\"http://hippohappenings.com/User.aspx\">Hippo Happenings</a>.", "Hippo Happs Friend Request!");
            }

            SqlConnection conn = dat.GET_CONNECTED;
            SqlCommand cmd = new SqlCommand("INSERT INTO UserMessages (MessageContent, MessageSubject, "+
                "From_UserID, To_UserID, Date, [Read], Mode)"
                + " VALUES(@content, @subject, @fromID, @toID, @date, 'False', 2)", conn);
            cmd.Parameters.Add("@content", SqlDbType.Text).Value = Session["UserName"].ToString() +
                " would like to extend a Hippo Happ friend invitation to you. You can find out about " +
                "this user <a target=\"_blank\" class=\"AddLink\" href=\"/" + Session["UserName"].ToString()
                 + "_Friend\">here</a>. To accept this Hippo user as a friend, " +
                "click on the 'Accept Friend' button.";
            cmd.Parameters.Add("@subject", SqlDbType.NVarChar).Value = "Hippo Happs Friend Request!";
            cmd.Parameters.Add("@toID", SqlDbType.Int).Value = friendID;
            cmd.Parameters.Add("@fromID", SqlDbType.Int).Value = Session["User"].ToString();
            cmd.Parameters.Add("@date", SqlDbType.DateTime).Value = DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":"));
            cmd.ExecuteNonQuery();
            conn.Close();

            int theIndex = FriendsPanel.Controls.IndexOf(theButton);
            FriendsPanel.Controls.Remove(theButton);

            Literal tex = new Literal();
            tex.Text = "<div class=\"AddGreenLink\"  style=\"display: inline;\">Friend request sent.</div>";

            FriendsPanel.Controls.AddAt(theIndex, tex);
        }
        catch (System.Net.Mail.SmtpException ex)
        {
            Label lab = new Label();
            lab.Text = ex.ToString() + ex.StatusCode;
            FriendsPanel.Controls.Clear();
            FriendsPanel.Controls.Add(lab);

        }
    }
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:55,代码来源:AddFriendAlert.aspx.cs

示例5: SubmitIt

    protected void SubmitIt(object sender, EventArgs e)
    {
        HttpCookie cookie = Request.Cookies["BrowserDate"];
        Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
        if (UpdateText.Text.Trim() != "")
        {
            SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Connection"].ToString());
            conn.Open();
            SqlCommand cmd = new SqlCommand("INSERT INTO EventUpdates (modifierID, EventID, eventChange) "+
                "VALUES("+Session["User"].ToString()+", "+Request.QueryString["ID"].ToString()+", @p3)", conn);
            cmd.Parameters.Add("@p3", SqlDbType.NVarChar).Value = UpdateText.Text;
            cmd.ExecuteNonQuery();
            conn.Close();

            string ID = Request.QueryString["ID"].ToString();
            Encryption encrypt = new Encryption();
            DataSet dsEvent = dat.GetData("SELECT * FROM Events WHERE ID=" + ID);
            //send email to users who have this event in their calendar and selected their preferences
            string emailBody = "<br/><br/>Updates have been made to an event in your calendar: Event '\"" + dsEvent.Tables[0].Rows[0]["Header"].ToString() +
                    "\"'. <br/><br/> To view these updates, please go to this event's <a href=\"http://hippohappenings.com/" + dat.MakeNiceName(dsEvent.Tables[0].Rows[0]["Header"].ToString())+
                    "_" + ID + "_Event\">page</a> and click on the updates drop down. " +
                    "<br/><br/><br/>Have a Hippo Happening Day!<br/><br/> <a href=\"http://HippoHappenings.com\">Happening Hippo</a>";

            DataSet dsAllUsers = dat.GetData("SELECT * FROM User_Calendar UC, Users U, UserPreferences UP WHERE U.User_ID=UP.UserID AND UP.EmailPrefs LIKE '%C%' AND U.User_ID=UC.UserID AND UC.EventID=" + ID);

            DataView dv = new DataView(dsAllUsers.Tables[0], "", "", DataViewRowState.CurrentRows);

            if (dv.Count > 0)
            {
                for (int i = 0; i < dv.Count; i++)
                {
                    dat.SendEmail(System.Configuration.ConfigurationManager.AppSettings["emailemail"].ToString(),
                        System.Configuration.ConfigurationManager.AppSettings["emailName"].ToString(),
                        dv[i]["Email"].ToString(), emailBody,
                        "Event '" + dsEvent.Tables[0].Rows[0]["Header"].ToString() + "' has been modified");
                }
            }

            Session["Message"] = "Your update has been posted successfully<br/><br/> Here are your next steps. <br/><br/>";
            Session["Message"] += "<br/><br/>" + "-Go to <a class=\"AddLink\" onclick=\"Search('" +
                dat.MakeNiceName(dsEvent.Tables[0].Rows[0]["Header"].ToString()) + "_" + ID + "_Event');\">this event's</a> home page.<br/><br/> -<a class=\"AddLink\" onclick=\"Search('RateExperience.aspx?Type=E&ID=" + ID + "');\" >Rate </a>your user experience posting this event.";
            MessageRadWindow.NavigateUrl = "Message.aspx?message=" + encrypt.encrypt(Session["Message"].ToString() +
                "<br/><br/><img onclick=\"Search('Home.aspx');\" onmouseover=\"this.src='image/DoneSonButtonSelected.png'\" onmouseout=\"this.src='image/DoneSonButton.png'\" src=\"image/DoneSonButton.png\"/><br/>");
            MessageRadWindow.Visible = true;
            MessageRadWindowManager.VisibleOnPageLoad = true;

        }
        else
        {
            ErrorLabel.Text = "Please enter an Update.";
        }
    }
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:52,代码来源:EventUpdate.aspx.cs

示例6: Main

 static void Main(string[] args)
 {
     Data data = new Data();
     //now create data1 like new class object with information from data
     Data data1 = data.GetData();
     //Change only data1
     data1.Doing((int n) => n % 2 != 0, (int i) => i * i);
     //I set object data to Read Write mode
     data.SetReadWrite();
     //Now data2 create like reference to data
     Data data2 = data.GetData();
     //Change data2 and data
     data2.Doing((int n) => n % 2 == 0, (int i) => i * i);
 }
开发者ID:kaplunov93,项目名称:EffectiveCsharp,代码行数:14,代码来源:DataMode.cs

示例7: DoUser

    protected void DoUser()
    {
        HttpCookie cookie = Request.Cookies["BrowserDate"];
            Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));

        DataSet ds = dat.GetData("SELECT * FROM User_Calendar WHERE UserID=" + Session["User"].ToString() +
            " AND EventID=" + Request.QueryString["EID"].ToString());

        bool isConnect = bool.Parse(ds.Tables[0].Rows[0]["isConnect"].ToString());

        EventLiteral.Text = "<div style=\"display: none;\" id=\"userID\">" + Session["User"].ToString()
            + "</div><div id=\"eventID\" style=\"display: none;\">" + Request.QueryString["EID"].ToString() +
            "</div>";
        Button3.CommandArgument = Request.QueryString["EID"].ToString();
        if (isConnect)
        {
            SettingLabel.Text = "<label class=\"AddLink\">ON</label><label>. This means people can contact"+
                "you about this event.</label>";
            ChangeToLabel.Text = "Would you like to turn it <b>OFF</b>?";

            EventLiteral.Text += "<div style=\"display: none;\" id=\"userSetting\">false</div>";
        }
        else
        {
            SettingLabel.Text = "<label class=\"AddLink\">OFF</label><label>. This means people cannot"+
                "contact you about this event.</label>";
            ChangeToLabel.Text = "Would you like to turn it <b>ON</b>?";
            EventLiteral.Text += "<label style=\"display: none;\" id=\"userSetting\">true</label>";
        }
    }
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:30,代码来源:EventCommunicate.aspx.cs

示例8: ChangeCity

    protected void ChangeCity(object sender, EventArgs e)
    {
        try
        {
            if (CountryDropDown.SelectedValue == "223")
            {
                HttpCookie cookie = Request.Cookies["BrowserDate"];
                Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
                DataSet ds = dat.GetData("SELECT *, MC.ID AS MCID FROM MajorCities MC, State S WHERE MC.State=S.state_name " +
                    "AND S.state_2_code='" + StateDropDown.SelectedItem.Text + "'");

                MajorCityPanel.Visible = true;
                MajorCityDropDown.DataSource = ds;
                MajorCityDropDown.DataTextField = "MajorCity";
                MajorCityDropDown.DataValueField = "MCID";
                MajorCityDropDown.DataBind();
            }
            else
            {
                MajorCityPanel.Visible = false;
            }
        }
        catch (Exception ex)
        {
            MessageLabel.Text = ex.ToString();
        }
    }
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:27,代码来源:CompleteRegistration.aspx.cs

示例9: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        HttpCookie cookie = Request.Cookies["BrowserDate"];
        string cookieName = FormsAuthentication.FormsCookieName;
        HttpCookie authCookie = Context.Request.Cookies[cookieName];
        Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
        FormsAuthenticationTicket authTicket = null;
        try
        {
            string group = "";
            if (authCookie != null)
            {
                authTicket = FormsAuthentication.Decrypt(authCookie.Value);
                group = authTicket.UserData.ToString();
            }

            if (group.Contains("User"))
            {
                Session["User"] = authTicket.Name;
                DataSet ds1 = dat.GetData("SELECT UserName FROM Users WHERE User_ID=" + authTicket.Name);
                Session["UserName"] = ds1.Tables[0].Rows[0]["UserName"].ToString();

                DataSet ds2 = dat.RetrieveAds(Session["User"].ToString(), false);
            }
            else
            {
            }
        }
        catch (Exception ex)
        {
            Response.Redirect("~/UserLogin.aspx");
        }
    }
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:33,代码来源:PrizesToWin.aspx.cs

示例10: ChangeState

    protected void ChangeState(object sender, EventArgs e)
    {
        HttpCookie cookie = Request.Cookies["BrowserDate"];
        Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
        DataSet ds = dat.GetData("SELECT * FROM State WHERE country_id=" + CountryDropDown.SelectedValue);

        bool isTextBox = false;
        if (ds.Tables.Count > 0)
            if (ds.Tables[0].Rows.Count > 0)
            {
                StateDropDownPanel.Visible = true;
                StateTextBoxPanel.Visible = false;
                StateDropDown.DataSource = ds;
                StateDropDown.DataTextField = "state_2_code";
                StateDropDown.DataValueField = "state_id";
                StateDropDown.DataBind();
            }
            else
                isTextBox = true;
        else
            isTextBox = true;

        if (isTextBox)
        {
            StateTextBoxPanel.Visible = true;
            StateDropDownPanel.Visible = false;
        }
    }
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:28,代码来源:UserPreferences.aspx.cs

示例11: AddAsFriend

    protected void AddAsFriend(object sender, EventArgs e)
    {
        HttpCookie cookie = Request.Cookies["BrowserDate"];
        SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Connection"].ToString());
        Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
        conn.Open();
        SqlCommand cmd = new SqlCommand("INSERT INTO UserMessages (MessageContent, MessageSubject, From_UserID, To_UserID, Date, [Read], Mode)"
            + " VALUES(@content, @subject, @fromID, @toID, @date, 'False', 2)", conn);
        cmd.Parameters.Add("@content", SqlDbType.Text).Value = "Good Day from Hippo Happenings!, <br/><br/> We wanted to let you know that the user '" + Session["UserName"].ToString() + "' would like " +
            "to add you to their list of friends. To accept this request select the link below. <br/><br/> Have a Happening Day! <br/><br/> ";
        cmd.Parameters.Add("@subject", SqlDbType.NVarChar).Value = "You Have a Hippo Friend Request!";
        cmd.Parameters.Add("@toID", SqlDbType.Int).Value = int.Parse(Session["Friend"].ToString());
        cmd.Parameters.Add("@fromID", SqlDbType.Int).Value = int.Parse(Session["User"].ToString());
        cmd.Parameters.Add("@date", SqlDbType.DateTime).Value = DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":"));
        cmd.ExecuteNonQuery();
        conn.Close();
        AddAsFriendPanel.Visible = false;
        AddedFriendLabel.Text = "Your friend request has been sent!";

        DataSet dsTo = dat.GetData("SELECT * FROM Users U, UserPreferences UP WHERE UP.UserID=U.User_ID AND U.User_ID=" + Session["Friend"].ToString());
        if (dsTo.Tables[0].Rows[0]["EmailPrefs"].ToString().Contains("5"))
        {
            dat.SendEmail(System.Configuration.ConfigurationManager.AppSettings["emailemail"].ToString(),
                System.Configuration.ConfigurationManager.AppSettings["emailName"].ToString(),
                dsTo.Tables[0].Rows[0]["Email"].ToString(), Session["UserName"].ToString() +
                " would like to extend a Hippo Happ friend invitation to you. You can find out " +
                "about this user <a target=\"_blank\" class=\"AddLink\" href=\"http://hippohappenings.com/" + Session["UserName"].ToString() + "_Friend"
                 + "\">here</a>. To accept this Hippo user as a friend, please log onto <a href=\"http://hippohappenings.com/my-account\">Hippo Happenings</a>.", "Hippo Happs Friend Request!");
        }
    }
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:30,代码来源:Friend.aspx.cs

示例12: SendIt

    public int SendIt(string msgText, string userName, string userID, string eventName, 
        string[] idArray, string msgBody)
    {
        HttpCookie cookie = Request.Cookies["BrowserDate"];
        Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
        DataSet dsUser;
        for (int i = 0; i < idArray.Length; i++)
        {
            SqlConnection conn = dat.GET_CONNECTED;
            SqlCommand cmd = new SqlCommand("INSERT INTO UserMessages (MessageContent, MessageSubject, From_UserID, To_UserID, Date, [Read], Mode)"
                + " VALUES(@content, @subject, @fromID, @toID, @date, 'False', 0)", conn);
            cmd.Parameters.Add("@content", SqlDbType.Text).Value = msgText + "<br/><br/>"+msgBody;
            cmd.Parameters.Add("@subject", SqlDbType.NVarChar).Value = userName + " wants you to check out event " + eventName;
            cmd.Parameters.Add("@toID", SqlDbType.Int).Value = int.Parse(idArray[i]);
            cmd.Parameters.Add("@fromID", SqlDbType.Int).Value = int.Parse(userID);
            cmd.Parameters.Add("@date", SqlDbType.DateTime).Value = DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":"));
            cmd.ExecuteNonQuery();
            conn.Close();

            dsUser = dat.GetData("SELECT * FROM Users WHERE User_ID=" + idArray[i]);
            dat.SendEmail(System.Configuration.ConfigurationManager.AppSettings["emailemail"].ToString(),
                System.Configuration.ConfigurationManager.AppSettings["emailName"].ToString(),
                dsUser.Tables[0].Rows[0]["Email"].ToString(),
                "<div><br/>A new email arrived at your inbox on Hippo Happenings. <br/><br/> Email Contents:<br/><br/>Subject: " +
                  userName + " wants you to check out event " + eventName + "<br/><br/>Message Body: " +
                  msgText + "<br/><br/>" + msgBody +
                  "<br/><br/> To view the message, <a href=\"HippoHappenings.com/login\">" +
                "log into Hippo Happenings</a></div>", "You have a new email at Hippo Happenings!");

            MessageLabel2.Text = "Your message has been sent.";
            ThankYouPanel.Visible = true;
            MessagePanel.Visible = false;
        }
        return 0;
    }
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:35,代码来源:MessageAlert.aspx.cs

示例13: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        HtmlLink lk = new HtmlLink();
        HtmlHead head = (HtmlHead)Page.Header;
        lk.Attributes.Add("rel", "canonical");
        lk.Href = "http://hippohappenings.com/EventUpdate.aspx";
        head.Controls.AddAt(0, lk);

        HtmlMeta hm = new HtmlMeta();
        hm.Name = "ROBOTS";
        hm.Content = "NOINDEX, NOFOLLOW";
        head.Controls.AddAt(0, hm);

        HttpCookie cookie = Request.Cookies["BrowserDate"];
        if (cookie == null)
        {
            cookie = new HttpCookie("BrowserDate");
            cookie.Value = DateTime.Now.ToString();
            cookie.Expires = DateTime.Now.AddDays(22);
            Response.Cookies.Add(cookie);
        }
        Response.Redirect("~/Home.aspx");
        if (Session["User"] == null)
        {
            Response.Redirect("~/Home.aspx");
        }
        Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
        DataSet dsEvent = dat.GetData("SELECT * FROM Events WHERE ID="+Request.QueryString["ID"].ToString());

        nameLabel.Text = "Enter an update for the event ' " + dsEvent.Tables[0].Rows[0]["Header"].ToString() +" '";
    }
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:31,代码来源:EventUpdate.aspx.cs

示例14: ChangeState

    protected void ChangeState(object sender, EventArgs e)
    {
        HttpCookie cookie = Request.Cookies["BrowserDate"];

        DateTime isn = DateTime.Now;

        DateTime.TryParse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":"), out isn);

        Data dat = new Data(isn);
        DataSet ds = dat.GetData("SELECT * FROM State WHERE country_id=" + CountryDropDown.SelectedValue);

        bool isTextBox = false;
        if (ds.Tables.Count > 0)
            if (ds.Tables[0].Rows.Count > 0)
            {
                StateDropDownPanel.Visible = true;
                StateTextBoxPanel.Visible = false;
                StateDropDown.DataSource = ds;
                StateDropDown.DataTextField = "state_2_code";
                StateDropDown.DataValueField = "state_id";
                StateDropDown.DataBind();

                StateDropDown.Items.Insert(0, new Telerik.Web.UI.RadComboBoxItem("State", "-1"));

                DataSet ds2 = dat.GetData("SELECT  CASE WHEN SUBSTRING(Name, 1, 4) = 'The' THEN SUBSTRING(Name, "+
                    "5, LEN(Name)-4) ELSE Name END AS Name1, * FROM Venues WHERE Country=" +
                    CountryDropDown.SelectedValue + " ORDER BY Name1 ASC");

            }
            else
                isTextBox = true;
        else
            isTextBox = true;

        if (isTextBox)
        {
            StateTextBoxPanel.Visible = true;
            StateDropDownPanel.Visible = false;
        }

        //SearchPanel.Items[0].Expanded = true;
        //SearchPanel.Items[1].Expanded = false;
    }
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:43,代码来源:VenueSearch.aspx.cs

示例15: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        HtmlMeta hm = new HtmlMeta();
        HtmlHead head = (HtmlHead)Page.Header;
        hm.Name = "ROBOTS";
        hm.Content = "NOINDEX, FOLLOW";
        head.Controls.AddAt(0, hm);

        HttpCookie cookie = Request.Cookies["BrowserDate"];
        if (cookie == null)
        {
            cookie = new HttpCookie("BrowserDate");
            cookie.Value = DateTime.Now.ToString();
            cookie.Expires = DateTime.Now.AddDays(22);
            Response.Cookies.Add(cookie);
        }
        //Ajax.Utility.RegisterTypeForAjax(typeof(Communicate));
        if (!IsPostBack)
        {
            Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
            try
            {
                if (Session["User"] != null)
                {

                    DataSet dsUser = dat.GetData("SELECT * FROM Users WHERE User_ID=" + Session["User"].ToString());
                    DataSet dsUsers = dat.GetData("SELECT DISTINCT U.UserName, U.User_ID FROM Users U, User_Friends UF "
                        + " WHERE U.User_ID=UF.FriendID AND UF.UserID=" + Session["User"].ToString());

                    UsersListBox.DataSource = dsUsers;
                    UsersListBox.DataTextField = "UserName";
                    UsersListBox.DataValueField = "User_ID";
                    UsersListBox.DataBind();
                }
            }
            catch (Exception ex)
            {
                MessageLabel.Text = ex.ToString();
            }
        }
    }
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:41,代码来源:SelectFriendMembers.aspx.cs


注:本文中的Data.GetData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。