Exemple #1
0
 public static void AddEvent(string title, string description, int type, DateTime eventDate, int userid)
 {
     IForumEvent dal = Factory<IForumEvent>.Create("ForumEvent", "EventsDAL");
     EventInfo forumevent = new EventInfo
                                {
                                    Title = title,
                                    Description = description,
                                    Type = type,
                                    Date = eventDate,
                                    MemberId = userid
                                };
     dal.Add(forumevent);
 }
Exemple #2
0
        public int Add(EventInfo forumevent)
        {
            const string strSql =
                "INSERT INTO FORUM_EVENT (Title,Type,Author,EventDate,Description,Recur,Enabled) VALUES " +
                "(@Title,@Type,@Author,@Date,@Description,@Recur,1); SELECT SCOPE_IDENTITY();";
            List<SqlParameter> parms = new List<SqlParameter>
            {
                new SqlParameter("@Title", SqlDbType.VarChar) {Value = forumevent.Title},
                new SqlParameter("@Type", SqlDbType.Int) {Value = forumevent.Type},
                new SqlParameter("@Author", SqlDbType.VarChar) {Value = forumevent.MemberId},
                new SqlParameter("@Date", SqlDbType.VarChar) {Value = forumevent.Date.ToString("yyyyMMddHHmmss")},
                new SqlParameter("@Description", SqlDbType.VarChar) {Value = forumevent.Description},
                new SqlParameter("@Recur", SqlDbType.Int) {Value = forumevent.RecurringFrequency}
            };

            return Convert.ToInt32(SqlHelper.ExecuteScalar(SqlHelper.ConnString, CommandType.Text, strSql, parms.ToArray()));
        }
Exemple #3
0
 public void Update(EventInfo forumevent)
 {
     const string strSql = "UPDATE FORUM_EVENT SET Title=@Title,Type=@Type,Author=@Author,EventDate=@Date,Description=@Description,Recur=@Recur,Enabled=@Enabled WHERE Id=@EventId";
     List<SqlParameter> parms = new List<SqlParameter>
     {
         new SqlParameter("@EventId", SqlDbType.Int) {Value = forumevent.Id},
         new SqlParameter("@Title", SqlDbType.VarChar) {Value = forumevent.Title},
         new SqlParameter("@Type", SqlDbType.Int) {Value = forumevent.Type},
         new SqlParameter("@Author", SqlDbType.VarChar) {Value = forumevent.MemberId},
         new SqlParameter("@Date", SqlDbType.VarChar) {Value = forumevent.Date.ToString("yyyyMMddHHmmss")},
         new SqlParameter("@Description", SqlDbType.VarChar) {Value = forumevent.Description},
         new SqlParameter("@Recur", SqlDbType.Int) {Value = forumevent.RecurringFrequency},
         new SqlParameter("@Enabled", SqlDbType.SmallInt) {Value = forumevent.Enabled}
     };
     SqlHelper.ExecuteNonQuery(SqlHelper.ConnString, CommandType.Text, strSql, parms.ToArray());
 }
Exemple #4
0
 public void Delete(EventInfo forumevent)
 {
     const string strSql = "DELETE FROM FORUM_EVENT WHERE Id=@EventId";
     SqlHelper.ExecuteNonQuery(SqlHelper.ConnString, CommandType.Text, strSql,new SqlParameter("@EventId", SqlDbType.VarChar) {Value = forumevent.Id});
 }
Exemple #5
0
 private EventInfo CopyEventToBO(SqlDataReader rdr)
 {
     //Id,Title,Type,Audience,Author,EventDate,Description
     EventInfo forumevent = new EventInfo
     {
                                    Id = rdr.GetInt32(0),
                                    Title = rdr.SafeGetString(1),
                                    Type = rdr.GetInt32(2),
                                    Audience = rdr.SafeGetString(3),
                                    MemberId = rdr.GetInt32(4),
                                    Date = rdr.GetSnitzDate(5).Value,
                                    Description = rdr.SafeGetString(6),
                                    RecurringFrequency = (RecurringFrequencies) rdr.SafeGetInt32(7)
                                };
     var mem = new Member();
     forumevent.Author = new AuthorInfo(mem.GetById(forumevent.MemberId));
     return forumevent;
 }