protected void Collect_Click(object sender, EventArgs e) { CollectDAO yes_dao = Factory.Get(new CollectDAO()); VideoModel video_model = (Session["video"] as VideoModel); CollectModel yes_model = new CollectModel(video_model.video_id, (Session["user"] as UserModel).id); VideoDao video_dao = Factory.Get(new VideoDao()); if (Button3.ForeColor == System.Drawing.ColorTranslator.FromHtml("#1763e9")) { Button3.ForeColor = System.Drawing.ColorTranslator.FromHtml("#757575"); yes_dao.Delete(yes_model); video_model.collect--; } else if (Button3.ForeColor == System.Drawing.ColorTranslator.FromHtml("#757575")) { Button3.ForeColor = System.Drawing.ColorTranslator.FromHtml("#1763e9"); yes_dao.Insert(yes_model); video_model.collect++; } Label4.Text = "收藏:" + video_model.collect; video_dao.Update(video_model); }
/// <summary> ///收藏表的显示 /// </summary> /// <returns></returns> public List <CollectModel> CollectList() { List <CollectModel> list = new List <CollectModel>(); string str = @"SELECT collectid, Worksid, Userid FROM Collect" ; SqlConnection con = new SqlConnection(conString); con.Open(); SqlCommand command = new SqlCommand(str, con); SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { CollectModel mm = new CollectModel(); mm.collectid = Convert.ToInt32(reader["collectid"].ToString()); mm.Worksid = Convert.ToInt32(reader["Worksid"].ToString()); mm.Userid = Convert.ToInt32(reader["Userid"].ToString()); list.Add(mm); } con.Close(); return(list); }
public Result Delete(object o) { if (!(o is CollectModel)) { return(Result.Failed); } CollectModel yes = o as CollectModel; return(SqlHelper.ExcuteNonQuery("delete from collect where video_id='" + yes.video_id + "' and user_id='" + yes.user_id + "'")); }
public Result Insert(object o) { if (!(o is CollectModel)) { return(Result.Failed); } CollectModel video = o as CollectModel; string sql = "insert into collect values ('" + video.video_id + "','" + video.user_id + "')"; return(SqlHelper.ExcuteNonQuery(sql)); }
/// <summary> /// 收藏表的删除 /// </summary> /// <param name="mm"></param> /// <returns></returns> public int CollectDelete(CollectModel mm) { string str = string.Format(@"DELETE FROM [dbo].[Collect] WHERE collectid='{0}'", mm.collectid); SqlConnection con = new SqlConnection(conString); con.Open(); SqlCommand com = new SqlCommand(str, con); int i = com.ExecuteNonQuery(); con.Close(); return(i); }
/// <summary> /// 收藏表的修改 /// </summary> /// <param name="mm"></param> /// <returns></returns> public int CollectUpdate(CollectModel mm) { string str = string.Format(@"UPDATE [dbo].[Collect] SET [Worksid] = '{0}' ,[Userid] = '{1}' WHERE collectid='{2}' ", mm.Worksid, mm.Userid, mm.collectid); SqlConnection con = new SqlConnection(conString); con.Open(); SqlCommand com = new SqlCommand(str, con); int i = com.ExecuteNonQuery(); con.Close(); return(i); }
/// <summary> /// 收藏表的添加 /// </summary> /// <returns></returns> public int CollectADD(CollectModel mm) { string str = string.Format(@"INSERT INTO [dbo].[Collect] ([Worksid] ,[Userid]) VALUES ('{0}','{1}')", mm.Worksid, mm.Userid); SqlConnection con = new SqlConnection(conString); con.Open(); SqlCommand com = new SqlCommand(str, con); int i = com.ExecuteNonQuery(); con.Close(); return(i); }
public Level1Model(UnderseaModel gameModel, TgcCamera camera, TgcD3dInput input, string mediaDir, string shadersDir, TgcFrustum frustum, TgcText2D drawText, TgcDirectSound directSound) : base(gameModel, camera, input, mediaDir, shadersDir, frustum, drawText) { hudModel = new HUDModel(MediaDir, D3DDevice.Instance.Device); initialLookAt = new TGCVector3(6000, 4120f, 6600f); initialPosition = new TGCVector3(6000, 4120f, 6600f); //Camara Camera = new FpsCamera(initialLookAt, Input); //Player playerModel = new PlayerModel(surfacePosition.Y, initialPosition, gameModel, Camera, input, mediaDir, shadersDir, frustum, drawText, directSound); //Collect Model collectModel = new CollectModel(gameModel, Camera, input, mediaDir, shadersDir, frustum, drawText, directSound); // History Model historyModel = new HistoryModel(gameModel, Camera, input, mediaDir, shadersDir, frustum, drawText); // You Win Model youWinModel = new YouWinModel(gameModel, Camera, input, mediaDir, shadersDir, frustum, drawText, directSound); }
/// <summary> /// 收藏表的修改 /// </summary> /// <param name="mm"></param> /// <returns></returns> public int CollectUpdate(CollectModel mm) { return(dal.CollectUpdate(mm)); }
/// <summary> /// 收藏表的删除 /// </summary> /// <param name="mm"></param> /// <returns></returns> public int CollectDelete(CollectModel mm) { return(dal.CollectDelete(mm)); }
/// <summary> /// 收藏表的添加 /// </summary> /// <returns></returns> public int CollectADD(CollectModel mm) { return(dal.CollectADD(mm)); }