示例#1
0
文件: Lib.cs 项目: lchambaka/WorkPad
    public HopeEvent GetEvent(Int64 EventID )
    {
        dl = new DataLayer(pConnectionString);
        SqlCommand cmd = new SqlCommand();
        cmd.CommandType = CommandType.StoredProcedure;
        cmd.CommandText = "GetEvent";
        cmd.Parameters.AddWithValue("@EventID", EventID);

         DataTable dt = dl.Execute(cmd);

        foreach (DataRow dr in dt.Rows)
        {
            HopeEvent the_event = new HopeEvent
            {
                ID = Int64.Parse(dr["ID"].ToString()),

                EventName = dr["EventName"].ToString(),
                ShortDescription = dr["ShortDescription"].ToString(),
                LongDescription = dr["LongDescription"].ToString(),
                AdditionalInformation = dr["AdditionalInformation"].ToString(),
                RegistrationInformation = dr["RegistrationInformation"].ToString(),
                Sort = Int32.Parse(dr["Sort"].ToString()),
                DateCreated = Convert.ToDateTime(dr["DateCreated"].ToString())

            };

            return the_event;

        }

        return null;
    }
示例#2
0
文件: Lib.cs 项目: lchambaka/WorkPad
    public List<HopeEvent> GetEvents()
    {
        dl = new DataLayer(pConnectionString);
        SqlCommand cmd = new SqlCommand();
        cmd.CommandType = CommandType.StoredProcedure;
        cmd.CommandText = "GetEvents";

        List<HopeEvent> Events = new List<HopeEvent>();
        DataTable dt = dl.Execute(cmd);

        foreach (DataRow dr in dt.Rows)
        {
            HopeEvent the_event = new HopeEvent
            {
                ID = Int64.Parse(dr["ID"].ToString()),

                EventName = dr["EventName"].ToString(),
                ShortDescription = dr["ShortDescription"].ToString(),
                LongDescription = dr["LongDescription"].ToString(),
                AdditionalInformation = dr["AdditionalInformation"].ToString(),
                RegistrationInformation = dr["RegistrationInformation"].ToString(),
                Sort = Int32.Parse(dr["Sort"].ToString()),
                DateCreated = Convert.ToDateTime(dr["DateCreated"].ToString())

            };

            Events.Add(the_event);

        }

        return Events;
    }