//开锁操做 public static AjaxResult UnLockDevice(string ID, string LockType) { if (LockType == "1") //新锁 { NewLockManager managerNew = new NewLockManager(); string ret = managerNew.openDoor(ID); Dictionary <string, object> returnInfo = new Dictionary <string, object>(); returnInfo = JSONHelper.FromJson <Dictionary <string, object> >(ret); if (returnInfo["ret"].ToString() == "0") { return(AjaxResult.Success()); } else { return(AjaxResult.Error("开锁失败!")); } } else { LockManager manager = new LockManager(); string ret = manager.UnLockDevice(ID); if (ret.Substring(0, 1) == "0") { return(AjaxResult.Success()); } else if (ret.Substring(0, 1) == "1") { return(AjaxResult.Error("已执行开锁操作,但未成功!")); } else if (ret.Substring(0, 1) == "2") { return(AjaxResult.Error("开锁超时!")); } else { return(AjaxResult.Error("开锁失败!")); } } }