/// <summary> /// 释放VPN账号 /// </summary> /// <param name="vpnAccount">vpn账号对象信息</param> /// <returns>返回释放结果</returns> public bool ReleaseVpnAccountState(MVPNAccount vpnAccount) { IVPNAccount ivpnAccount = Better517Na.VPNDataService.Factory.DALFactory.GetVpnAccountDal(Better517Na.VPNDataService.Factory.DBOperType.write); MModelBase mmb = new MModelBase(); mmb.AddConditionFields("KeyID", vpnAccount.KeyID); mmb.AddUpdateFields("IsUsing", 0); mmb.AddUpdateFields("IsUsingDesc", "未使用"); mmb.AddUpdateFields("UsingServer", string.Empty); return(ivpnAccount.Update <MVPNAccount>(vpnAccount, mmb) > 0); }
/// <summary> /// 更新VPN账号状态 /// </summary> /// <param name="vpnAccount">vpn账号对象信息</param> /// <returns>返回更新结果</returns> public bool UpdateVpnAccountState(MVPNAccount vpnAccount) { IVPNAccount ivpnAccount = Better517Na.VPNDataService.Factory.DALFactory.GetVpnAccountDal(Better517Na.VPNDataService.Factory.DBOperType.write); MModelBase mmb = new MModelBase(); mmb.AddConditionFields("KeyID", vpnAccount.KeyID); mmb.AddUpdateFields("IsUsing", 1); mmb.AddUpdateFields("IsUsingDesc", "使用中"); mmb.AddUpdateFields("UsingServer", new GetIP().GetLocalIp("本地连接")); return(ivpnAccount.Update <MVPNAccount>(vpnAccount, mmb) > 0); }