Beispiel #1
0
        public string PutDic(SysDicEntity entity)
        {
            try
            {
                //DictionaryViewModel model = JsonConvert.DeserializeObject<DictionaryViewModel>(jsonString.ToString());

                if (entity == null)
                {
                    return("error");
                }

                SysDicManager manager = new SysDicManager();

                entity.IsDisplay  = "T";
                entity.CreateTime = DateTime.Now;
                entity.CreateTime = DateTime.Now;

                manager.Update(entity);

                return("success");
            }
            catch (Exception e)
            {
                return(e.ToString());
            }
        }
        public string DicsSaveChanges(string jsonString, string action)
        {
            try
            {
                SysDicEntity  entity = JsonConvert.DeserializeObject <SysDicEntity>(jsonString);
                SysDicManager dm     = new SysDicManager();
                if (action == "add")
                {
                    entity.IsDisplay = "T";
                    entity.CreateBy  = SessionHelper.CurrentUser.Code;
                    entity.UpdateBy  = SessionHelper.CurrentUser.Code;

                    dm.Insert(entity);
                }
                else
                {
                    SysDicEntity oldEntity = dm.GetDicByID(entity.ID);

                    oldEntity.Name       = entity.Name;
                    oldEntity.ParentCode = entity.ParentCode;
                    oldEntity.Value      = entity.Value;
                    oldEntity.Type       = entity.Type;

                    oldEntity.UpdateBy   = SessionHelper.CurrentUser.Code;
                    oldEntity.UpdateTime = DateTime.Now;

                    dm.Update(oldEntity);
                }
                return("success");
            }
            catch (Exception e)
            {
                return(e.ToString());
            }
        }
Beispiel #3
0
        public string DeleteDic(int id)
        {
            try
            {
                //DictionaryViewModel model = JsonConvert.DeserializeObject<DictionaryViewModel>(jsonString.ToString());

                SysDicManager manager = new SysDicManager();

                SysDicEntity entity = manager.GetDicByID(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());
            }
        }