protected void Page_Load(object sender, EventArgs e) { projectId = Request.QueryString["projectId"]; projectBrandId = Request.QueryString["projectBrandId"]; Dictionary <string, object> sqlparams = new Dictionary <string, object>(); string sql = string.Format("select areapoints,floorlevel from fv_projectbrand where id={0} limit 1 ", projectBrandId); DataTable dt = SqlManage.Query(sql, sqlparams).Tables[0]; if (dt != null && dt.Rows.Count > 0) { string spoints = dt.Rows[0][0].ToString(); floorLevelId = dt.Rows[0][1].ToString(); string[] arrayPoints = spoints.Split(';'); if (spoints != "") { foreach (string item in arrayPoints) { strForShow += string.Format("drawPt3{0};", item); } } if (floorLevelId == "") { floorLevelId = "1"; } } if (!IsPostBack) { LoadControl(); } }
private void LoadInfo(int id) { string sql = "select * from fv_projectbrand where id= " + id; Dictionary <string, object> sqlparams = new Dictionary <string, object>(); //sqlparams.Add("@id", id); DataTable table = SqlManage.Query(sql, sqlparams).Tables[0]; if (table.Rows.Count > 0) { txtName.Value = table.Rows[0]["brandName"].ToString(); txtdesc.Value = table.Rows[0]["brandDesc"].ToString(); ddltype.SelectedValue = table.Rows[0]["brandTypeId"].ToString(); hidurl.Value = table.Rows[0]["fvUrl"].ToString(); fvUrl.Value = table.Rows[0]["fvUrl"].ToString(); string imgUrl = table.Rows[0]["brandLogo"].ToString(); if (imgUrl.Contains("..")) { ImageLogo.ImageUrl = Server.MapPath(@"~/release/" + ViewState["proId"].ToString()) + @"/" + imgUrl.Substring(2); } else { ImageLogo.ImageUrl = table.Rows[0]["brandLogo"].ToString(); } string qrcodeUrl = table.Rows[0]["qrcode"].ToString(); if (qrcodeUrl.Contains("..")) { ImageQrcode.ImageUrl = @"~/release/" + ViewState["proId"].ToString() + @"/" + qrcodeUrl.Substring(2); } else { ImageQrcode.ImageUrl = table.Rows[0]["qrcode"].ToString(); } string spurl = table.Rows[0]["sphone"].ToString(); if (spurl.Contains("..")) { Image1.ImageUrl = @"~/release/" + ViewState["proId"].ToString() + @"/" + spurl.Substring(2); } else { Image1.ImageUrl = table.Rows[0]["qrcode"].ToString(); } hidPhone.Value = table.Rows[0]["sphone"].ToString(); ddlisShow.SelectedValue = table.Rows[0]["isShow"].ToString(); localpath.Value = table.Rows[0]["localvpath"].ToString(); sphoneurl.Value = table.Rows[0]["sphoneurl"].ToString(); Text1.Value = table.Rows[0]["floorlevel"].ToString(); telephone.Value = table.Rows[0]["telephone"].ToString(); address.Value = table.Rows[0]["address"].ToString(); brandOrder.Value = table.Rows[0]["brandOrder"].ToString(); // Image1.ImageUrl = table.Rows[0]["sphone"].ToString(); } }
/// <summary> /// 获得列表数据 /// </summary> /// <param name="context"></param> private void LoadMsg(HttpContext context) { int page = context.Request["page"] != "" ? Convert.ToInt32(context.Request.Form["page"]) : 1; int size = context.Request["rows"] != "" ? Convert.ToInt32(context.Request.Form["rows"]) : 1; System.Text.StringBuilder builder = new System.Text.StringBuilder(); builder.Append(@"SELECT a.id,a.brandName ,a.brandImg,a.brandDesc ,a.brandLogo, a.brandVideo ,a.brandOrder, a.brandTypeId ,a.brandTypeName , a.projectId, a.isShow, a.isStar ,a.isShowWay ,a.fvUrl ,a.createTime, a.lastChangeTime,a.floorLevel,a.areaPoints,isnull(a.areaPoints) as hasArea,sum( case isnull(b.walkWay) when 0 then 1 else 0 end) as hasPath " + " FROM fv_projectBrand a left join fv_walkway b on a.id=b.projectBrandId where a.brandTypeId= " + context.Request["projectBtId"].ToString()); Dictionary <string, object> sqlparams = new Dictionary <string, object>(); int total = 0; if (context.Request["cul"] == null && context.Request["where"] == null) { total = SqlManage.Query(@"SELECT a.id,a.brandName ,a.brandImg,a.brandDesc ,a.brandLogo, a.brandVideo ,a.brandOrder, a.brandTypeId ,a.brandTypeName , a.projectId, a.isShow, a.isStar ,a.isShowWay ,a.fvUrl ,a.createTime, a.lastChangeTime,a.floorLevel,a.areaPoints,isnull(a.areaPoints) as hasArea,sum( case isnull(b.walkWay) when 0 then 1 else 0 end) as hasPath " + " FROM fv_projectBrand a left join fv_walkway b on a.id=b.projectBrandId where a.brandTypeId= " + context.Request["projectBtId"].ToString() + " GROUP BY a.id,a.brandName ,a.brandImg,a.brandDesc ,a.brandLogo, a.brandVideo ,a.brandOrder, a.brandTypeId ,a.brandTypeName , a.projectId, a.isShow, a.isStar ,a.isShowWay ,a.fvUrl ,a.createTime, a.lastChangeTime,a.floorLevel,a.areaPoints ", sqlparams).Tables[0].Rows.Count; //return; } else { string where = context.Request["cul"].ToString() + " LIKE '%" + context.Request["where"].ToString() + "%'"; total = SqlManage.Query(@"SELECT a.id,a.brandName ,a.brandImg,a.brandDesc ,a.brandLogo, a.brandVideo ,a.brandOrder, a.brandTypeId ,a.brandTypeName , a.projectId, a.isShow, a.isStar ,a.isShowWay ,a.fvUrl ,a.createTime, a.lastChangeTime,a.floorLevel,a.areaPoints,isnull(a.areaPoints) as hasArea,sum( case isnull(b.walkWay) when 0 then 1 else 0 end) as hasPath " + " FROM fv_projectBrand a left join fv_walkway b on a.id=b.projectBrandId where a.brandTypeId= " + context.Request["projectBtId"].ToString() + " and " + where + " GROUP BY a.id,a.brandName ,a.brandImg,a.brandDesc ,a.brandLogo, a.brandVideo ,a.brandOrder, a.brandTypeId ,a.brandTypeName , a.projectId, a.isShow, a.isStar ,a.isShowWay ,a.fvUrl ,a.createTime, a.lastChangeTime,a.floorLevel,a.areaPoints ", sqlparams).Tables[0].Rows.Count; builder.Append(" and " + where); } builder.Append(" GROUP BY a.id,a.brandName ,a.brandImg,a.brandDesc ,a.brandLogo, a.brandVideo ,a.brandOrder, a.brandTypeId ,a.brandTypeName , a.projectId, a.isShow, a.isStar ,a.isShowWay ,a.fvUrl ,a.createTime, a.lastChangeTime,a.floorLevel,a.areaPoints "); builder.Append(" order by a.brandOrder,lastChangeTime desc LIMIT " + (page - 1) * size + "," + size); DataTable dt = SqlManage.Query(builder.ToString(), sqlparams).Tables[0]; Dictionary <string, object> dictionary = new Dictionary <string, object>(); //List<SOA.MODEL.DocumentModel> list = docmanage.DataTableToList(dt); dictionary.Add("total", total); List <Dictionary <string, object> > list = new List <Dictionary <string, object> >(); foreach (DataRow dr in dt.Rows)//每一行信息,新建一个Dictionary<string,object>,将该行的每列信息加入到字典 { Dictionary <string, object> result = new Dictionary <string, object>(); foreach (DataColumn dc in dt.Columns) { result.Add(dc.ColumnName, dr[dc].ToString()); } list.Add(result); } dictionary.Add("rows", list); dt.Dispose(); JavaScriptSerializer javascriptSerializer = new JavaScriptSerializer(); context.Response.Write(javascriptSerializer.Serialize(dictionary)); }
private void LoadControl(int pid) { string sql = "select id,brandTypeName from fv_projectbrandType where projectId=" + pid; Dictionary <string, object> sqlparams = new Dictionary <string, object>(); //sqlparams.Add("@id", id); DataTable table = SqlManage.Query(sql, sqlparams).Tables[0]; ddltype.DataSource = table; ddltype.DataTextField = "brandTypeName"; ddltype.DataValueField = "id"; ddltype.DataBind(); ddltype.SelectedValue = Request.QueryString["projectBtId"]; }
private void LoadInfo(int id) { string sql = "select * from fv_sysbrand where id= " + id; Dictionary <string, object> sqlparams = new Dictionary <string, object>(); //sqlparams.Add("@id", id); DataTable table = SqlManage.Query(sql, sqlparams).Tables[0]; if (table.Rows.Count > 0) { txtName.Value = table.Rows[0]["brandName"].ToString(); txtdesc.Value = table.Rows[0]["brandDesc"].ToString(); } }
private void LoadInfo(int id) { string sql = "select * from fv_floor where id= " + id; Dictionary <string, object> sqlparams = new Dictionary <string, object>(); //sqlparams.Add("@id", id); DataTable table = SqlManage.Query(sql, sqlparams).Tables[0]; if (table.Rows.Count > 0) { floorLevel.Value = table.Rows[0]["floorLevel"].ToString(); //txtdesc.Value = table.Rows[0]["sys_desc"].ToString(); //ddltype.SelectedValue = table.Rows[0]["sys_type"].ToString(); } }
private void LoadInfo(int id) { string sql = "select * from fv_project where id= " + id; Dictionary <string, object> sqlparams = new Dictionary <string, object>(); //sqlparams.Add("@id", id); DataTable table = SqlManage.Query(sql, sqlparams).Tables[0]; if (table.Rows.Count > 0) { txtName.Value = table.Rows[0]["projectName"].ToString(); txtdesc.Value = table.Rows[0]["projectDesc"].ToString(); txtcity.Value = table.Rows[0]["projectCity"].ToString(); // ddltype.SelectedValue = table.Rows[0]["sys_type"].ToString(); } }
protected void Page_Load(object sender, EventArgs e) { floorId = Request.QueryString["floorId"]; projectId = Request.QueryString["projectId"]; floorLevel = Request.QueryString["floorLevel"]; Dictionary <string, object> sqlparams = new Dictionary <string, object>(); string sql = string.Format("select id,clientPoint from fv_client where isClient=1 and floorId={0} and projectId={1} and floorLevel={2} limit 1 ", floorId, projectId, floorLevel); DataTable dt = SqlManage.Query(sql, sqlparams).Tables[0]; if (dt != null && dt.Rows.Count > 0) { strForShow = string.Format("drawPt3{0};", dt.Rows[0][1].ToString()); clientId = dt.Rows[0][0].ToString(); } }
/// <summary> /// 获得列表数据 /// </summary> /// <param name="context"></param> private void LoadMsg(HttpContext context) { int page = context.Request["page"] != "" ? Convert.ToInt32(context.Request.Form["page"]) : 1; int size = context.Request["rows"] != "" ? Convert.ToInt32(context.Request.Form["rows"]) : 1; System.Text.StringBuilder builder = new System.Text.StringBuilder(); builder.Append(@"SELECT * FROM fv_projectbrandtype where projectId=" + context.Request["projectId"].ToString()); Dictionary <string, object> sqlparams = new Dictionary <string, object>(); int total = 0; if (context.Request["cul"] == null && context.Request["where"] == null) { total = SqlManage.Query(@"select * from fv_projectbrandtype where projectId=" + context.Request["projectId"].ToString(), sqlparams).Tables[0].Rows.Count; //return; } else { string where = context.Request["cul"].ToString() + " LIKE '%" + context.Request["where"].ToString() + "%'"; total = SqlManage.Query(@"select * from fv_projectbrandtype where " + where + " and projectId=" + context.Request["projectId"].ToString(), sqlparams).Tables[0].Rows.Count; builder.Append(" and " + where); } builder.Append(" order by brandTypeOrder LIMIT " + (page - 1) * size + "," + size); DataTable dt = SqlManage.Query(builder.ToString(), sqlparams).Tables[0]; Dictionary <string, object> dictionary = new Dictionary <string, object>(); //List<SOA.MODEL.DocumentModel> list = docmanage.DataTableToList(dt); dictionary.Add("total", total); List <Dictionary <string, object> > list = new List <Dictionary <string, object> >(); foreach (DataRow dr in dt.Rows)//每一行信息,新建一个Dictionary<string,object>,将该行的每列信息加入到字典 { Dictionary <string, object> result = new Dictionary <string, object>(); foreach (DataColumn dc in dt.Columns) { result.Add(dc.ColumnName, dr[dc].ToString()); } list.Add(result); } dictionary.Add("rows", list); dt.Dispose(); JavaScriptSerializer javascriptSerializer = new JavaScriptSerializer(); context.Response.Write(javascriptSerializer.Serialize(dictionary)); }
protected void Page_Load(object sender, EventArgs e) { floorId = Request.QueryString["floorId"]; projectId = Request.QueryString["projectId"]; projectBrandId = Request.QueryString["projectBrandId"]; //无用 floorLevel = Request.QueryString["floorLevel"]; Dictionary <string, object> sqlparams = new Dictionary <string, object>(); //客户端的点 b.isClient=1 nextPointName对应C TO 电梯的路径 string sql = string.Format("select id,clientPoint,nextPointName from fv_client where isClient=1 and floorId={0} and projectId={1} and floorLevel={2} limit 1 ", floorId, projectId, floorLevel); DataTable dt = SqlManage.Query(sql, sqlparams).Tables[0]; if (dt != null && dt.Rows.Count > 0) { clientId = dt.Rows[0][0].ToString(); string ctoLPath = dt.Rows[0][2].ToString(); if (!string.IsNullOrEmpty(ctoLPath)) { string[] arrS = ctoLPath.Split(';'); foreach (string item in arrS) { strForShow += string.Format("drawPt3{0};", item); } //strForClient = string.Format("drawPt3{0};", dt.Rows[0][1].ToString()); //strForShow += strForClient; } //floorLevel = dt.Rows[0][2].ToString(); } // //路径的点 // sql = string.Format("select c.walkWay from fv_projectbrand a,fv_client b,fv_walkway c " + //"where a.projectId=b.projectId and a.floorLevel=b.floorLevel and a.id=c.projectBrandId and b.id=c.fromClientId and b.isClient=1 and a.id={0} limit 1 ", projectBrandId); // dt = SqlManage.Query(sql, sqlparams).Tables[0]; // if (dt != null && dt.Rows.Count > 0) // { // strForShow = ""; // string paths = dt.Rows[0][0].ToString(); // string[] arrayPaths = paths.Split(';'); // foreach (string item in arrayPaths) // { // strForShow += string.Format("drawPt3{0};", item); // } }
protected void Page_Load(object sender, EventArgs e) { projectId = Request.QueryString["projectId"]; projectBrandId = Request.QueryString["projectBrandId"]; floorLevel = Request.QueryString["floorLevel"]; Dictionary <string, object> sqlparams = new Dictionary <string, object>(); //客户端的点 b.isClient=1 string sql = string.Format("select b.id,b.clientPoint,a.floorLevel from fv_projectbrand a,fv_client b " + "where a.projectId=b.projectId and a.floorLevel=b.floorLevel and b.isClient=1 and a.id={0}", projectBrandId); DataTable dt = SqlManage.Query(sql, sqlparams).Tables[0]; if (dt != null && dt.Rows.Count > 0) { clientId = dt.Rows[0][0].ToString(); strForClient = string.Format("drawPt3{0};", dt.Rows[0][1].ToString()); strForShow += strForClient; floorLevel = dt.Rows[0][2].ToString(); //重新获取一下,免得数据不准确 } else { Response.Write("<script>alert('请先设置该楼层客户端位置和该品牌区域信息!');window.close();</script>"); } //路径的点 sql = string.Format("select c.walkWay from fv_projectbrand a,fv_client b,fv_walkway c " + "where a.projectId=b.projectId and a.floorLevel=b.floorLevel and a.id=c.projectBrandId and b.id=c.fromClientId and b.isClient=1 and a.id={0} limit 1 ", projectBrandId); dt = SqlManage.Query(sql, sqlparams).Tables[0]; if (dt != null && dt.Rows.Count > 0) { strForShow = ""; string paths = dt.Rows[0][0].ToString(); string[] arrayPaths = paths.Split(';'); foreach (string item in arrayPaths) { strForShow += string.Format("drawPt3{0};", item); } } //if (!IsPostBack) //{ // LoadControl(); //} }
private void LoadControl() { Dictionary <string, object> sqlparams = new Dictionary <string, object>(); DataTable dt = SqlManage.Query("select id,floorlevel from fv_floor where projectId=" + projectId, sqlparams).Tables[0]; floorLevel.DataSource = dt; floorLevel.DataValueField = "floorlevel"; floorLevel.DataTextField = "floorlevel"; floorLevel.DataBind(); if (dt.Rows.Count > 0) { floorLevel.Value = floorLevelId; hidFloorId.Value = floorLevelId; } else { Response.Write("<script>alert('请先设置该楼层信息!');window.close();</script>"); } }
/// <summary> /// 获得列表数据 /// </summary> /// <param name="context"></param> private void LoadMsg(HttpContext context) { int page = context.Request["page"] != "" ? Convert.ToInt32(context.Request.Form["page"]) : 1; int size = context.Request["rows"] != "" ? Convert.ToInt32(context.Request.Form["rows"]) : 1; System.Text.StringBuilder builder = new System.Text.StringBuilder(); builder.Append(@"SELECT a.id,a.projectId,a.floorLevel,a.floorImg,a.createTime,a.lastChangeTime,sum(case b.isClient when 1 then 2 when 0 then 1 else 0 end) as hasClient " + "FROM fv_floor a left join fv_client b on a.floorLevel=b.floorLevel and a.projectId=b.projectId "); builder.Append(" where a.projectid=" + context.Request["projectId"] + " group by a.id,a.projectId,a.floorLevel,a.floorImg,a.createTime,a.lastChangeTime "); builder.Append(" LIMIT " + (page - 1) + "," + size); Dictionary <string, object> sqlparams = new Dictionary <string, object>(); DataTable dt = SqlManage.Query(builder.ToString(), sqlparams).Tables[0]; Dictionary <string, object> dictionary = new Dictionary <string, object>(); //List<SOA.MODEL.DocumentModel> list = docmanage.DataTableToList(dt); dictionary.Add("total", dt.Rows.Count); List <Dictionary <string, object> > list = new List <Dictionary <string, object> >(); foreach (DataRow dr in dt.Rows)//每一行信息,新建一个Dictionary<string,object>,将该行的每列信息加入到字典 { Dictionary <string, object> result = new Dictionary <string, object>(); foreach (DataColumn dc in dt.Columns) { result.Add(dc.ColumnName, dr[dc].ToString()); } list.Add(result); } dictionary.Add("rows", list); dt.Dispose(); JavaScriptSerializer javascriptSerializer = new JavaScriptSerializer(); context.Response.Write(javascriptSerializer.Serialize(dictionary)); }
/// <summary> /// 用于第二版模板生成 /// </summary> /// <param name="context"></param> private void BuildHTML2(HttpContext context) { string msg = ""; string sql = ""; int id = context.Request["id"].ToString() == "" ? 0 : int.Parse(context.Request["id"].ToString()); //projectId string thisClientFloorLevel = context.Request["floorLevel"].ToString(); if (id == 0 || string.IsNullOrEmpty(thisClientFloorLevel)) { msg = ""; } else { //第一步复制文件 *floorLevel 1,2,3,4当前的楼层 *f1,2,3,4 指左侧导航的标记 string sourcePath = context.Server.MapPath("../WebTemp2/"); string toPath = context.Server.MapPath("../release/" + id + "/f" + thisClientFloorLevel + "/"); if (Directory.Exists(toPath)) { Directory.Delete(toPath, true); } CopyDirectory(sourcePath, toPath); Dictionary <string, object> sqlparams = new Dictionary <string, object>(); sql = "select floorLevel from fv_floor where projectid=" + id + " order by floorLevel"; DataTable dt = SqlManage.Query(sql, sqlparams).Tables[0]; if (dt != null && dt.Rows.Count > 0) { //查找需要展示的信息 for floor.html 0 sql = "select a.id,a.fvUrl,a.areaPoints,a.floorLevel,a.brandDesc,a.brandName,a.telephone,a.address,a.isShow,a.brandLogo,a.qrCode,a.localvpath,a.sphone from fv_projectbrand a " + " where a.projectid=" + id + " ;"; //and a.floorLevel is not null //品类展示 1 sql += "select id,brandTypeName,brandTypeImg from fv_projectbrandtype where projectId=" + id + " and isShow =1 ;"; //品牌展示 2 sql += "select id,brandName,fvUrl,brandDesc,floorlevel,brandLogo,brandTypeId from fv_projectbrand where projectId=" + id + " order by brandOrder ;"; //取全景展示的品牌 3 sql += "select id,brandName,fvUrl,brandDesc,floorlevel,brandLogo,brandTypeId from fv_projectbrand where fvUrl<>'' and fvUrl is not null and floorLevel is not null and projectId=" + id + ";"; //取到品牌的路径 for f.html 4 sql += "select b.projectBrandId,b.walkWay,a.IsClient,a.floorLevel from fv_client a,fv_walkway b where a.id=b.fromClientId and a.projectId=" + id + "; "; //取C to lift 路径 for f.html 5 sql += "select a.floorLevel,a.nextPointName from fv_client a where a.isClient=1 and a.projectId=" + id; DataSet ds = SqlManage.Query(sql, sqlparams); DataTable dt2 = ds.Tables[0]; if (dt2 != null && dt2.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { string floorLevel = dt.Rows[i][0].ToString(); #region 处理floor页面 string oldFile = toPath + "floor.html"; string newFile = toPath + "floor" + floorLevel + ".html"; File.Copy(oldFile, newFile, true); string code = readFile(newFile); //替换楼层 code = code.Replace("*floorLevel", floorLevel); //替换左侧显示信息 for (int j = 1; j < 5; j++) { code = code.Replace("*f" + j, (j.ToString() == floorLevel ? j + "_2" : j + "_1")); } //替换全景路径 string areaString = ""; DataRow[] dr = dt2.Select("floorLevel=" + floorLevel); foreach (DataRow item in dr) { //fvString += string.Format("Arrayfv['{0}'] = '{1}';", item["id"].ToString(), item["fvUrl"].ToString()); //descString += string.Format("ArrayDesc['{0}'] = '{1}';", item["id"].ToString(), item["brandDesc"].ToString().Replace("*空格*", " ").Replace("*换行*", "<br/>")); //telephoneString += string.Format("ArrayTele['{0}'] = '{1}';", item["id"].ToString(), item["telephone"].ToString()); //addressString += string.Format("ArrayAddress['{0}'] = '{1}';", item["id"].ToString(), item["address"].ToString()); string areaCodes = item["areaPoints"].ToString().Replace("(", "").Replace(")", "").Replace(";", ",").Trim(); if (!string.IsNullOrEmpty(areaCodes)) { areaString += string.Format(" <area onclick='loadPanelDesc({0});showPanel();' shape='polygon' coords='{1}' alt='{2}' title='{2}'>" , item["id"].ToString(), areaCodes, item["brandName"].ToString()); } } DataRow[] drIsShow = dt2.Select("floorLevel=" + floorLevel + " and isShow=1"); string strIsShow = ""; for (int drIndex = 0; drIndex < 10; drIndex++) { if (drIndex % 2 == 0) { strIsShow += @"<tr>"; } if (drIndex >= drIsShow.Length) { strIsShow += @" <td height='110' align='center' valign='middle'></td>"; } else { string fTemp = drIsShow[drIndex]["brandLogo"].ToString(); int fIndex = fTemp.LastIndexOf('/'); string fName = fTemp.Substring(fIndex + 1); strIsShow += @" <td height='110' align='center' valign='middle'><img src='../images/" + fName + "' onclick='loadPanelDesc(" + drIsShow[drIndex]["id"].ToString() + ");showPanel();' width='116' height='93' /></td>"; } if (drIndex % 2 == 1) { strIsShow += @"</tr>"; } } //code = code.Replace("//*fvString", fvString); //code = code.Replace("//*descString", descString); //code = code.Replace("//*telephoneString", fvString); //code = code.Replace("//*addressString", descString); code = code.Replace("//*isShow", strIsShow); code = code.Replace("//*areaString", areaString); code = code.Replace("//*thisClientFloorLevel", thisClientFloorLevel); writeFile(newFile, code); #endregion #region 处理data.js页面 oldFile = toPath + "/js/data.js"; code = readFile(oldFile); //替换基础信息 string fvString = ""; string descString = ""; string telephoneString = ""; string addressString = ""; string brandLogo = ""; string brandQrCode = ""; string sendToPhone = ""; foreach (DataRow item in dt2.Rows) { fvString += string.Format("Arrayfv['{0}'] = '{1}';", item["id"].ToString(), item["localvpath"].ToString()); descString += string.Format("ArrayDesc['{0}'] = '{1}';", item["id"].ToString(), item["brandDesc"].ToString().Replace("*空格*", " ").Replace("*换行*", "<br/>")); telephoneString += string.Format("ArrayTele['{0}'] = '{1}';", item["id"].ToString(), item["telephone"].ToString()); addressString += string.Format("ArrayAddress['{0}'] = '{1}';", item["id"].ToString(), item["address"].ToString()); brandQrCode += string.Format("ArrayQrCode['{0}'] = '{1}';", item["id"].ToString(), item["qrCode"].ToString()); sendToPhone += string.Format("ArraySendToPhone['{0}'] = '{1}';", item["id"].ToString(), item["sPhone"].ToString()); //复制品牌图片文件 string fTemp = item["brandLogo"].ToString(); int fIndex = fTemp.LastIndexOf('/'); string fName = fTemp.Substring(fIndex + 1); brandLogo += string.Format("ArrayLogo['{0}'] = '{1}';", item["id"].ToString(), "../images/" + fName); } code = code.Replace("//*fvString", fvString); code = code.Replace("//*descString", descString); code = code.Replace("//*telephoneString", telephoneString); code = code.Replace("//*addressString", addressString); code = code.Replace("//*brandLogo", brandLogo); code = code.Replace("//*brandQrCode", brandQrCode); code = code.Replace("//*sendToPhone", sendToPhone); writeFile(oldFile, code); #endregion #region 处理f页面 string brandWalkway = ""; //*brandWalkway oldFile = toPath + "f.html"; newFile = toPath + "f" + floorLevel + ".html"; File.Copy(oldFile, newFile, true); code = readFile(newFile); DataTable dtF = ds.Tables[4]; if (dtF != null && dtF.Rows.Count > 0) { dr = dtF.Select("floorLevel=" + floorLevel); foreach (DataRow item in dr) { if (!string.IsNullOrEmpty(item["walkWay"].ToString().Trim())) { brandWalkway += string.Format("ArrayBrand['{0}'] = '{1}';", item["projectBrandId"].ToString() + "_" + item["IsClient"].ToString(), item["walkWay"].ToString()); } } } DataTable dtF2 = ds.Tables[5]; if (dtF2 != null && dtF2.Rows.Count > 0) { dr = dtF2.Select("floorLevel=" + floorLevel); if (dr.Length > 0) { brandWalkway += string.Format("ArrayBrand['CTOL'] = '{0}';", dr[0]["nextPointName"].ToString()); //nextPointName } } code = code.Replace("*floorLevel", floorLevel); code = code.Replace("//*brandWalkway", brandWalkway); writeFile(newFile, code); #endregion oldFile = toPath + "PhonePath.html"; code = readFile(oldFile); code = code.Replace("//*thisClientFloorLevel", thisClientFloorLevel); writeFile(oldFile, code); #region 处理brand.html页面 string strBrandType = ""; string strBrand = ""; string btIndex = ""; oldFile = toPath + "brand.html"; code = readFile(oldFile); DataTable dt3 = ds.Tables[1]; if (dt3 != null && dt3.Rows.Count > 0) { int rowCount = 10; //默认一行10列 int liCount = 3; int btTemp = dt3.Rows.Count % rowCount; int Count = btTemp == 0 ? dt3.Rows.Count / rowCount : (dt3.Rows.Count / rowCount) + 1; while (Count % liCount != 0) { Count++; } for (int j = 0; j < Count * rowCount; j++) { //if (j % (liCount * rowCount) == 0) //{ // if (j == 0) // { // btIndex += " <li class='current'><em>1</em></li>"; // } // else // { // btIndex += " <li><em>" + ((j / (liCount * rowCount)) + 1) + "</em></li>"; // } //} if (j % rowCount == 0) { if ((j / rowCount) % liCount == 0) { strBrandType += @"<table align='center' width='95%' border='0' cellspacing='0' cellpadding='0'>"; } strBrandType += @"<tr>"; } if (j >= dt3.Rows.Count) { strBrandType += string.Format(@" <td width='90' height='90' align='center' valign='middle'></td>"); } else { string fTemp = dt3.Rows[j]["brandTypeImg"].ToString(); int fIndex = fTemp.LastIndexOf('/'); string fName = fTemp.Substring(fIndex + 1); strBrandType += string.Format(@" <td width='90' height='90' align='center' valign='middle'><img src='{0}' width='100' height='45' onclick='showThis({1});' /></td>", "../images/" + fName, dt3.Rows[j]["id"].ToString()); } if (j % rowCount == rowCount - 1) { strBrandType += @"</tr>"; if ((j / rowCount) % liCount == liCount - 1) { strBrandType += @"</table>"; } } } } DataTable dt4 = ds.Tables[2]; if (dt4 != null && dt4.Rows.Count > 0) { for (int j = 0; j < dt4.Rows.Count; j++) { string fTemp = dt4.Rows[j]["brandLogo"].ToString(); int fIndex = fTemp.LastIndexOf('/'); string fName = fTemp.Substring(fIndex + 1); strBrand += string.Format(@"<div style='float:left' width='192' class='allType type{1}' height='192' align='center' valign='middle'><img src='{0}' onclick='loadPanelDescJump({2},{3});showPanel();' width='182' height='160' class='box-shadow' /></div>" , "../images/" + fName, dt4.Rows[j]["brandTypeId"].ToString(), dt4.Rows[j]["id"].ToString(), dt4.Rows[j]["floorLevel"].ToString()); } //int rowCount = 7; //默认一行10列 //int btTemp = dt4.Rows.Count % rowCount; //int Count = btTemp == 0 ? (dt4.Rows.Count / rowCount) : (dt4.Rows.Count / rowCount) + 1; //for (int j = 0; j < Count * rowCount; j++) //{ // if (j % rowCount == 0) // { // strBrand += @"<tr>"; // } // if (j >= dt4.Rows.Count) // { // strBrand += string.Format(@"<td width='192' height='192' align='center' valign='middle'></td>"); // } // else // { // string fTemp = dt4.Rows[j]["brandLogo"].ToString(); // int fIndex = fTemp.LastIndexOf('/'); // string fName = fTemp.Substring(fIndex + 1); // strBrand += string.Format(@"<td width='192' class='allType type{1}' height='192' align='center' valign='middle'><img src='{0}' onclick='loadPanelDesc({2});showPanel();' width='182' height='160' class='box-shadow' /></td>" // , "../images/" + fName, dt4.Rows[j]["brandTypeId"].ToString(), dt4.Rows[j]["id"].ToString()); // //复制品牌图片文件,此处复制的全 // string fOld = context.Server.MapPath(@"../brandTemplate/" + fName).Replace(@"\", "/"); // string fNew = context.Server.MapPath(@"../release/" + id + "/images/" + fName).Replace(@"\", "/"); // if (File.Exists(fOld)) // { // File.Copy(fOld, fNew, true); // } // } // if (j % rowCount == rowCount - 1) // { // strBrand += @"</tr>"; // } //} } code = code.Replace("*btIndex", btIndex); code = code.Replace("*floorLevel", floorLevel); code = code.Replace("//*brandType", strBrandType); code = code.Replace("//*brand", strBrand); code = code.Replace("//*thisClientFloorLevel", thisClientFloorLevel); writeFile(oldFile, code); #endregion #region 处理vr.html页面 string vrString = ""; //*brandWalkway oldFile = toPath + "vr.html"; code = readFile(oldFile); strBrandType = ""; strBrand = ""; dt3 = ds.Tables[1]; if (dt3 != null && dt3.Rows.Count > 0) { int rowCount = 4; //默认一行10列 int btTemp = dt3.Rows.Count % rowCount; int Count = btTemp == 0 ? dt3.Rows.Count / rowCount : (dt3.Rows.Count / rowCount) + 1; for (int j = 0; j < Count * rowCount; j++) { if (j % rowCount == 0) { strBrandType += @"<tr>"; } if (j >= dt3.Rows.Count) { strBrandType += string.Format(@" <td width='90' height='90' align='center' valign='middle'></td>"); } else { string fTemp = dt3.Rows[j]["brandTypeImg"].ToString(); int fIndex = fTemp.LastIndexOf('/'); string fName = fTemp.Substring(fIndex + 1); strBrandType += string.Format(@" <td width='90' height='90' align='center' valign='middle'><img src='{0}' width='100' height='45' onclick='showThis({1});' /></td>", "../images/" + fName, dt3.Rows[j]["id"].ToString()); } if (j % rowCount == rowCount - 1) { strBrandType += @"</tr>"; } } } DataTable dt5 = ds.Tables[3]; if (dt5 != null && dt5.Rows.Count > 0) { for (int j = 0; j < dt5.Rows.Count; j++) { string fTemp = dt5.Rows[j]["brandLogo"].ToString(); int fIndex = fTemp.LastIndexOf('/'); string fName = fTemp.Substring(fIndex + 1); strBrand += string.Format(@"<div style='float:left' width='192' class='allType type{1}' height='192' align='center' valign='middle'><img src='{0}' onclick='loadPanelDescJump({2},{3});showPanel();' width='182' height='160' class='box-shadow' /></div>" , "../images/" + fName, dt5.Rows[j]["brandTypeId"].ToString(), dt5.Rows[j]["id"].ToString(), dt5.Rows[j]["floorLevel"].ToString()); } //int rowCount = 5; //默认一行10列 //int btTemp = dt5.Rows.Count % rowCount; //int Count = btTemp == 0 ? (dt5.Rows.Count / rowCount) : (dt5.Rows.Count / rowCount) + 1; //for (int j = 0; j < Count * rowCount; j++) //{ // if (j % rowCount == 0) // { // strBrand += @"<tr>"; // } // if (j >= dt5.Rows.Count) // { // strBrand += string.Format(@"<td width='192' height='192' align='center' valign='middle'></td>"); // } // else // { // string fTemp = dt5.Rows[j]["brandLogo"].ToString(); // int fIndex = fTemp.LastIndexOf('/'); // string fName = fTemp.Substring(fIndex + 1); // strBrand += string.Format(@"<td width='192' class='allType type{1}' height='192' align='center' valign='middle'><img src='{0}' onclick='loadPanelDesc({2});showPanel();' width='182' height='160' class='box-shadow' /></td>" // , "../images/" + fName, dt5.Rows[j]["brandTypeId"].ToString(), dt5.Rows[j]["id"].ToString()); // } // if (j % rowCount == rowCount - 1) // { // strBrand += @"</tr>"; // } //} } code = code.Replace("*floorLevel", floorLevel); code = code.Replace("//*brandType", strBrandType); code = code.Replace("//*brand", strBrand); code = code.Replace("//*thisClientFloorLevel", thisClientFloorLevel); writeFile(oldFile, code); #endregion } } } if (true) { msg = "suc"; } else { msg = "数据库连接超时或出现未知错误"; } JavaScriptSerializer javascriptSerializer = new JavaScriptSerializer(); context.Response.Write(javascriptSerializer.Serialize(msg)); } }
private void BuildHTML(HttpContext context) { string msg = ""; string sql = ""; int id = context.Request["id"].ToString() == "" ? 0 : int.Parse(context.Request["id"].ToString()); //projectId string thisClientFloorLevel = context.Request["floorLevel"].ToString(); if (id == 0 || string.IsNullOrEmpty(thisClientFloorLevel)) { msg = ""; } else { //第一步复制文件 *floorLevel 1,2,3,4当前的楼层 *f1,2,3,4 指左侧导航的标记 string sourcePath = context.Server.MapPath("../WebTemp/"); string toPath = context.Server.MapPath("../release/" + id + "/f" + thisClientFloorLevel + "/"); CopyDirectory(sourcePath, toPath); Dictionary <string, object> sqlparams = new Dictionary <string, object>(); sql = "select floorLevel from fv_floor where projectid=" + id + " order by floorLevel"; DataTable dt = SqlManage.Query(sql, sqlparams).Tables[0]; if (dt != null && dt.Rows.Count > 0) { //查找需要展示的信息 for floor.html 0 sql = "select a.id,a.fvUrl,a.areaPoints,a.floorLevel,a.brandDesc,a.brandName from fv_projectbrand a " + " where a.projectid=" + id + " and a.floorLevel is not null;"; //品类展示 1 sql += "select id,brandTypeName from fv_projectbrandtype where projectId=" + id + " limit 24 ;"; //品牌展示 2 sql += "select id,brandName,fvUrl,brandDesc,floorlevel from fv_projectbrand where isShowWay=1 and projectId=" + id + " limit 12 ;"; //取全景展示的品牌 3 sql += "select id,brandName,fvUrl,brandDesc,floorlevel from fv_projectbrand where fvUrl<>'' and fvUrl is not null and floorLevel is not null and projectId=" + id + " limit 48 ;"; //取到品牌的路径 for f.html 4 sql += "select b.projectBrandId,b.walkWay,a.IsClient,a.floorLevel from fv_client a,fv_walkway b where a.id=b.fromClientId and a.projectId=" + id + "; "; //取C to lift 路径 for f.html 5 sql += "select a.floorLevel,a.nextPointName from fv_client a where a.isClient=1 and a.projectId=" + id; DataSet ds = SqlManage.Query(sql, sqlparams); DataTable dt2 = ds.Tables[0]; if (dt2 != null && dt2.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { string floorLevel = dt.Rows[i][0].ToString(); #region 处理floor页面 string oldFile = toPath + "floor.html"; string newFile = toPath + "floor" + floorLevel + ".html"; File.Copy(oldFile, newFile, true); string code = readFile(newFile); //替换楼层 code = code.Replace("*floorLevel", floorLevel); //替换左侧显示信息 for (int j = 1; j < 5; j++) { code = code.Replace("*f" + j, (j.ToString() == floorLevel ? "f" + j + "s" : "f" + j)); } //替换全景路径 string fvString = ""; string descString = ""; string areaString = ""; DataRow[] dr = dt2.Select("floorLevel=" + floorLevel); foreach (DataRow item in dr) { fvString += string.Format("Arrayfv['{0}'] = '{1}';", item["id"].ToString(), item["fvUrl"].ToString()); descString += string.Format("ArrayDesc['{0}'] = '{1}';", item["id"].ToString(), item["brandDesc"].ToString().Replace("*空格*", " ").Replace("*换行*", "<br/>")); string areaCodes = item["areaPoints"].ToString().Replace("(", "").Replace(")", "").Replace(";", ",").Trim(); if (!string.IsNullOrEmpty(areaCodes)) { areaString += string.Format(" <area onclick='loadPanelDesc({0});showPanel();' shape='polygon' coords='{1}' alt='{2}' title='{2}'>" , item["id"].ToString(), areaCodes, item["brandName"].ToString()); } } code = code.Replace("//*fvString", fvString); code = code.Replace("//*descString", descString); code = code.Replace("//*areaString", areaString); code = code.Replace("//*thisClientFloorLevel", thisClientFloorLevel); writeFile(newFile, code); #endregion #region 处理f页面 string brandWalkway = ""; //*brandWalkway oldFile = toPath + "f.html"; newFile = toPath + "f" + floorLevel + ".html"; File.Copy(oldFile, newFile, true); code = readFile(newFile); DataTable dtF = ds.Tables[4]; if (dtF != null && dtF.Rows.Count > 0) { dr = dtF.Select("floorLevel=" + floorLevel); foreach (DataRow item in dr) { if (!string.IsNullOrEmpty(item["walkWay"].ToString().Trim())) { brandWalkway += string.Format("ArrayBrand['{0}'] = '{1}';", item["projectBrandId"].ToString() + "_" + item["IsClient"].ToString(), item["walkWay"].ToString()); } } } DataTable dtF2 = ds.Tables[5]; if (dtF2 != null && dtF2.Rows.Count > 0) { dr = dtF2.Select("floorLevel=" + floorLevel); if (dr.Length > 0) { brandWalkway += string.Format("ArrayBrand['CTOL'] = '{0}';", dr[0]["nextPointName"].ToString()); //nextPointName } } code = code.Replace("*floorLevel", floorLevel); code = code.Replace("//*brandWalkway", brandWalkway); writeFile(newFile, code); #endregion oldFile = toPath + "PhonePath.html"; code = readFile(oldFile); code = code.Replace("//*thisClientFloorLevel", thisClientFloorLevel); writeFile(oldFile, code); #region 处理brand.html页面 string brandGuide1_6 = ""; string brandGuide7_12 = ""; string brandTypeGuide1_12 = ""; string brandTypeGuide13_24 = ""; //*brandWalkway oldFile = toPath + "brand.html"; code = readFile(oldFile); DataTable dt3 = ds.Tables[1]; if (dt3 != null && dt3.Rows.Count > 0) { if (dt3.Rows.Count < 12) { brandTypeGuide13_24 = "<div class='col-md-1'><a class='btn' href='#' role='button'> </a></div>"; //加内容占一行 } for (int k = 0; k < dt3.Rows.Count; k++) { if (k < 12) { brandTypeGuide1_12 += string.Format("<div class='col-md-1'><a class='btn btn-success' href='#' role='button'>{0}</a></div>", dt3.Rows[k]["brandTypeName"].ToString()); } else { brandTypeGuide13_24 += string.Format("<div class='col-md-1'><a class='btn btn-success' href='#' role='button'>{0}</a></div>", dt3.Rows[k]["brandTypeName"].ToString()); } } } DataTable dt4 = ds.Tables[2]; if (dt4 != null && dt4.Rows.Count > 0) { for (int k = 0; k < dt4.Rows.Count; k++) { if (k < 6) { brandGuide1_6 += string.Format("<div class='col-md-2'><img onclick=\"window.location='floor{1}.html?projectId={0}';\" style='width:190px;height:190px;' src='brandImg/logo{0}.jpg' alt='...' class='img-circle'></div>", dt4.Rows[k]["id"].ToString(), dt4.Rows[k]["floorlevel"].ToString()); } else { brandGuide7_12 += string.Format("<div class='col-md-2'><img onclick=\"window.location='floor{1}.html?projectId={0}';\" style='width:190px;height:190px;' src='brandImg/logo{0}.jpg' alt='...' class='img-circle'></div>", dt4.Rows[k]["id"].ToString(), dt4.Rows[k]["floorlevel"].ToString()); } } } code = code.Replace("//*brandGuide1_6", brandGuide1_6); code = code.Replace("//*brandGuide7_12", brandGuide7_12); code = code.Replace("//*brandTypeGuide1_12", brandTypeGuide1_12); code = code.Replace("//*brandTypeGuide13_24", brandTypeGuide13_24); writeFile(oldFile, code); #endregion #region 处理vr.html页面 string vrString = ""; //*brandWalkway oldFile = toPath + "vr.html"; code = readFile(oldFile); DataTable dt5 = ds.Tables[3]; if (dt5 != null && dt5.Rows.Count > 0) { for (int l = 0; l < dt5.Rows.Count; l++) { if (l % 6 == 0 && l > 0) { //空一行 vrString += "<div class='row'><div class='col-md-1'> </div><div class='col-md-1'> </div> <div class='col-md-1'> </div><div class='col-md-1'> </div><div class='col-md-1'> </div> <div class='col-md-1'> </div> <div class='col-md-1'> </div> <div class='col-md-1'> </div> <div class='col-md-1'> </div> <div class='col-md-1'> </div>div class='col-md-1'> </div> <div class='col-md-1'> </div> </div>"; } if (l % 6 == 0) { vrString += "<div class='row'>"; } vrString += string.Format("<div class='col-md-2'><img onclick=\"window.location='floor{1}.html?projectId={0}';\" style='width:190px;height:190px;' src='brandImg/logo{0}.jpg' alt='...' class='img-circle'></div>", dt5.Rows[l]["id"].ToString(), dt5.Rows[l]["floorlevel"].ToString()); if (l % 6 == 5 || l == dt5.Rows.Count - 1) { vrString += "</div>"; } } } code = code.Replace("//*vrString", vrString); writeFile(oldFile, code); #endregion } } } if (true) { msg = "suc"; } else { msg = "数据库连接超时或出现未知错误"; } JavaScriptSerializer javascriptSerializer = new JavaScriptSerializer(); context.Response.Write(javascriptSerializer.Serialize(msg)); } }