Example #1
0
partial         void AfterUpdateData(Clazz e, ref ActionResult ar)
        {
            ar = this.Json(new AjaxOperationResult {
                Data = this.ToJson(e),
                Successful = true
            });
        }
Example #2
0
 public ActionResult Add(Clazz e)
 {
     ActionResult ar = null;
     try {
         this.BeforeAddData(e, ref ar);
         if (ar == null) {
             this.Service.Add(e);
             e = this.Service.FindById(e.Id);
             //ar = this.Json(new AjaxOperationResult { Data = e, Successful = true });
             this.AfterAddData(e, ref ar);
         }
     } catch (Exception ex) {
         ar = this.Json(new AjaxOperationResult { Successful = false, Message = ex.Message });
     }
     return ar;
 }
Example #3
0
 private object ToJson(Clazz e)
 {
     return new {
             Id=e.Id,
         Name=e.Name,
         Semester=e.Semester,
         StudentQty=e.StudentQty,
         LimitedQty=e.LimitedQty,
         TeacherA=e.TeacherA,
         TeacherB=e.TeacherB,
         Master=e.Master,
         Governor=e.Governor,
         OpenDate=e.OpenDate,
         ClosedDate=e.ClosedDate,
         FinishedDate=e.FinishedDate,
         IsOpen=e.IsOpen,
         IsClosed=e.IsClosed,
         IsFinished=e.IsFinished,
         CreateTime=e.CreateTime,
         UpdateTime=e.UpdateTime,
         KickOffDate=e.KickOffDate
         };
 }
Example #4
0
        private void FixupClazz(Clazz previousValue)
        {
            if (previousValue != null && previousValue.Student.Contains(this))
            {
                previousValue.Student.Remove(this);
            }

            if (Clazz != null)
            {
                if (!Clazz.Student.Contains(this))
                {
                    Clazz.Student.Add(this);
                }
                if (ClazzId != Clazz.Id)
                {
                    ClazzId = Clazz.Id;
                }
            }
            else if (!_settingFK)
            {
                ClazzId = null;
            }
        }
Example #5
0
partial         void AfterUpdateData(Clazz e, ref ActionResult ar);
Example #6
0
partial         void AfterAddData(Clazz e, ref ActionResult ar);
Example #7
0
partial         void AddRowToGridModel(LigerGridModel m, Clazz e)
        {
            m.Rows.Add(this.ToJson(e));
        }
Example #8
0
partial         void AddRowToGridModel(LigerGridModel m, Clazz e);
Example #9
0
partial         void BeforeShowEditView(Clazz e);
Example #10
0
partial         void BeforeUpdateData(Clazz e, ref ActionResult ar);
Example #11
0
partial         void BeforeAddData(Clazz e, ref ActionResult ar);
Example #12
0
 public void Delete(Clazz entity)
 {
     this.Repository.Delete(entity);
     this.Db.Save();
 }
Example #13
0
 public void Add(Clazz entity)
 {
     this.Repository.Add(entity);
     this.Db.Save();
 }
Example #14
0
 public void Update(Clazz entity)
 {
     this.Repository.Update(entity);
     this.Db.Save();
 }
Example #15
0
 public void Save(Clazz entity)
 {
     if(entity.Id==0){
         this.Add(entity);
     }else{
         this.Db.Save();
     }
 }