public static AjaxResult AddPassword(string id, string deviceId, string password, string startDate, string endDate, string locktype) { NewLockManager managerNew = new NewLockManager(); string start = managerNew.GetDateTime(startDate).ToString(); string end = managerNew.GetDateTime(endDate).ToString(); if (locktype == "1") //新锁 { string type = startDate == endDate ? "1" : "2"; string returnDate = managerNew.GetPostInterface(deviceId, "Admin", type, password, start, end); Dictionary <string, object> returnInfo = new Dictionary <string, object>(); returnInfo = JSONHelper.FromJson <Dictionary <string, object> >(returnDate); if (returnInfo["ret"].ToString() == "1") { return(AjaxResult.Error(returnInfo["msg"].ToString())); } } else { LockManager manager = new LockManager(); manager.AddPassword(deviceId, password, startDate, endDate); string ret = manager.UpdatePassengerInfoToDevice(deviceId, "", "", "", password, DateTime.Parse(start).ToString("yyyyMMddHHmm").Substring(2, 10), DateTime.Parse(end).ToString("yyyyMMddHHmm").Substring(2, 10), "3"); } return(AjaxResult.Success()); }
public static AjaxResult UpdatePassword(string id, string deviceId, string password, string startDate, string endDate, string locktype) { NewLockManager managerNew = new NewLockManager(); string start = managerNew.GetDateTime(startDate).ToString(); string end = managerNew.GetDateTime(endDate).ToString(); if (locktype == "1") //新锁 { return(AjaxResult.Error("暂时不支持修改,请先进行删除,在进行添加")); } else { LockManager manager = new LockManager(); manager.UpdatePassword(id, deviceId, password, start, end); } return(AjaxResult.Success()); }
public static AjaxResult UpdateICCard(string id, string deviceId, string icCard, string startDate, string endDate, string locktype) { NewLockManager managerNew = new NewLockManager(); string start = managerNew.GetDateTime(startDate).ToString(); string end = managerNew.GetDateTime(endDate).ToString(); if (locktype == "1") //新锁 { return(AjaxResult.Error("暂时不支持修改,请先进行删除,在进行添加")); } else { LockManager manager = new LockManager(); manager.UpdateICCard(id, deviceId, icCard, startDate, endDate); manager.UpdatePassengerInfoToDevice(deviceId, icCard, "", "", "", DateTime.Parse(start).ToString("yyyyMMddHHmm").Substring(2, 10), DateTime.Parse(end).ToString("yyyyMMddHHmm").Substring(2, 10), "1"); } return(AjaxResult.Success()); }