Exemple #1
0
partial         void AfterUpdateData(Clazz e, ref ActionResult ar)
        {
            ar = this.Json(new AjaxOperationResult {
                Data = this.ToJson(e),
                Successful = true
            });
        }
Exemple #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;
 }
Exemple #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
         };
 }
Exemple #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;
            }
        }
Exemple #5
0
partial         void AfterUpdateData(Clazz e, ref ActionResult ar);
Exemple #6
0
partial         void AfterAddData(Clazz e, ref ActionResult ar);
Exemple #7
0
partial         void AddRowToGridModel(LigerGridModel m, Clazz e)
        {
            m.Rows.Add(this.ToJson(e));
        }
Exemple #8
0
partial         void AddRowToGridModel(LigerGridModel m, Clazz e);
Exemple #9
0
partial         void BeforeShowEditView(Clazz e);
Exemple #10
0
partial         void BeforeUpdateData(Clazz e, ref ActionResult ar);
Exemple #11
0
partial         void BeforeAddData(Clazz e, ref ActionResult ar);
Exemple #12
0
 public void Delete(Clazz entity)
 {
     this.Repository.Delete(entity);
     this.Db.Save();
 }
Exemple #13
0
 public void Add(Clazz entity)
 {
     this.Repository.Add(entity);
     this.Db.Save();
 }
Exemple #14
0
 public void Update(Clazz entity)
 {
     this.Repository.Update(entity);
     this.Db.Save();
 }
Exemple #15
0
 public void Save(Clazz entity)
 {
     if(entity.Id==0){
         this.Add(entity);
     }else{
         this.Db.Save();
     }
 }