Beispiel #1
0
        public static int UpdateFestivalDetail(FestivalDetail fe)
        {
            SqlConnection con = new SqlConnection(cs);
            SqlCommand    cmd = new SqlCommand("update FestivalDetail set PoinPenilaian=@poinPenilaian,UpdatedDate=@UpdatedDate,UpdatedBy=@UpdatedBy  where FestivalID=@festivalID and PoinID=@poinID ", con);

            if (con.State.Equals(ConnectionState.Closed))
            {
                con.Open();
            }
            cmd.Parameters.AddWithValue("@festivalID", fe.festivalID);
            cmd.Parameters.AddWithValue("@poinID", fe.poinID);
            cmd.Parameters.AddWithValue("@poinPenilaian", fe.poinPenilaian);
            cmd.Parameters.AddWithValue("@UpdatedDate", DateTime.Now);
            cmd.Parameters.AddWithValue("@UpdatedBy", fe.UpdatedBy);
            int i = cmd.ExecuteNonQuery();

            con.Close();
            return(i);
        }
Beispiel #2
0
        public static IEnumerable <FestivalDetail> getFestivalDetailList(string festid)
        {
            SqlConnection con = new SqlConnection(cs);
            SqlCommand    cmd = new SqlCommand("Select * from FestivalDetail where FestivalID=@festivalID and deleted=0", con);

            if (con.State.Equals(ConnectionState.Closed))
            {
                con.Open();
            }
            cmd.Parameters.AddWithValue("@festivalID", festid);
            List <FestivalDetail> newFestival = new List <FestivalDetail>();
            SqlDataReader         rd          = cmd.ExecuteReader();

            while (rd.Read())
            {
                FestivalDetail fes = new FestivalDetail(rd.GetString(0), rd.GetInt32(1), rd.GetString(2));
                newFestival.Add(fes);
            }
            return(newFestival);
        }
Beispiel #3
0
        public static int InsertFestivalDetail(FestivalDetail fe)
        {
            SqlConnection con = new SqlConnection(cs);
            SqlCommand    cmd = new SqlCommand("insert into FestivalDetail (festivalID,poinID,poinPenilaian,CreatedDate,CreatedBy,UpdatedDate,UpdatedBy) values (@festivalID,@poinID,@poinPenilaian,@CreatedDate,@CreatedBy,@UpdatedDate,@UpdatedBy)", con);

            if (con.State.Equals(ConnectionState.Closed))
            {
                con.Open();
            }
            cmd.Parameters.AddWithValue("@festivalID", fe.festivalID);
            cmd.Parameters.AddWithValue("@poinID", fe.poinID);
            cmd.Parameters.AddWithValue("@poinPenilaian", fe.poinPenilaian);
            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);
        }
Beispiel #4
0
        public static int DeleteFestivalDetail(FestivalDetail fe)
        {
            SqlConnection con = new SqlConnection(cs);
            //SqlCommand cmd = new SqlCommand("delete from FestivalDetail where FestivalID='" + fe.festivalID + "' and PoinID='" + fe.poinID + "'", con);
            SqlCommand cmd = new SqlCommand("update FestivalDetail set deleted=1, UpdatedDate=@UpdatedDate,UpdatedBy=@UpdatedBy where FestivalID=@festivalID  and PoinID=@poinID  and deleted=0", con);

            if (con.State.Equals(ConnectionState.Closed))
            {
                con.Open();
            }
            cmd.Parameters.AddWithValue("@festivalID", fe.festivalID);
            cmd.Parameters.AddWithValue("@poinID", fe.poinID);
            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);
        }
Beispiel #5
0
 public static int UpdateFestivalDetail(FestivalDetail fe)
 {
     return(FestivalModel.UpdateFestivalDetail(fe));
 }
Beispiel #6
0
 public static int InsertFestivalDetail(FestivalDetail fe)
 {
     return(FestivalModel.InsertFestivalDetail(fe));
 }
Beispiel #7
0
 public static int DeleteFestivalDetail(FestivalDetail fe)
 {
     return(FestivalModel.DeleteFestivalDetail(fe));
 }