Esempio n. 1
0
        public int Edit(SysMenu menu)
        {
            if (VerificationWidget.IsExit(nameof(SysMenu), nameof(SysMenu.MenuCode), menu.MenuCode, nameof(SysMenu.MenuID), menu.MenuID) ||
                VerificationWidget.IsExit(nameof(SysMenu), nameof(SysMenu.MenuName), menu.MenuName, nameof(SysMenu.MenuID), menu.MenuID))
            {
                return(OperationWidget.IsRepeated);
            }

            SysMenu entity = handle.Detail(menu.MenuID);

            using (TransactionScope transaction = new TransactionScope())
            {
                entity.ParentID  = menu.ParentID;
                entity.MenuName  = menu.MenuName;
                entity.MenuCode  = menu.MenuCode;
                entity.Status    = menu.Status;
                entity.Icon      = menu.Icon;
                entity.Url       = menu.Url;
                entity.SortNo    = menu.SortNo;
                entity.Operation = menu.Operation;

                if (handle.Edit(entity) != OperationWidget.Success)
                {
                    return(OperationWidget.Failed);
                }

                transaction.Complete();
                return(OperationWidget.Success);
            }
        }
Esempio n. 2
0
 public int Add(SysUser entity)
 {
     if (VerificationWidget.IsExit(nameof(SysUser), nameof(SysUser.Phone), entity.Phone, nameof(SysUser.UserId), null))
     {
         return(OperationWidget.IsRepeated);
     }
     using (TransactionScope transaction = new TransactionScope())
     {
         int result = handle.Add(entity);
         if (result != OperationWidget.Success)
         {
             return(OperationWidget.Failed);
         }
         transaction.Complete();
         return(OperationWidget.Success);
     }
 }
Esempio n. 3
0
        public int Add(SysArea entity)
        {
            if (VerificationWidget.IsExit(nameof(SysArea), nameof(SysArea.AreaName), entity.AreaName, nameof(SysArea.AreaID), entity.AreaID))
            {
                return(OperationWidget.IsRepeated);
            }

            using (TransactionScope transaction = new TransactionScope())
            {
                if (handle.Add(entity) != OperationWidget.Success)
                {
                    return(OperationWidget.Failed);
                }

                transaction.Complete();
                return(OperationWidget.Success);
            }
        }
Esempio n. 4
0
        public int Edit(SysArea model)
        {
            if (VerificationWidget.IsExit(nameof(SysArea), nameof(SysArea.AreaName), model.AreaName, nameof(SysArea.AreaID), model.AreaID))
            {
                return(OperationWidget.IsRepeated);
            }

            SysArea entity = handle.Detail(model.AreaID);

            using (TransactionScope transaction = new TransactionScope())
            {
                entity.AreaName = model.AreaName;

                if (handle.Edit(entity) != OperationWidget.Success)
                {
                    return(OperationWidget.Failed);
                }

                transaction.Complete();
                return(OperationWidget.Success);
            }
        }
Esempio n. 5
0
        public int Edit(SysUser model)
        {
            if (VerificationWidget.IsExit(nameof(SysUser), nameof(SysUser.Phone), model.Phone, nameof(SysUser.UserId), model.UserId))
            {
                return(OperationWidget.IsRepeated);
            }
            SysUser entity = handle.Detail(model.UserId);

            using (TransactionScope transaction = new TransactionScope())
            {
                entity.UserName = model.UserName;
                entity.Phone    = model.Phone;
                entity.AreaID   = model.AreaID;

                if (handle.Edit(entity) != OperationWidget.Success)
                {
                    return(OperationWidget.Failed);
                }
                transaction.Complete();
                return(OperationWidget.Success);
            }
        }