/// <summary> /// 绑定模版列表 /// </summary> void BindRepList() { StringBuilder strWhere = new StringBuilder(); strWhere.Append("1=1"); if (!string.IsNullOrEmpty(Request.Params["type"])) { if (!string.Equals(Request.Params["type"], "0")) { strWhere.Append(" and TypeId=" + Request.Params["type"]); } strUrl.Append("&type=" + Request.Params["type"]); ddltype.SelectedValue = Request.Params["type"]; } if (!string.IsNullOrEmpty(Request.Params["keytype"])) { if (!string.Equals(Request.Params["keytype"], "0")) { if (!string.IsNullOrEmpty(Request.Params["key"])) { switch (Request.Params["keytype"]) { case "1": strWhere.Append(" and Num='" + Request.Params["key"] + "'"); break; case "2": strWhere.Append(" and Title like '%" + Request.Params["key"] + "%'"); break; case "3": strWhere.Append(" and StrKey like '%" + Request.Params["key"] + "%'"); break; } } } ddlKey.SelectedValue = Request.Params["keytype"]; txtKey.Text = Request.Params["key"]; strUrl.Append("&keytype=" + Request.Params["keytype"] + "&key=" + Request.Params["key"]); } if (!int.TryParse(Request.Params["page"], out page)) { page = 0; } pcount = bll.GetList(strWhere.ToString()).Tables[0].Rows.Count; repList.DataSource = bll.GetPageList(pagesize, page, strWhere.ToString(), "SortNum desc, Num desc,Id desc"); repList.DataBind(); }
/// <summary> /// 设置模版编号 /// </summary> /// <returns></returns> public string SetNumId(string type) { DataSet ds = bll.GetList(0, "Num like '%" + type + "%'", "Num desc"); if (ds.Tables[0].Rows.Count > 0) { int num = int.Parse(ds.Tables[0].Rows[0]["Num"].ToString().Replace(type, string.Empty)); return(type + (num + 1).ToString().PadLeft(8, '0')); } else { return(type + 1.ToString().PadLeft(8, '0')); } }
/// <summary> /// 绑定设计模版 /// </summary> void BindTemplate() { string cid; if (string.IsNullOrWhiteSpace(Request.Params["type"])) { cid = dsTemplateType.Tables[0].Rows[0]["Id"].ToString(); } else { cid = Request.Params["type"]; } DataSet ds = bllTemplate.GetList(16, "StateInfo=1 and TypeId=" + cid, "Addtime desc"); repTemplate.DataSource = ds; repTemplate.DataBind(); }
public static string TemplateTypeChange(string cid) { StringBuilder strHtml = new StringBuilder(); strHtml.Append("<option value=\"\">请选择设计模版</option>"); if (!string.IsNullOrWhiteSpace(cid)) { Leadin.BLL.DesignTemplate bllTemplateChange = new Leadin.BLL.DesignTemplate(); DataSet ds = bllTemplateChange.GetList("TypeId=" + cid + " and StateInfo=1"); foreach (DataRow item in ds.Tables[0].Rows) { strHtml.Append("<option value=\"" + item["Id"].ToString() + "\">" + item["Title"].ToString() + "</option>"); } } return(strHtml.ToString()); }
/// <summary> /// 绑定首页模版详细信息 /// </summary> /// <param name="id"></param> void BindDetail(int id) { Leadin.Model.IndexTemplate model = bllIndex.GetModel(id); DataSet ds = bllTemplate.GetList("TypeId=" + model.ClassId + " and StateInfo=1"); foreach (DataRow item in ds.Tables[0].Rows) { ddlTemplate.Items.Add(new ListItem(item["Title"].ToString(), item["Id"].ToString())); } ddlIndexType.SelectedValue = model.TypeId.ToString(); ddlTemplate.SelectedValue = model.TemplateId.ToString(); ddlTemplateType.SelectedValue = model.ClassId.ToString(); txtfileico1.Text = model.ImgUrl; txtSortNum.Text = model.SortNum.ToString(); txtTitle.Text = model.Title; ckState.Checked = model.StateInfo == 1 ? true : false; }