public static AjaxResult DeletePassword(string id, string locktype) { if (locktype == "1") //新锁 { NewLockManager managerNew = new NewLockManager(); managerNew.DeletePassword(id); } else { LockManager manager = new LockManager(); manager.DeletePassword(id); } return(AjaxResult.Success()); }
public string NewDelPasswordICcard(string id, string type, string userId) { if (!authentication.ValideLockUser()) { return("{'headerError'}"); } string returnInfo = string.Empty; NewLockManager managerNew = new NewLockManager(); Dictionary <string, string> ret = new Dictionary <string, string>(); //传值校验 Dictionary <string, string> dic = new Dictionary <string, string>(); dic.Add("id", id); dic.Add("type", type); dic.Add("userId", userId); 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("11", 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 sql = string.Empty; //校验删除的密码和卡片是否属于该企业 if (type == "1") { sql = "select * from v_RentPass_view where Status='0' and UserId='" + userId + "'and IsAdd is not null and len(IsAdd)>0 and ID='" + id + "'"; DataTable dt = MySQLHelper.ExecuteDataset(MySQLHelper.SqlConnString, MySQLHelper.CreateCommand(sql)).Tables[0]; if (dt.Rows.Count > 0) { returnInfo = managerNew.DeletePassword(id); } else { ret.Add("ret", "1"); ret.Add("msg", "未查到该密码,无法删除!"); return(JSONHelper.ToJson(ret)); } } else if (type == "2") { sql = "select ID from v_RentICCard_view where Status='0' and UserId='" + userId + "'and ICCard is not null and len(ICCard)>0 and ID='" + id + "'"; DataTable dt = MySQLHelper.ExecuteDataset(MySQLHelper.SqlConnString, MySQLHelper.CreateCommand(sql)).Tables[0]; if (dt.Rows.Count > 0) { returnInfo = managerNew.DeleteICCard(id); } else { ret.Add("ret", "1"); ret.Add("msg", "未查到该卡片,无法删除!"); return(JSONHelper.ToJson(ret)); } } return(returnInfo); }