public static int DeleteFestival(FestivalClass fe) { SqlConnection con = new SqlConnection(cs); //SqlCommand cmd = new SqlCommand("delete from Festival where FestivalID='" + fe.festivalID + "'", con); SqlCommand cmd = new SqlCommand("update Festival set deleted=1,UpdatedDate=@UpdatedDate,UpdatedBy=@UpdatedBy where FestivalID=@festivalID", con); if (con.State.Equals(ConnectionState.Closed)) { con.Open(); } cmd.Parameters.AddWithValue("@festivalID", fe.festivalID); cmd.Parameters.AddWithValue("@UpdatedDate", DateTime.Now); cmd.Parameters.AddWithValue("@UpdatedBy", fe.UpdatedBy); int i = cmd.ExecuteNonQuery(); con.Close(); return(i); }
public static IEnumerable <FestivalClass> getFestivalList() { SqlConnection con = new SqlConnection(cs); SqlCommand cmd = new SqlCommand("Select * from Festival where deleted=0", con); if (con.State.Equals(ConnectionState.Closed)) { con.Open(); } List <FestivalClass> newFestival = new List <FestivalClass>(); SqlDataReader rd = cmd.ExecuteReader(); while (rd.Read()) { FestivalClass fe = new FestivalClass(rd.GetString(0), rd.GetString(1), rd.GetString(2), rd.GetString(3)); newFestival.Add(fe); } return(newFestival); }
public static IEnumerable <EventFassDetailParent> getPesertaListByFestival(FestivalClass fe, Guid eventid) { SqlConnection con = new SqlConnection(cs); SqlCommand cmd = new SqlCommand("Select distinct EventID,a.PesertaID,NamaPeserta, Usia,b.DesaID,NamaDesa,a.FestivalID, Sum(Skor) TotalScore from EventDetail a " + "join Peserta b on a.PesertaID=b.PesertaID join Desa c on c.desaid=b.desaid where EventID='" + eventid + "' and a.FestivalID='" + fe.festivalID + "' " + "group by EventID,a.PesertaID,NamaPeserta, Usia,b.DesaID,NamaDesa,a.FestivalID order by TotalScore desc, NamaPeserta asc", con); if (con.State.Equals(ConnectionState.Closed)) { con.Open(); } List <EventFassDetailParent> newEvent = new List <EventFassDetailParent>(); SqlDataReader rd = cmd.ExecuteReader(); while (rd.Read()) { EventFassDetailParent ev = new EventFassDetailParent(rd.GetGuid(0), rd.GetGuid(1), rd.GetString(2), rd.GetString(3), rd.GetString(4), rd.GetString(5), rd.GetString(6), rd.GetDouble(7)); newEvent.Add(ev); } return(newEvent); }
public static int InsertFestival(FestivalClass fe) { SqlConnection con = new SqlConnection(cs); SqlCommand cmd = new SqlCommand("insert into Festival (FestivalID,NamaFestival,SistemFestival,[Description],CreatedDate,CreatedBy,UpdatedDate,UpdatedBy) " + " values(@festivalID ,@namaFestival,@sistemPermainan,@desc,@CreatedDate,@CreatedBy,@UpdatedDate,@UpdatedBy )", con); if (con.State.Equals(ConnectionState.Closed)) { con.Open(); } cmd.Parameters.AddWithValue("@festivalID", fe.festivalID); cmd.Parameters.AddWithValue("@namaFestival", fe.namaFestival); cmd.Parameters.AddWithValue("@sistemPermainan", fe.sistemPermainan); cmd.Parameters.AddWithValue("@desc", fe.desc); cmd.Parameters.AddWithValue("@CreatedDate", DateTime.Now); cmd.Parameters.AddWithValue("@CreatedBy", fe.UpdatedBy); cmd.Parameters.AddWithValue("@UpdatedDate", DateTime.Now); cmd.Parameters.AddWithValue("@UpdatedBy", fe.UpdatedBy); int i = cmd.ExecuteNonQuery(); con.Close(); return(i); }
public static int UpdateFestival(FestivalClass fe) { SqlConnection con = new SqlConnection(cs); SqlCommand cmd = new SqlCommand("update Festival set NamaFestival=@namaFestival,SistemFestival=@sistemPermainan, [Description]=@desc " + ",UpdatedDate=@UpdatedDate,UpdatedBy=@UpdatedBy " + " where FestivalID=@festivalID ", con); if (con.State.Equals(ConnectionState.Closed)) { con.Open(); } cmd.Parameters.AddWithValue("@festivalID", fe.festivalID); cmd.Parameters.AddWithValue("@namaFestival", fe.namaFestival); cmd.Parameters.AddWithValue("@sistemPermainan", fe.sistemPermainan); cmd.Parameters.AddWithValue("@desc", fe.desc); cmd.Parameters.AddWithValue("@CreatedDate", DateTime.Now); cmd.Parameters.AddWithValue("@CreatedBy", fe.UpdatedBy); cmd.Parameters.AddWithValue("@UpdatedDate", DateTime.Now); cmd.Parameters.AddWithValue("@UpdatedBy", fe.UpdatedBy); int i = cmd.ExecuteNonQuery(); con.Close(); return(i); }
public static int UpdateFestival(FestivalClass fe) { return(FestivalModel.UpdateFestival(fe)); }
public static int InsertFestival(FestivalClass fe) { return(FestivalModel.InsertFestival(fe)); }
public static int DeleteFestival(FestivalClass fe) { return(FestivalModel.DeleteFestival(fe)); }
public static IEnumerable <EventFassDetailParent> getPesertaListByFestival(FestivalClass fe, Guid eventid) { return(EventFassModel.getPesertaListByFestival(fe, eventid)); }