private void BindShow() { GZS.BLL.EnvironmentTabBLL envtabbll = new GZS.BLL.EnvironmentTabBLL(); GZS.BLL.EnvironmentImgBLL envimgbll = new GZS.BLL.EnvironmentImgBLL(); GZS.Model.EnvironmentTabM d = envtabbll.GetModel(counts); txtzhongwen.Text = d.Chineseintroduced.Trim(); txtengilsh.Text = d.Englishintroduction.Trim(); List <GZS.Model.EnvironmentImgM> list = envimgbll.GetAllByEnvironmentTabId(counts); for (int i = 0; i < list.Count; i++) { str += list[i].imgpath.ToString().Trim() + "$"; mingche += list[i].imgexplain.ToString().Trim() + "$"; } BindShow(str, mingche); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ImageUrls = ""; counts = 0; ViewState["strSavePath"] = ""; ViewState["update"] = ""; str = ""; strddd = ""; mingche = ""; loginname = Request.QueryString["LoginName"].ToString(); EnvironmentTypeids = Convert.ToInt32(Request.QueryString["EnvironmentTypeid"].Trim()); GZS.BLL.EnvironmentTabBLL envtabbll = new GZS.BLL.EnvironmentTabBLL(); GZS.BLL.EnvironmentImgBLL envimgbll = new GZS.BLL.EnvironmentImgBLL(); GZS.Model.EnvironmentTabM envirtabm = envtabbll.EnvironmentlistByLoginNameandTypeid(loginname, EnvironmentTypeids); if (envirtabm != null) { counts = envirtabm.Environmentid; BindShow(); } } }
public int Insert(GZS.Model.EnvironmentTabM model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into EnvironmentTab("); strSql.Append("loginName,EnvironmentTypeid,Chineseintroduced,Englishintroduction,createtime,updatetime)"); strSql.Append(" values ("); strSql.Append("@loginName,@EnvironmentTypeid,@Chineseintroduced,@Englishintroduction,@createtime,@updatetime)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@loginName", SqlDbType.NVarChar, 200), new SqlParameter("@EnvironmentTypeid", SqlDbType.Int, 4), new SqlParameter("@Chineseintroduced", SqlDbType.Text), new SqlParameter("@Englishintroduction", SqlDbType.Text), new SqlParameter("@createtime", SqlDbType.DateTime), new SqlParameter("@updatetime", SqlDbType.DateTime) }; parameters[0].Value = model.loginName; parameters[1].Value = model.EnvironmentTypeid; parameters[2].Value = model.Chineseintroduced; parameters[3].Value = model.Englishintroduction; parameters[4].Value = model.Createtime; parameters[5].Value = model.Updatetime; object obj = DBHelper.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }
protected void btnSave_Click(object sender, EventArgs e) { GZS.BLL.EnvironmentTabBLL envtabbll = new GZS.BLL.EnvironmentTabBLL(); GZS.BLL.EnvironmentImgBLL envimgbll = new GZS.BLL.EnvironmentImgBLL(); if (txtzhongwen.Text.Trim() == "") { Response.Write("<script>alert('请输入中文描述!');</script>"); txtzhongwen.Focus(); return; } if (counts == 0) { GZS.Model.EnvironmentTabM environmentTabmodel = new GZS.Model.EnvironmentTabM(); environmentTabmodel.loginName = loginname; environmentTabmodel.EnvironmentTypeid = EnvironmentTypeids; environmentTabmodel.Chineseintroduced = txtzhongwen.Text.Trim(); environmentTabmodel.Englishintroduction = txtengilsh.Text.Trim(); environmentTabmodel.Createtime = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString().Trim(); environmentTabmodel.Updatetime = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString().Trim(); int re = envtabbll.CountByLoginNameandTypeid(environmentTabmodel.loginName.Trim(), EnvironmentTypeids); if (re > 0) { Response.Write("<script>alert('已经存在该类型的资料!');</script>"); return; } int reslut = envtabbll.Insert(environmentTabmodel); if (reslut != 0) { foreach (DataListItem item in DataList1.Items) { HiddenField fid1 = (HiddenField)item.FindControl("HiddenField1"); HiddenField fid2 = (HiddenField)item.FindControl("HiddenField2"); GZS.Model.EnvironmentImgM envimgmodel = new GZS.Model.EnvironmentImgM(); envimgmodel.Environmenttabid = reslut; envimgmodel.imgpath = fid1.Value.Trim(); envimgmodel.imgexplain = fid2.Value.Trim(); int res = envimgbll.Insert(envimgmodel); } int resa = envtabbll.StaticHtml(loginname); int ax = envtabbll.StaticHtmls(loginname); Response.Write("<script>alert('录入成功!');</script>"); } else { Response.Write("<script>alert('录入失败!');</script>"); } } else { GZS.Model.EnvironmentTabM environmentTabmodelS = envtabbll.GetModel(counts); GZS.Model.EnvironmentTabM environmentTabmodel = new GZS.Model.EnvironmentTabM(); environmentTabmodel.loginName = loginname; environmentTabmodel.EnvironmentTypeid = EnvironmentTypeids; environmentTabmodel.Chineseintroduced = txtzhongwen.Text.Trim(); environmentTabmodel.Englishintroduction = txtengilsh.Text.Trim(); environmentTabmodel.Createtime = environmentTabmodelS.Createtime.Trim(); environmentTabmodel.Environmentid = counts; environmentTabmodel.Updatetime = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString().Trim(); int s = envtabbll.Update(environmentTabmodel); if (ViewState["update"].Equals("true")) { envimgbll.Delete(counts); foreach (DataListItem item in DataList1.Items) { HiddenField fid1 = (HiddenField)item.FindControl("HiddenField1"); HiddenField fid2 = (HiddenField)item.FindControl("HiddenField2"); GZS.Model.EnvironmentImgM envimgmodel = new GZS.Model.EnvironmentImgM(); envimgmodel.Environmenttabid = counts; envimgmodel.imgpath = fid1.Value.Trim(); envimgmodel.imgexplain = fid2.Value.Trim(); int res = envimgbll.Insert(envimgmodel); } } int resa = envtabbll.StaticHtml(loginname); int ax = envtabbll.StaticHtmls(loginname); if (resa > 0) { Response.Write("<script>alert('修改成功!');location.href='EnvironmentManage.aspx';</script>"); } else { Response.Write("<script>alert('修改失败!');</script>"); } } }
public int Insert(GZS.Model.EnvironmentTabM model) { return(dal.Insert(model)); }
/// <summary> ///创建投资环境静态页面 /// </summary> public int StaticHtml(string loginname) { try { string ids = ""; string TempFileName = CasesTem.ToString(); string Tem = Compage.Reader(TempFileName); //读取模板内容 string TempSoure = Tem; GZS.DAL.EnvironmentTypeDAL typedal = new EnvironmentTypeDAL(); GZS.DAL.EnvironmentImgDAL Imgdal = new EnvironmentImgDAL(); List <GZS.Model.EnvironmentTypeM> list = typedal.GetAllType(); StringBuilder str = new StringBuilder(); for (int i = 0; i < list.Count; i++) { GZS.Model.EnvironmentTabM envtab = EnvironmentlistByLoginNameandTypeid(loginname, list[i].EnvironmentTypeID); string zhongwen = ""; string english = ""; string txt1 = ""; string txt2 = ""; string txt3 = ""; string txt4 = ""; string txts1 = ""; string txts2 = ""; string txts3 = ""; string txts4 = ""; if (envtab != null) { zhongwen = envtab.Chineseintroduced.Trim(); english = envtab.Englishintroduction.Trim(); List <GZS.Model.EnvironmentImgM> lists = Imgdal.GetAllByEnvironmentTabId(envtab.Environmentid); for (int t = 0; t < lists.Count; t++) { if (t == 0) { txt1 = lists[t].imgpath; txts1 = lists[t].imgexplain; } if (t == 1) { txt2 = lists[t].imgpath; txts2 = lists[t].imgexplain; } if (t == 2) { txt3 = lists[t].imgpath; txts3 = lists[t].imgexplain; } if (t == 3) { txt4 = lists[t].imgpath; txts4 = lists[t].imgexplain; } } } if (i == 0) { str.Append("<div id=\"gk_con_" + (10 + i) + "\" style =\"display:block\">"); ids += 10 + i + ","; } else { ids += 10 + i + ","; str.Append("<div id=\"gk_con_" + (10 + i) + "\" style =\"display:none\">"); } str.Append("<div class=\"envuroment-right1\">" + zhongwen + "</div>"); str.Append("<div class=\"envuroment-right1\">" + english + "</div>"); str.Append("<div class=\"envuroment-right2\">"); str.Append("<div class=\"industry-img-left001\"><ul>"); if (txt1.Trim() != "") { str.Append("<li class=\"l\">"); str.Append("<a href=\"http://dp.topfo.com/img/" + loginname + "/" + txt1 + "\" alt='点击查看大图' target=\"_blank\">"); str.Append("<img alt='点击查看大图' src=\"http://dp.topfo.com/img/" + loginname + "/" + txt1 + "\" />"); str.Append("<p style=\"text-align:center;\">" + txts1 + "</p>"); str.Append("</li>"); } else { //str.Append("<li class=\"l\">"); } if (txt2.Trim() != "") { str.Append("<li class=\"r\">"); str.Append("<a href=\"http://dp.topfo.com/img/" + loginname + "/" + txt2 + "\" alt='点击查看大图' target=\"_blank\">"); str.Append("<img src=\"http://dp.topfo.com/img/" + loginname + "/" + txt2 + "\" alt='点击查看大图'/>"); str.Append("<p style=\"text-align:center;\">" + txts2 + "</p>"); str.Append("</li>"); } else { // str.Append("<li class=\"r\">"); } str.Append("</ul>"); str.Append("</div></div>"); if (txt3.Trim() != "") { str.Append("<div class=\"envuroment-right3\"><div class=\"industry-img-left001\">"); str.Append("<a href=\"http://dp.topfo.com/img/" + loginname + "/" + txt3 + "\" alt='点击查看大图' target=\"_blank\">"); str.Append("<img src=\"http://dp.topfo.com/img/" + loginname + "/" + txt3 + "\" alt='点击查看大图'/>"); str.Append("<p style=\"text-align:center;\">" + txts3 + "</p>"); str.Append("</div>"); } else { //str.Append("<div class=\"envuroment-right3\">"); } if (txt4.Trim() != "") { str.Append("<div class=\"envuroment-right4\"><div class=\"industry-img-left001\">"); str.Append("<a href=\"http://dp.topfo.com/img/" + loginname + "/" + txt4 + "\" alt='点击查看大图' target=\"_blank\">"); str.Append("<img src=\"http://dp.topfo.com/img/" + loginname + "/" + txt4 + "\" />"); str.Append("<p style=\"text-align:center;\">" + txts4 + "</p>"); str.Append("</div>"); } else { //str.Append("<div class=\"envuroment-right4\">"); } //str.Append("</div></div>"); str.Append("</div>"); } TempSoure = TempSoure.Replace("$contex$", str.ToString()); TempSoure = TempSoure.Replace("$loginName$", loginname.Trim()); TempSoure = TempSoure.Replace("$styles$", types(ids)); CompanyShow com = new CompanyShow(); TempSoure = TempSoure.Replace("$CompanyName$", com.GetCompanyNameByLoginName(loginname)); string wenjian = MerchantTmpPathTo + loginname + "/"; if (Directory.Exists(wenjian) == false) { Directory.CreateDirectory(wenjian); } string htmlpaths = MerchantTmpPathTo + loginname + "/" + "Investmentenvironment.htm"; Compage.Writer(htmlpaths, TempSoure); return(1); } catch (Exception e) { return(0); } }