/// <summary> /// 推荐资源 /// </summary> /// <param name="topNum"></param> /// <param name="loginName"></param> /// <returns></returns> public DataSet GetRecommResoure(int topNum, string loginName) { string sql = "select top " + topNum + " * from recommResource where RecommToUser='******' order by newid() desc";//recommdate CrmDBHelper topfocrm = new CrmDBHelper(); return(topfocrm.Query(sql)); }
public CompanyModel SelCompany(string name) { CompanyModel com = new CompanyModel(); string sql = "select [CompanyID],[LoginName],[CompanyName],[IndustryID],[IndustryName],[RangeID]," + "[RangeName],[NatureID],[NatureName],[CreateDate],[Hit],[AuditingStatus],[HtmlFile],[Integrity]," + "[EstablishMent],[Employees],[Capital],[Ismake],[IsDelete],[LinkName],[Email],[TelPhone],[Mobile]," + "[URL],[Address],[Logo],[Introduction],[ServiceProce],[Title],[Keywords],[Description],[Sheng],[City] from [CompanyTab] " + "where LoginName=@name and IsDelete=0"; SqlParameter[] para = { new SqlParameter("@name", SqlDbType.VarChar, 50) }; para[0].Value = name; DataSet ds = crm.Query(sql, para); if (ds.Tables[0].Rows.Count <= 0) { return(null); } com.CompanyID = Convert.ToInt32(ds.Tables[0].Rows[0]["CompanyID"].ToString()); //用户编号 com.LoginName = ds.Tables[0].Rows[0]["LoginName"].ToString(); //用户帐号 com.CompanyName = ds.Tables[0].Rows[0]["CompanyName"].ToString(); //企业名称 com.IndustryID = Convert.ToInt32(ds.Tables[0].Rows[0]["IndustryID"].ToString()); //行业ID com.IndustryName = ds.Tables[0].Rows[0]["IndustryName"].ToString(); //行业名称 com.RangeID = Convert.ToInt32(ds.Tables[0].Rows[0]["RangeID"].ToString()); //区域ID com.RangeName = ds.Tables[0].Rows[0]["RangeName"].ToString(); //区域名称 com.NatureID = Convert.ToInt32(ds.Tables[0].Rows[0]["NatureID"].ToString()); //企业性质ID com.NatureName = ds.Tables[0].Rows[0]["NatureName"].ToString(); //企业性质名称 com.CreateDate = Convert.ToDateTime(ds.Tables[0].Rows[0]["CreateDate"].ToString()); //发布日期 com.Hit = Convert.ToInt32(ds.Tables[0].Rows[0]["Hit"].ToString()); //点击率 com.Auditingstatus = Convert.ToInt32(ds.Tables[0].Rows[0]["Auditingstatus"].ToString()); //审核状态 com.Htmlfile = ds.Tables[0].Rows[0]["Htmlfile"].ToString(); //静态路径 com.Integrity = Convert.ToInt32(ds.Tables[0].Rows[0]["Integrity"].ToString()); //诚信指度 com.EstablishMent = ds.Tables[0].Rows[0]["EstablishMent"].ToString(); //成立日期 com.Employees = Convert.ToInt64(ds.Tables[0].Rows[0]["Employees"].ToString()); //员工人数 com.Capital = Convert.ToInt64(ds.Tables[0].Rows[0]["Capital"].ToString()); //注册自己 com.Ismake = Convert.ToInt32(ds.Tables[0].Rows[0]["Ismake"].ToString()); //是否推荐 com.IsDelete = Convert.ToInt32(ds.Tables[0].Rows[0]["IsDelete"].ToString()); //是否删除 com.Provice = Convert.ToInt32(ds.Tables[0].Rows[0]["Sheng"].ToString()); //省份 com.City = Convert.ToInt32(ds.Tables[0].Rows[0]["City"].ToString()); //市区 com.LinkName = ds.Tables[0].Rows[0]["LinkName"].ToString(); //联系人 com.Email = ds.Tables[0].Rows[0]["Email"].ToString(); //电子邮箱 com.Telphone = ds.Tables[0].Rows[0]["TelPhone"].ToString(); //电话号码 com.Mobile = ds.Tables[0].Rows[0]["Mobile"].ToString(); //手机号码 com.URL = ds.Tables[0].Rows[0]["URL"].ToString(); //网址 com.Address = ds.Tables[0].Rows[0]["Address"].ToString(); //联系地址 com.Logo = ds.Tables[0].Rows[0]["Logo"].ToString(); //图片 com.Introduction = ds.Tables[0].Rows[0]["Introduction"].ToString(); //企业介绍 com.ServiceProce = ds.Tables[0].Rows[0]["ServiceProce"].ToString(); //主营介绍 com.Title = ds.Tables[0].Rows[0]["Title"].ToString(); //标题 com.Keywords = ds.Tables[0].Rows[0]["Keywords"].ToString(); //网页关键字 com.Description = ds.Tables[0].Rows[0]["Description"].ToString(); //网页短标题 return(com); }
/// <summary> /// 得到一个对象实体 /// </summary> public Tz888.Model.Recomm.recommResourceM GetModel(int RecommID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 RecommID,ResourceId,ResourceTitle,ResourceTypeId,ResourceUrl,RecommName,RecommToUser,RecommDate from recommResource "); strSql.Append(" where RecommID=@RecommID"); SqlParameter[] parameters = { new SqlParameter("@RecommID", SqlDbType.Int, 4) }; parameters[0].Value = RecommID; Tz888.Model.Recomm.recommResourceM model = new Tz888.Model.Recomm.recommResourceM(); DataSet ds = crm.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["RecommID"].ToString() != "") { model.RecommID = int.Parse(ds.Tables[0].Rows[0]["RecommID"].ToString()); } if (ds.Tables[0].Rows[0]["ResourceId"].ToString() != "") { model.ResourceId = long.Parse(ds.Tables[0].Rows[0]["ResourceId"].ToString()); } model.ResourceTitle = ds.Tables[0].Rows[0]["ResourceTitle"].ToString(); if (ds.Tables[0].Rows[0]["ResourceTypeId"].ToString() != "") { model.ResourceTypeId = int.Parse(ds.Tables[0].Rows[0]["ResourceTypeId"].ToString()); } model.ResourceUrl = ds.Tables[0].Rows[0]["ResourceUrl"].ToString(); model.RecommName = ds.Tables[0].Rows[0]["RecommName"].ToString(); model.RecommToUser = ds.Tables[0].Rows[0]["RecommToUser"].ToString(); if (ds.Tables[0].Rows[0]["RecommDate"].ToString() != "") { model.RecommDate = DateTime.Parse(ds.Tables[0].Rows[0]["RecommDate"].ToString()); } return(model); } else { return(null); } }
/// <summary> /// 根据所对应的InfoID查找访问信息 /// </summary> /// <param name="InfoID"></param> /// <param name="n"></param> /// <returns></returns> public string SelAccess(string InfoID, int n) { StringBuilder sb = new StringBuilder(); string sql = "select top 10 AccessName,AccessTime,AccessIP,ProinceID from AccessInfoTab where InfoID=@InfoID and " + "AccessID not in(select top " + 10 * n + " AccessID from AccessInfoTab where InfoID=@InfoID order by AccessID desc )" + " order by AccessID desc"; SqlParameter[] para = { new SqlParameter("@InfoID", SqlDbType.VarChar, 50) }; para[0].Value = InfoID; DataSet ds = crm.Query(sql, para); sb.Append("<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><thead><tr>"); sb.Append("<td width=\"17%\">访问者</td>"); sb.Append("<td width=\"21%\">访问时间</td>"); sb.Append("<td width=\"19%\">所对应IP</td>"); sb.Append("<td width=\"17%\">所在的省</td>"); sb.Append("<td width=\"14%\">查看</td>"); sb.Append("</tr></thead>"); if (ds != null & ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < (ds.Tables[0].Rows.Count > 10 ? 10 : ds.Tables[0].Rows.Count); i++) { DataRow row = ds.Tables[0].Rows[i]; sb.Append("<tr>"); if (row["AccessName"].ToString() == "游客") { sb.Append("<td><span class='lan1'>" + row["AccessName"].ToString() + "</span></td>"); } else { sb.Append("<td><a href=\"SelAccessName.aspx?AccessName=" + row["AccessName"].ToString() + "\" class=\"lan1\">" + row["AccessName"].ToString() + "</a></td>"); } sb.Append("<td>" + row["AccessTime"].ToString() + "</td>"); sb.Append("<td>" + row["AccessIP"] + "</td>"); sb.Append("<td>" + row["ProinceID"].ToString() + "</td>"); if (row["AccessName"].ToString() == "游客") { sb.Append("<td><span class='lan1'>信息不存在</span></td>"); } else { sb.Append("<td><a href=\"SelAccessName.aspx?AccessName=" + row["AccessName"].ToString() + "\" class=\"lan1\">查看信息</a></td>"); } sb.Append("</tr>"); } } sb.Append("</table>"); return(sb.ToString()); }