コード例 #1
0
        public string SaveClass(string jsonString, string action)
        {
            try
            {
                ClassInfoEntity  entity  = JsonConvert.DeserializeObject <ClassInfoEntity>(jsonString);
                ClassInfoManager manager = new ClassInfoManager();
                if (action == "add")
                {
                    manager.Insert(entity);
                }
                else
                {
                    ClassInfoEntity oldEntity = manager.GetClassInfoByCode(entity.Code);
                    oldEntity.Name      = entity.Name;
                    oldEntity.Type      = entity.Type;
                    oldEntity.StartTime = entity.StartTime;
                    oldEntity.EndTime   = entity.EndTime;
                    oldEntity.TeacherID = entity.TeacherID;

                    oldEntity.UpdateBy = SessionHelper.CurrentUser.Code;

                    manager.Update(oldEntity);
                }
                return("success");
            }
            catch (Exception e)
            {
                return(e.ToString());
            }
        }
コード例 #2
0
        public string PutClassInfo(ClassInfoEntity entity)
        {
            try
            {
                if (entity == null)
                {
                    return("error");
                }

                ClassInfoManager manager = new ClassInfoManager();

                entity.CreateTime = DateTime.Now;
                entity.CreateTime = DateTime.Now;

                manager.Update(entity);

                return("success");
            }
            catch (Exception e)
            {
                return(e.ToString());
            }
        }
コード例 #3
0
        public string DeleteClassInfo(int id)
        {
            try
            {
                ClassInfoManager manager = new ClassInfoManager();

                ClassInfoEntity entity = manager.GetClassInfoByID(id);
                if (entity != null)
                {
                    entity.Valid      = "F";
                    entity.CreateTime = DateTime.Now;
                    entity.CreateTime = DateTime.Now;

                    manager.Update(entity);
                }

                return("success");
            }
            catch (Exception e)
            {
                return(e.ToString());
            }
        }