コード例 #1
0
        public void addFavorit(Favorit f)
        { //get user event and insert the event to the event table
            con = new SqlConnection(conString);
            con.Open();
            string     sqlString = "INSERT INTO FavoritTable (UserName,BusName)" + "VALUES ('" + f.UserName + "','" + f.BusName + "');";
            SqlCommand com       = new SqlCommand(sqlString, con);

            com.ExecuteReader();

            con.Close();
        }
コード例 #2
0
        protected void addFav_Click(object sender, EventArgs e)
        {
            Favorit f = new Favorit(user, busN);

            try {
                eBL.addFavorit(f);
                favText.Text = "Adding succeeded favorites";
            }
            catch
            {
                favText.Text = "This page exists in favorites";
            }
        }
コード例 #3
0
        public void deleteFavorit(Favorit f)
        { //get user event and delete this event
            con = new SqlConnection(conString);
            con.Open();
            string     sqlString = "DELETE FROM FavoritTable WHERE UserName='******' AND BusName= '" + f.BusName + "';";
            SqlCommand com       = new SqlCommand(sqlString, con);

            try
            {
                com.ExecuteReader();
                con.Close();
            }
            catch
            {
                con.Close();
            }
        }
コード例 #4
0
        public LinkedList <Favorit> getFavorit(string user)
        {
            con.Open();
            string               sqlString = "Select * from FavoritTable where UserName='******';";
            SqlCommand           com       = new SqlCommand(sqlString, con);
            SqlDataReader        rdr       = com.ExecuteReader();
            LinkedList <Favorit> favorits  = new LinkedList <Favorit>();
            Favorit              f;

            while (rdr.Read())
            {
                f = new Favorit((string)rdr[0], (string)rdr[1]);
                favorits.AddFirst(f);
            }
            con.Close();
            return(favorits);
        }
コード例 #5
0
        protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName.CompareTo("deleterow") == 0)
            {
                int     row  = int.Parse(e.CommandArgument.ToString());
                string  name = table.Rows[row].Cells[colName].Text.Trim();
                Favorit f    = new Favorit((string)(Session["user"]), name);
                eBL.deleteFavorit(f);
                Response.Redirect("~/myFavorit.aspx");
            }
            if (e.CommandName.CompareTo("linkRow") == 0)
            {
                int    row  = int.Parse(e.CommandArgument.ToString());
                string name = table.Rows[row].Cells[colName].Text.Trim();

                Session.Add("nameBuss", name);

                Response.Redirect("~/business.aspx");
            }
        }
コード例 #6
0
ファイル: EventBL.cs プロジェクト: racheliel/site
 public void addFavorit(Favorit f)
 {
     eventD.addFavorit(f);
 }
コード例 #7
0
ファイル: EventBL.cs プロジェクト: racheliel/site
 public void deleteFavorit(Favorit f)
 {
     eventD.deleteFavorit(f);
 }