Beispiel #1
0
        private void AddActivity()
        {
            LAActivityEntities db = new LAActivityEntities();

            LADLL.LearningActivity la = new LADLL.LearningActivity();
            la.UserID = 1;
            db.LearningActivity.Add(la);
        }
Beispiel #2
0
        /// <summary>
        /// 新增学习活动记录
        /// </summary>
        /// <param name="aTypeId">类别ID</param>
        /// <param name="objectId">学习对象ID</param>
        /// <param name="durings">持续时长</param>
        /// <param name="startDateTime">开始时间</param>
        /// <param name="locationId">学习地点</param>
        /// <param name="worksUrl">作品URL</param>
        /// <param name="others">其他描述</param>
        /// <returns></returns>
        public static long AddAct(long aTypeId, long objectId, int durings, DateTime startDateTime, long locationId, string worksUrl, string others)
        {
            var db = new LAActivityEntities();
            var la = new LADLL.LearningActivity
            {
                UserID           = UserDAL.GetUserId(),
                ActivityTypeID   = aTypeId,
                LearningObjectID = objectId,
                Start            = startDateTime,
                During           = durings,
                LocationID       = locationId,
                WorksUrl         = worksUrl,
                Others           = others,
                CreatDate        = DateTime.Now,

                Flag = 1
            };

            db.LearningActivity.Add(la);
            db.SaveChanges();
            return(la.LearningActivityID);
        }
Beispiel #3
0
        protected void btnSubmit_OnClick(object sender, EventArgs e)
        {
            long userId = DAL.UserDAL.GetUserId();//获取当前用户ID

            if (userId == 0)
            {
                DAL.Common.Alert("请先登录网站才能记录活动!");
                Response.Redirect("../Authenticate.aspx");//专项登录页面
                return;
            }
            LADLL.LAActivityEntities vaCtx = new LAActivityEntities();
            LADLL.LearningActivity   la    = new LADLL.LearningActivity();
            la.UserID           = UserDAL.GetUserId();
            la.ActivityTypeID   = int.Parse(thisTypeID.Value);
            la.LearningObjectID = int.Parse(thisObjID.Value);
            la.LocationID       = int.Parse(thisLocaID.Value);
            la.Others           = tbOthers.Value;
            la.Start            = DTStart.SelectedDate;
            //la.WorksID = WorksDAL.GetWorksId(wName);
            vaCtx.LearningActivity.Add(la);
            vaCtx.SaveChanges();
        }