/// <summary> /// 添加表单控件 /// </summary> /// <param name="formid"></param> public void AddControl(int formid) { cBll.DeleteYyFormControl(formid); DropDownList ddlType; TextBox txtName; TextBox txtValue; CheckBox chkBT; TextBox txtSeq; Model.wx_yy_control control = new Model.wx_yy_control(); //系统内置控件的设置 AddSysControl(formid); for (int i = 1; i <= 9; i++) { control = new Model.wx_yy_control(); ddlType = this.FindControl("ddl" + i + "Type") as DropDownList; txtName = this.FindControl("txt" + i + "Name") as TextBox; txtValue = this.FindControl("txt" + i + "Value") as TextBox; txtSeq = this.FindControl("txt" + i + "Seq") as TextBox; chkBT = this.FindControl("chk" + i + "Btx") as CheckBox; if (txtName.Text.Trim() != "" && txtName.Text.Trim() != "") { control.cType = ddlType.SelectedItem.Value; control.cName = txtName.Text.Trim(); control.defaultValue = txtValue.Text.Trim(); control.isBiTian = chkBT.Checked; control.seq = MyCommFun.Str2Int(txtSeq.Text); control.formId = formid; cBll.Add(control); } } }
/// <summary> /// 设置系统内置的控件 /// </summary> /// <param name="formid"></param> private void AddSysControl(int formid) { Model.wx_yy_control control = new Model.wx_yy_control(); //1 手机号的设置 bool needTel = false; if (rblSMSTXType.SelectedValue == "1" || chkTelNeed.Checked) { needTel = true; } if (needTel) { control.cName = txtTelNeedName.Text.Trim(); control.cType = "0"; control.defaultValue = txtTelNeedValue.Text.Trim(); control.isBiTian = chkTelNeedBT.Checked; if (rblSMSTXType.SelectedValue == "1") { control.isBiTian = true; } control.seq = MyCommFun.Str2Int(txtTelNeedSortid.Text); control.formId = formid; control.isSys = true; control.sysControlerType = "tel"; cBll.Add(control); } //姓名 if (chkNameNeed.Checked) { control.cName = txtNameNeedName.Text.Trim(); control.cType = "0"; control.defaultValue = txtNameNeedValue.Text.Trim(); control.isBiTian = chkNameNeedBT.Checked; control.seq = MyCommFun.Str2Int(txtNameNeedSortid.Text); control.formId = formid; control.isSys = true; control.sysControlerType = "name"; cBll.Add(control); } //时间 if (chkDateNeed.Checked) { control.cName = txtDateNeedName.Text.Trim(); control.cType = "0"; control.defaultValue = txtDateNeedValue.Text.Trim(); control.isBiTian = chkDateNeedBT.Checked; control.seq = MyCommFun.Str2Int(txtDateNeedSortid.Text); control.formId = formid; control.isSys = true; control.sysControlerType = "date"; cBll.Add(control); } }
private void ShowInfo(int id) { hidid.Value = id.ToString(); Model.wx_yy_base yuyue = yyBll.GetModel(id); hidid.Value = yuyue.id.ToString(); txttitle.Text = yuyue.title.ToString(); txtaddr.Value = yuyue.addr; txtphone.Text = yuyue.phone; txtcontent.InnerText = yuyue.content; rblSMSTXType.SelectedValue = yuyue.needSMS == true?"1":"0"; rblPICType.SelectedValue = yuyue.needPIC == true ? "1" : "0"; //封面图片 if (yuyue.picUrl != null && yuyue.picUrl.Trim() != "" && yuyue.picUrl.Trim() != "/images/noneimg.jpg") { txtImgUrl.Text = yuyue.picUrl; imgfacePicPic.ImageUrl = yuyue.picUrl; } //绑定控件的值 //绑定奖项信息 IList <Model.wx_yy_control> itemlist = cBll.GetModelList("formId=" + id + " order by seq asc"); //系统内置控件 //1手机号 IList <Model.wx_yy_control> itemlist_sys_tel = (from c in itemlist where c.isSys == true && c.sysControlerType == "tel" select c).ToArray <Model.wx_yy_control>(); if (itemlist_sys_tel != null && itemlist_sys_tel.Count > 0) { chkTelNeed.Checked = true; txtTelNeedName.Text = itemlist_sys_tel[0].cName; txtTelNeedValue.Text = itemlist_sys_tel[0].defaultValue; chkTelNeedBT.Checked = itemlist_sys_tel[0].isBiTian; txtTelNeedSortid.Text = itemlist_sys_tel[0].seq.ToString(); } //2姓名 IList <Model.wx_yy_control> itemlist_sys_name = (from c in itemlist where c.isSys == true && c.sysControlerType == "name" select c).ToArray <Model.wx_yy_control>(); if (itemlist_sys_name != null && itemlist_sys_name.Count > 0) { chkNameNeed.Checked = true; txtNameNeedName.Text = itemlist_sys_name[0].cName; txtNameNeedValue.Text = itemlist_sys_name[0].defaultValue; chkNameNeedBT.Checked = itemlist_sys_name[0].isBiTian; txtNameNeedSortid.Text = itemlist_sys_name[0].seq.ToString(); } //1时间 IList <Model.wx_yy_control> itemlist_sys_date = (from c in itemlist where c.isSys == true && c.sysControlerType == "date" select c).ToArray <Model.wx_yy_control>(); if (itemlist_sys_date != null && itemlist_sys_date.Count > 0) { chkDateNeed.Checked = true; txtDateNeedName.Text = itemlist_sys_date[0].cName; txtDateNeedValue.Text = itemlist_sys_date[0].defaultValue; chkDateNeedBT.Checked = itemlist_sys_date[0].isBiTian; txtDateNeedSortid.Text = itemlist_sys_date[0].seq.ToString(); } //自定义控件 IList <Model.wx_yy_control> itemlist_zdy = (from c in itemlist where c.isSys != true select c).ToArray <Model.wx_yy_control>(); if (itemlist_zdy != null && itemlist_zdy.Count > 0) { int count = itemlist_zdy.Count; DropDownList ddlType; TextBox txtName; TextBox txtValue; CheckBox chkBT; TextBox txtSeq; Model.wx_yy_control itemEntity = new Model.wx_yy_control(); for (int i = 1; i <= count; i++) { itemEntity = itemlist_zdy[(i - 1)]; ddlType = this.FindControl("ddl" + i + "Type") as DropDownList; txtName = this.FindControl("txt" + i + "Name") as TextBox; txtValue = this.FindControl("txt" + i + "Value") as TextBox; txtSeq = this.FindControl("txt" + i + "Seq") as TextBox; chkBT = this.FindControl("chk" + i + "Btx") as CheckBox; ddlType.SelectedValue = itemEntity.cType; txtName.Text = itemEntity.cName; txtValue.Text = itemEntity.defaultValue; txtSeq.Text = MyCommFun.Obj2Int(itemEntity.seq).ToString(); chkBT.Checked = itemEntity.isBiTian; } } litwUrl.Text = MyCommFun.getWebSite() + "/weixin/yuyue/index.aspx?wid=" + yuyue.wid + "&id=" + id; }
private void ShowInfo(int id) { hidid.Value = id.ToString(); Model.wx_yy_base yuyue = yyBll.GetModel(id); hidid.Value = yuyue.id.ToString(); txttitle.Text = yuyue.title.ToString(); txtaddr.Value = yuyue.addr; txtphone.Text = yuyue.phone; txtcontent.InnerText = yuyue.content; rblSMSTXType.SelectedValue = yuyue.needSMS==true?"1":"0"; //封面图片 if (yuyue.picUrl != null && yuyue.picUrl.Trim()!="" && yuyue.picUrl.Trim() != "/images/noneimg.jpg") { txtImgUrl.Text = yuyue.picUrl; imgfacePicPic.ImageUrl = yuyue.picUrl; } //绑定控件的值 //绑定奖项信息 IList<Model.wx_yy_control> itemlist = cBll.GetModelList("formId=" + id + " order by seq asc"); //系统内置控件 //1手机号 IList<Model.wx_yy_control> itemlist_sys_tel = (from c in itemlist where c.isSys == true && c.sysControlerType == "tel" select c).ToArray<Model.wx_yy_control>(); if (itemlist_sys_tel != null && itemlist_sys_tel.Count > 0) { chkTelNeed.Checked = true; txtTelNeedName.Text = itemlist_sys_tel[0].cName; txtTelNeedValue.Text = itemlist_sys_tel[0].defaultValue; chkTelNeedBT.Checked = itemlist_sys_tel[0].isBiTian; txtTelNeedSortid.Text = itemlist_sys_tel[0].seq.ToString(); } //2姓名 IList<Model.wx_yy_control> itemlist_sys_name = (from c in itemlist where c.isSys == true && c.sysControlerType == "name" select c).ToArray<Model.wx_yy_control>(); if (itemlist_sys_name != null && itemlist_sys_name.Count > 0) { chkNameNeed.Checked = true; txtNameNeedName.Text = itemlist_sys_name[0].cName; txtNameNeedValue.Text = itemlist_sys_name[0].defaultValue; chkNameNeedBT.Checked = itemlist_sys_name[0].isBiTian; txtNameNeedSortid.Text = itemlist_sys_name[0].seq.ToString(); } //1时间 IList<Model.wx_yy_control> itemlist_sys_date = (from c in itemlist where c.isSys == true && c.sysControlerType == "date" select c).ToArray<Model.wx_yy_control>(); if (itemlist_sys_date != null && itemlist_sys_date.Count > 0) { chkDateNeed.Checked = true; txtDateNeedName.Text = itemlist_sys_date[0].cName; txtDateNeedValue.Text = itemlist_sys_date[0].defaultValue; chkDateNeedBT.Checked = itemlist_sys_date[0].isBiTian; txtDateNeedSortid.Text = itemlist_sys_date[0].seq.ToString(); } //自定义控件 IList<Model.wx_yy_control> itemlist_zdy = (from c in itemlist where c.isSys !=true select c).ToArray<Model.wx_yy_control>(); if (itemlist_zdy != null && itemlist_zdy.Count > 0) { int count = itemlist_zdy.Count; DropDownList ddlType; TextBox txtName; TextBox txtValue; CheckBox chkBT; TextBox txtSeq; Model.wx_yy_control itemEntity = new Model.wx_yy_control(); for (int i = 1; i <= count; i++) { itemEntity = itemlist_zdy[(i - 1)]; ddlType = this.FindControl("ddl" + i + "Type") as DropDownList; txtName = this.FindControl("txt" + i + "Name") as TextBox; txtValue = this.FindControl("txt" + i + "Value") as TextBox; txtSeq = this.FindControl("txt" + i + "Seq") as TextBox; chkBT = this.FindControl("chk" + i + "Btx") as CheckBox; ddlType.SelectedValue = itemEntity.cType; txtName.Text = itemEntity.cName; txtValue.Text = itemEntity.defaultValue; txtSeq.Text =MyCommFun.Obj2Int(itemEntity.seq).ToString(); chkBT.Checked = itemEntity.isBiTian; } } litwUrl.Text = MyCommFun.getWebSite() + "/weixin/yuyue/index.aspx?wid=" + yuyue.wid + "&id=" + id; }