コード例 #1
0
ファイル: AjaxBaseManage.cs プロジェクト: Tony9866/anxinsu
        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());
        }