Esempio n. 1
0
        public ActionResult Add(SystemUser su, string ids, string editor, FormCollection fc)
        {
            var        cf  = fc["editor"];
            var        ds  = fc["editorvalue"];
            SystemUser suk = new SystemUser();
            PubResult  pr  = new PubResult();

            if (IsPost())
            {
                if (!string.IsNullOrEmpty(ids))
                {
                    su.SystemUserId = ids;
                    su.ModifiedBy   = AuthTicket().SystemUserId;
                    su.ModifyTime   = DateTime.Now;
                    var entity = _iSysUserServices.Update2(su);
                    if (entity)
                    {
                        //string js = @"<script>layer.alert('修改成功',{icon: 2,skin: 'layer-ext-moon'});setTimeout(function(){parent.location.reload();layer_close()}, 1000)</script>";
                        ViewBag.js = JsMsgSuccess("修改成功", 1);
                    }
                    else
                    {
                        ViewBag.js = JsMsgFailed("修改失败", 2);
                    }
                }
                else
                {
                    su.SystemUserId = Guid.NewGuid().ToString().Replace("-", "");
                    su.IsActive     = 1;
                    var flag = _iSysUserServices.InsertAdd(su);
                    if (flag)
                    {
                        ViewBag.js = JsMsgSuccess(PubConst.Success2, 1);
                    }
                    else
                    {
                        ViewBag.js = JsMsgFailed(PubConst.Failed6, 2);
                    }
                }
                return(View(su));
            }
            else
            {
                if (ids != null)
                {
                    su = _iSysUserServices.FindEntity(c => c.SystemUserId == ids);
                }
            }
            return(View(su));
        }