/// <summary> /// 推广--获取用户具有权限的城市过滤条件对象 /// </summary> /// <param name="userid"></param> /// <returns></returns> public BusinessFilter GetCityFilterByPromotion(int userid) { Wicresoft.DataAccess.SQLServer dal = new Wicresoft.DataAccess.SQLServer(); BusinessFilter filter = new BusinessFilter("Dictionary"); string sql = string.Format("select a.FK_Center,b.parent as CityID,b.name from AssistantDataPermission as a left join [Dictionary] as b on a.fk_center = b.pkid where a.fk_center <> -1 and a.fk_Assistant =" + userid); DataTable dt = dal.ExcuteDataTable(new DataTable(), sql, CommandType.Text); //if (temp != null && temp.Rows.Count != 0) //{ // filter.AddCustomerFilter("Dictionary.PKID IN (" + temp.Rows[0]["CityID"].ToString() + ")", AndOr.AND); //} string strCity = string.Empty; for (int i = 0; i < dt.Rows.Count; i++) { if (dt.Rows[i]["CityID"] != null && dt.Rows[i]["CityID"].ToString() != string.Empty) { strCity += "," + dt.Rows[i]["CityID"].ToString(); } } if (strCity != string.Empty) { strCity = strCity.Substring(1, strCity.Length - 1); filter.AddCustomerFilter("Dictionary.PKID IN (" + strCity + ")", AndOr.AND); } return(filter); }
/// <summary> /// 推广--获取用户具有权限的中心过滤条件对象 /// </summary> /// <param name="userid"></param> /// <returns></returns> public string GetCenterFilterByPromotion(int userid) { Wicresoft.DataAccess.SQLServer dal = new Wicresoft.DataAccess.SQLServer(); string str = string.Empty; string sql = "select FK_Center from AssistantDataPermission where fk_Assistant = " + userid; DataTable temp = dal.ExcuteDataTable(new DataTable(), sql, CommandType.Text); if (temp != null && temp.Rows.Count != 0) { for (int i = 0; i < temp.Rows.Count; i++) { str += temp.Rows[i]["FK_Center"].ToString() + ","; } str = str.Substring(0, str.Length - 1); } return(str); }