Exemplo n.º 1
0
        public string GetNewFamilyInfo(string newLockId, string userId)
        {
            if (!authentication.ValideLockUser())
            {
                return("{'headerError'}");
            }
            Dictionary <string, string> ret = new Dictionary <string, string>();
            NewLockManager manager          = new NewLockManager();
            //传值校验
            Dictionary <string, string> dic = new Dictionary <string, string>();

            dic.Add("newLockId", newLockId);
            string returnFiled = manager.checkIsNullFild(dic);

            if (returnFiled != string.Empty)
            {
                ret.Add("ret", "1");
                ret.Add("msg", "字段" + returnFiled + "不允许为空!");
                return(JSONHelper.ToJson(ret));
            }
            //判断是否授权
            if (manager.GetIsEnterprise(userId) == "2")
            {
                ret.Add("ret", "1");
                ret.Add("msg", "我公司暂无给贵公司授权,请核对再操做!");
                return(JSONHelper.ToJson(ret));
            }
            //判断接口是否授权
            if (!manager.GetIsInterfacePermissions("7", userId))
            {
                ret.Add("ret", "1");
                ret.Add("msg", "我公司暂无给贵公司授权该接口,请核对再操做!");
                return(JSONHelper.ToJson(ret));
            }
            RentInfoHelper helper = new RentInfoHelper();

            ret.Add("ret", "0");
            ret.Add("msg", helper.GetJSONInfo("select * from v_EnterpriseHomeLock_view where NewLockID='" + newLockId + "'"));
            return(JSONHelper.ToJson(ret));
        }
Exemplo n.º 2
0
        public string NewSelPasswordICcard(string newLockId, int type, string userId)
        {
            if (!authentication.ValideLockUser())
            {
                return("{'headerError'}");
            }
            NewLockManager managerNew       = new NewLockManager();
            Dictionary <string, string> ret = new Dictionary <string, string>();
            //传值校验
            Dictionary <string, string> dic = new Dictionary <string, string>();

            dic.Add("newLockId", newLockId);
            dic.Add("type", type.ToString());
            string returnFiled = managerNew.checkIsNullFild(dic);

            if (returnFiled != string.Empty)
            {
                ret.Add("ret", "1");
                ret.Add("msg", "字段" + returnFiled + "不允许为空!");
                return(JSONHelper.ToJson(ret));
            }
            //判断是否授权
            if (managerNew.GetIsEnterprise(userId) == "2")
            {
                ret.Add("ret", "1");
                ret.Add("msg", "我公司暂无给贵公司授权,请核对再操做!");
                return(JSONHelper.ToJson(ret));
            }
            //判断接口是否授权
            if (!managerNew.GetIsInterfacePermissions("12", userId))
            {
                ret.Add("ret", "1");
                ret.Add("msg", "我公司暂无给贵公司授权该接口,请核对再操做!");
                return(JSONHelper.ToJson(ret));
            }
            if (type != 1 && type != 2)
            {
                ret.Add("ret", "1");
                ret.Add("msg", "type参数值超出允许范围!");
                return(JSONHelper.ToJson(ret));
            }
            string lockId = managerNew.getDeviceID(newLockId, "DeviceID");
            string UserId = managerNew.getDeviceID(newLockId, "UserId");

            if (lockId == string.Empty || userId == string.Empty)
            {
                ret.Add("ret", "1");
                ret.Add("msg", "未获取该家庭锁信息!");
                return(JSONHelper.ToJson(ret));
            }
            RentInfoHelper helper = new RentInfoHelper();

            if (type == 1)
            {
                ret.Add("ret", "0");
                ret.Add("msg", helper.GetJSONInfo("select ID,LockID,ICCard,StartDate,EndDate,IsValid,UserId from v_RentICCard_view where LockID='" + lockId + " and Status='0' and UserId='" + UserId + "'and ICCard is not null and len(ICCard)>0"));
                return(JSONHelper.ToJson(ret));
            }
            else
            {
                ret.Add("ret", "0");
                ret.Add("msg", helper.GetJSONInfo("select ID,LockID,Password,StartDate,EndDate,IsValid,UserId from v_RentPass_view where LockID='" + lockId + "' and Status='0' and UserId='" + UserId + "'and IsAdd is not null and len(IsAdd)>0"));
                return(JSONHelper.ToJson(ret));
            }
        }