예제 #1
0
        public ActionResult Insert(WuYeLeiXingPeiZhi entity)
        {
            if (ModelState.IsValid)
            {
                if (_service.GetByEntity(entity) == null)
                {
                    entity.Convert();
                    entity.YunXuPingGu = (!string.IsNullOrEmpty(entity.YunXuPingGu)).ToString().ToLower();
                    entity.AreaPath    = GetOrganizationAreaPath();
                    entity.OrgNamePath = GetOrganizationNamePath();
                    entity.CreatedBy   = GetCurrentUserName();
                    entity.CreatedDate = DateTime.Now;

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

                this.GetCmp <Window>("windowWuYeLeiXingPeiZhi").Hide();
                this.GetCmp <Store>("storeWuYeLeiXingPeiZhi").Reload();

                return(this.Direct());
            }
            return(this.Direct());
        }
예제 #2
0
        public ActionResult Update(WuYeLeiXingPeiZhi entity)
        {
            if (ModelState.IsValid)
            {
                entity.Convert();
                entity.YunXuPingGu      = (!string.IsNullOrEmpty(entity.YunXuPingGu)).ToString().ToLower();
                entity.AreaPath         = GetOrganizationAreaPath();
                entity.OrgNamePath      = GetOrganizationNamePath();
                entity.LastModifiedBy   = GetCurrentUserName();
                entity.LastModifiedDate = DateTime.Now;

                _service.Update(entity);
                _service.Save();

                this.GetCmp <Window>("windowWuYeLeiXingPeiZhi").Hide();
                this.GetCmp <Store>("storeWuYeLeiXingPeiZhi").Reload();
                return(this.Direct());
            }

            return(this.Direct());
        }