Ejemplo n.º 1
0
        public ActionResult Insert(DataDictionary entity)
        {
            if (ModelState.IsValid)
            {
                if (_service.GetDataDictionaryByKeyName(entity.SubCategory, entity.KeyName) == null)
                {
                    if (string.IsNullOrEmpty(entity.RecordType))
                    {
                        entity.RecordType = RecordType.User.ToString();
                    }
                    entity.CreatedBy   = GetCurrentUserName();
                    entity.CreatedDate = DateTime.Now;

                    _service.AddDataDictionary(entity);
                    _service.Save();
                }
                else
                {
                    X.Msg.Alert(MsgInfo.TI_SHI, MsgInfo.INSERT_CHECK_EXIT_CODE).Show();
                    return(this.Direct());
                }

                this.GetCmp <Window>("windowDataDictionary").Hide();
                this.GetCmp <Store>("storeDataDictionary").Reload();

                return(this.Direct());
            }
            return(this.Direct());
        }