/// <summary> /// 查询商品 /// </summary> /// <returns></returns> public string GetPro() { DataSet dt = new DataSet(); List <SqlParameter> parameters = new List <SqlParameter>(); string sqlWhere = " AID =@AID "; var parameter = new SqlParameter("@AID", DbType.AnsiString); parameter.Value = hidAId.Value; parameters.Add(parameter); dt = cmProDal.GetListPro(sqlWhere, parameters); StringBuilder strBuilder = new StringBuilder(); if (dt != null) { if (dt.Tables[0].Rows.Count > 0) { for (int i = 0; i < dt.Tables[0].Rows.Count; i++) { strBuilder.Append(" <tr id='tr2'>"); strBuilder.Append(" <td>" + dt.Tables[0].Rows[i]["Title"] + "</td>"); var orgInfo = orgDal.GetModel(Convert.ToInt64(dt.Tables[0].Rows[i]["OrgId"])); strBuilder.Append(" <td>" + orgInfo.OrgName + "</td>"); strBuilder.Append(" <td style=\"width: 15%; text-align: center\">"); strBuilder.Append(" <a href=\"javascript:void(0);\" onclick=\"delProAId(this,'" + dt.Tables[0].Rows[i]["AID"] + "','" + dt.Tables[0].Rows[i]["PID"] + "');return false;\" data-backdrop=\"false\">删除</a>"); strBuilder.Append(" </td>"); strBuilder.Append(" </tr>"); } } } return(strBuilder.ToString()); }
private void BindOrgName() { var timodel = _tempInfoDal.GetModel(Convert.ToInt32(Request.QueryString["tiid"])); if (null != timodel) { //var sql = "select Infos.* from Infos where TIID in (select TIID from TempInfo where (ITID in(select ITID from InfoType where SPID in(select SPID from StaPackage join OrgOrganize on OrgOrganize.OrgId=StaPackage.OrgId where (OrgName='全国热点' or OrgOrganize.OrgId=(select OrgId from StaPackage join InfoType on InfoType.SPID=StaPackage.SPID where InfoType.ITID=@ITID)) ))) and TIID!=@TIID and TID=@TID) and Infos.SortNum=@SortNum "; //var sql = "select Infos.* from Infos where TIID in (select TIID from TempInfo where (ITID in(select ITID from InfoType where SPID in(select SPID from StaPackage join OrgOrganize on OrgOrganize.OrgId=StaPackage.OrgId where (OrgOrganize.OrgId=(select OrgId from StaPackage join InfoType on InfoType.SPID=StaPackage.SPID where InfoType.ITID=@ITID)) ))) and TIID!=@TIID and TID=@TID) and Infos.SortNum=@SortNum "; var sql = @"select Infos.IID,RootPackage.RPName+'-'+ (case StaPackage.PkgType when 0 then '默认资源包' else (select OrgOrganize.OrgName from OrgPkgList join OrgOrganize on OrgOrganize.OrgId=OrgPkgList.OrgId and OrgPkgList.SPID=StaPackage.SPID) end)+'-'+Infos.IName AS IName from Infos join TempInfo on TempInfo.TIID=Infos.TIID join InfoType on InfoType.ITID=TempInfo.ITID join StaPackage on StaPackage.SPID=InfoType.SPID join RootPackage on RootPackage.RPID=StaPackage.RPID join OrgOrganize on OrgOrganize.OrgId=StaPackage.OrgId where StaPackage.OrgId=(select OrgId from StaPackage join InfoType on InfoType.SPID=StaPackage.SPID where InfoType.ITID=@ITID) and TempInfo.TIID!=@TIID and TempInfo.TID=@TID and Infos.SortNum=@SortNum and (StaPackage.SPID in (select SPID from OrgPkgList) or StaPackage.SPID=@SPID) "; var itmodel = _infoTypeDal.GetModel(Convert.ToInt32(timodel.ITID)); if (null != itmodel) { var smodel = _staPackageDal.GetModel(Convert.ToInt32(itmodel.SPID)); if (null != smodel) { var org = _orgOrganizeDal.GetModel(Convert.ToInt64(smodel.OrgId)); if ("全国热点" == org.OrgName) { //sql = "select Infos.IID,(Infos.IName +'-'+ OrgOrganize.OrgName) as IName from Infos join TempInfo on TempInfo.TIID=Infos.TIID join InfoType on InfoType.ITID=TempInfo.ITID join StaPackage on StaPackage.SPID=InfoType.SPID join OrgOrganize on OrgOrganize.OrgId=StaPackage.OrgId where OrgOrganize.OrgId in (select OrgId from OrgOrganize where OrgType=1 and OrgId!='" + smodel.OrgId + "') and TempInfo.TIID!=@TIID and TID=@TID and Infos.SortNum=@SortNum"; sql = @"select Infos.IID,RootPackage.RPName+'-'+ (case StaPackage.PkgType when 0 then '默认资源包' else (select OrgOrganize.OrgName from OrgPkgList join OrgOrganize on OrgOrganize.OrgId=OrgPkgList.OrgId and OrgPkgList.SPID=StaPackage.SPID) end)+'-'+Infos.IName AS IName from Infos join TempInfo on TempInfo.TIID=Infos.TIID join InfoType on InfoType.ITID=TempInfo.ITID join StaPackage on StaPackage.SPID=InfoType.SPID join RootPackage on RootPackage.RPID=StaPackage.RPID join OrgOrganize on OrgOrganize.OrgId=StaPackage.OrgId where StaPackage.OrgId in (select OrgId from OrgOrganize where OrgType=1 and "; sql += "OrgId!='" + smodel.OrgId + "') and TempInfo.TIID!=@TIID and TempInfo.TID=@TID and Infos.SortNum=@SortNum and (StaPackage.SPID in (select SPID from OrgPkgList) or StaPackage.SPID=@SPID or StaPackage.SPID in (select StaPackage.SPID from StaPackage join RootPackage on RootPackage.RPID=StaPackage.RPID where StaPackage.PkgType=0 and RootPackage.RPID=(select RootPackage.RPID from RootPackage join StaPackage on RootPackage.RPID=StaPackage.RPID join InfoType on InfoType.SPID=StaPackage.SPID join TempInfo on InfoType.ITID=TempInfo.ITID where TempInfo.TIID=@TIID) )) "; } } } sql += " order by Infos.IID desc "; Database db = DatabaseFactory.CreateDatabase(); DbCommand dbCommand = db.GetSqlStringCommand(sql); dbCommand.Parameters.Add(new SqlParameter("@TID", DbType.Int32) { Value = timodel.TID }); dbCommand.Parameters.Add(new SqlParameter("@SortNum", DbType.Int32) { Value = Request.QueryString["sortnum"] }); dbCommand.Parameters.Add(new SqlParameter("@TIID", DbType.Int32) { Value = timodel.TIID }); dbCommand.Parameters.Add(new SqlParameter("@ITID", DbType.Int32) { Value = timodel.ITID }); if (null != itmodel) { dbCommand.Parameters.Add(new SqlParameter("@SPID", DbType.Int32) { Value = itmodel.SPID }); } else { dbCommand.Parameters.Add(new SqlParameter("@SPID", DbType.Int32) { Value = "" }); } var dt = db.ExecuteDataSet(dbCommand).Tables[0]; ddlOrgName.DataSource = dt; ddlOrgName.DataTextField = "IName"; ddlOrgName.DataValueField = "IID"; ddlOrgName.DataBind(); ddlOrgName.Items.Insert(0, new ListItem("请选择", "-1")); ddlOrgName.SelectedIndex = 0; } }
protected void Page_Load(object sender, EventArgs e) { VerifyPage("", true); if (!IsPostBack) { if (!string.IsNullOrEmpty(Request.QueryString["spid"])) { var sta = _staPackageDal.GetModel(Convert.ToInt32(Request.QueryString["spid"])); if (null != sta) { var orgModel = _orgOrganizeDal.GetModel(Convert.ToInt64(sta.OrgId)); if (null != orgModel) { litOrg.Text = orgModel.OrgName; } } #region List <SqlParameter> pars1 = new List <SqlParameter>(); var par1 = new SqlParameter("@SPID", DbType.AnsiString) { Value = Request.QueryString["spid"] }; pars1.Add(par1); var type1 = _infoTypeDal.GetModel(" SPID=@SPID and Status=1 and SortNum=1 ", pars1); if (null != type1) { litType1.Text = "<li data-typeid=\"" + type1.ITID + "\"><pre><img alt=\"\" src=\"/UploadFiles/" + type1.AttaID + "\" style=\"width: 26px; height: 32px;\">" + type1.IName + "</pre></li>"; } else { litType1.Text = "<li data-typeid=\"\"><a href=\"javascript:;\" class=\"btn btn-mini\" onclick=\"addtype('1')\">新建分类</a></li>"; } #endregion #region List <SqlParameter> pars2 = new List <SqlParameter>(); var par2 = new SqlParameter("@SPID", DbType.AnsiString) { Value = Request.QueryString["spid"] }; pars2.Add(par2); var type2 = _infoTypeDal.GetModel(" SPID=@SPID and Status=1 and SortNum=1 ", pars2); if (null != type2) { litType2.Text = "<li data-typeid=\"" + type2.ITID + "\"><pre><img alt=\"\" src=\"/UploadFiles/" + type2.AttaID + "\" style=\"width: 26px; height: 32px;\">" + type2.IName + "</pre></li>"; } else { litType2.Text = "<li data-typeid=\"\"><a href=\"javascript:;\" class=\"btn btn-mini\" onclick=\"addtype('2')\">新建分类</a></li>"; } #endregion #region List <SqlParameter> pars3 = new List <SqlParameter>(); var par3 = new SqlParameter("@SPID", DbType.AnsiString) { Value = Request.QueryString["spid"] }; pars3.Add(par3); var type3 = _infoTypeDal.GetModel(" SPID=@SPID and Status=1 and SortNum=1 ", pars3); if (null != type3) { litType3.Text = "<li data-typeid=\"" + type3.ITID + "\"><pre><img alt=\"\" src=\"/UploadFiles/" + type3.AttaID + "\" style=\"width: 26px; height: 32px;\">" + type3.IName + "</pre></li>"; } else { litType3.Text = "<li data-typeid=\"\"><a href=\"javascript:;\" class=\"btn btn-mini\" onclick=\"addtype('3')\">新建分类</a></li>"; } #endregion #region List <SqlParameter> pars4 = new List <SqlParameter>(); var par4 = new SqlParameter("@SPID", DbType.AnsiString) { Value = Request.QueryString["spid"] }; pars4.Add(par4); var type4 = _infoTypeDal.GetModel(" SPID=@SPID and Status=1 and SortNum=1 ", pars4); if (null != type4) { litType4.Text = "<li data-typeid=\"" + type4.ITID + "\"><pre><img alt=\"\" src=\"/UploadFiles/" + type4.AttaID + "\" style=\"width: 26px; height: 32px;\">" + type4.IName + "</pre></li>"; } else { litType4.Text = "<li data-typeid=\"\"><a href=\"javascript:;\" class=\"btn btn-mini\" onclick=\"addtype('4')\">新建分类</a></li>"; } #endregion #region List <SqlParameter> pars5 = new List <SqlParameter>(); var par5 = new SqlParameter("@SPID", DbType.AnsiString) { Value = Request.QueryString["spid"] }; pars5.Add(par5); var type5 = _infoTypeDal.GetModel(" SPID=@SPID and Status=1 and SortNum=1 ", pars5); if (null != type5) { litType5.Text = "<li data-typeid=\"" + type5.ITID + "\"><pre><img alt=\"\" src=\"/UploadFiles/" + type5.AttaID + "\" style=\"width: 26px; height: 32px;\">" + type5.IName + "</pre></li>"; } else { litType5.Text = "<li data-typeid=\"\"><a href=\"javascript:;\" class=\"btn btn-mini\" onclick=\"addtype('5')\">新建分类</a></li>"; } #endregion #region List <SqlParameter> pars6 = new List <SqlParameter>(); var par6 = new SqlParameter("@SPID", DbType.AnsiString) { Value = Request.QueryString["spid"] }; pars6.Add(par6); var type6 = _infoTypeDal.GetModel(" SPID=@SPID and Status=1 and SortNum=1 ", pars6); if (null != type6) { litType6.Text = "<li data-typeid=\"" + type6.ITID + "\"><pre><img alt=\"\" src=\"/UploadFiles/" + type6.AttaID + "\" style=\"width: 26px; height: 32px;\">" + type6.IName + "</pre></li>"; } else { litType6.Text = "<li data-typeid=\"\"><a href=\"javascript:;\" class=\"btn btn-mini\" onclick=\"addtype('6')\">新建分类</a></li>"; } #endregion #region List <SqlParameter> pars7 = new List <SqlParameter>(); var par7 = new SqlParameter("@SPID", DbType.AnsiString) { Value = Request.QueryString["spid"] }; pars7.Add(par7); var type7 = _infoTypeDal.GetModel(" SPID=@SPID and Status=1 and SortNum=1 ", pars7); if (null != type7) { litType7.Text = "<li data-typeid=\"" + type7.ITID + "\"><pre><img alt=\"\" src=\"/UploadFiles/" + type7.AttaID + "\" style=\"width: 26px; height: 32px;\">" + type7.IName + "</pre></li>"; } else { litType7.Text = "<li data-typeid=\"\"><a href=\"javascript:;\" class=\"btn btn-mini\" onclick=\"addtype('7')\">新建分类</a></li>"; } #endregion #region List <SqlParameter> pars8 = new List <SqlParameter>(); var par8 = new SqlParameter("@SPID", DbType.AnsiString) { Value = Request.QueryString["spid"] }; pars8.Add(par8); var type8 = _infoTypeDal.GetModel(" SPID=@SPID and Status=1 and SortNum=1 ", pars8); if (null != type8) { litType8.Text = "<li data-typeid=\"" + type8.ITID + "\"><pre><img alt=\"\" src=\"/UploadFiles/" + type8.AttaID + "\" style=\"width: 26px; height: 32px;\">" + type8.IName + "</pre></li>"; } else { litType8.Text = "<li data-typeid=\"\"><a href=\"javascript:;\" class=\"btn btn-mini\" onclick=\"addtype('8')\">新建分类</a></li>"; } #endregion } } }