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());
            }
        }
示例#2
0
        public string PostDic(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.Insert(entity);

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