弹窗备注,一个公共的备注界面
界面上
<td align="center" ><table width="100%" cellpadding="0" cellspacing="0" border="0" class="ttable_border_none"><tr><td align="center"><%# DataBinder.Eval(Container.DataItem, "Remark")%></td> <td width="16px"><a href="javascript:return false;" title="备注" onclick="javascript:WebDialogLoad('备注',600,400, '../../qdAdmin/qdRemark/Remark_Txt_Win.aspx?pwidth=580&pheight=280&rows=10&tbname=tbWaiXie_BomList_PeiLiao&keyname=WxPeiLiaoGuid&keyvalue=<%# DataBinder.Eval(Container.DataItem,"WxPeiLiaoGuid") %>&edit=upt&btn=btnSearch&title=备注')" > <img src="../../qdadmin/qdimages/zhushi_hui.png" border="0" title="备注"></a></td></tr></table></td><%--备注--%>
备注界面根据传送过来的表名主键名以及主键值,来确定是哪一条数据,进行修改该条数据的备注操作
using System; using System.Collections; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; using System.Text; using System.Collections.Generic; using ITEM.Inherits.Bll; using ITEM.Inherits.Bll.qdMis4; using ITEM.Inherits.Bll.qdCnt4; using ITEM.Model; using ITEM.Model.qdMis4; using ITEM.Model.qdCnt4; public partial class Remark_Txt_Win : PageBase { private XUserLogin.UserLoginBySystem _XUserLogin = new XUserLogin.UserLoginBySystem(); private ITEM.Inherits.Bll.qdCnt4.bllFourCollsType _bllTypeColls = new ITEM.Inherits.Bll.qdCnt4.bllFourCollsType(); //private ITEM.Inherits.Bll.qdMis4.bllAProgramSet _bllRemark = new bllAProgramSet(); private ITEM.Inherits.Bll.qdMis4.bllAProgramSet _bllSet = new bllAProgramSet();//默认Mis4 private ITEM.Inherits.Bll.qdLog4.bllFourLogSystem _bllLog = new ITEM.Inherits.Bll.qdLog4.bllFourLogSystem(); private ITEM.Inherits.Bll.qdCnt4.bllFourAdminUser _bllCnt = new bllFourAdminUser(); /* *开发注意事项: */ protected void Page_Load(object sender, EventArgs e) { {//回调初始化 //this.tbClientName.Text = HiddenFieldClientName.Value; } if (!IsPostBack) { this.Panel1.Width = Unit.Pixel(Convert.ToInt32(_PanelWidth)); this.Panel1.Height = Unit.Pixel(Convert.ToInt32(_PanelHeight)); this.tbRemark.Width = Unit.Pixel((Convert.ToInt32(_PanelWidth)-30)); this.tbRemark.Rows = iRows; //this.LiteralRemark.Text = _Title; DataLoad(); } this.WebMessageBox1.SetMessageClear(); } #region Request public string _dbsort { get { if (Request["dbsort"] == null) return "mis"; else return Request["dbsort"].ToString(); } } public string _Title { get { if (Request["title"] == null) return "备注"; else return Request["title"].ToString(); } } /// <summary> /// 增加或修改的标志(add,upt,del,show),参数值由上一个页面传入 /// </summary> public string _Edit { get { if (Request["edit"] == null) return "upt"; else return Request["edit"].ToString(); } } public string _PanelWidth { get { return Request["pwidth"].ToString(); } } public string _PanelHeight { get { return Request["pheight"].ToString(); } } /// <summary> /// 修改删除时获取关键字 /// </summary> private string keyValue { get { if (Request["keyvalue"] == null) return ""; else return Request["keyvalue"].ToString(); } } private string keyName { get { if (Request["keyname"] == null) return ""; else return Request["keyname"].ToString(); } } private string tbName { get { if (Request["tbname"] == null) return ""; else return Request["tbname"].ToString(); } } private int iRows { get { if (Request["rows"] == null) return 10; else return Convert.ToInt32(Request["rows"].ToString()); } } /// <summary> /// 父页面控件1 /// </summary> private string _ctrl1 { get { if (Request["c1"] == null) return string.Empty; else return Request["c1"].ToString(); } } /// <summary> /// 父页面控件2 /// </summary> private string _ctrl2 { get { if (Request["c2"] == null) return string.Empty; else return Request["c2"].ToString(); } } /// <summary> /// 父页面控件3 /// </summary> private string _ctrl3 { get { if (Request["c3"] == null) return string.Empty; else return Request["c3"].ToString(); } } /// <summary> /// 父页面控件4 /// </summary> private string _ctrl4 { get { if (Request["c4"] == null) return string.Empty; else return Request["c4"].ToString(); } } /// <summary> /// 父页面控件5 /// </summary> private string _ctrl5 { get { if (Request["c5"] == null) return string.Empty; else return Request["c5"].ToString(); } } /// <summary> /// 父页面单击刷新按钮 /// </summary> private string _buttonClick { get { if (Request["btn"] == null) return string.Empty; else return Request["btn"].ToString(); } } /// <summary> /// Flag逻辑分隔标志 /// </summary> private int _iFlag { get { return Convert.ToInt32(Request["flag"]); } } private string _sType { get { if (Request["type"] == null) return string.Empty; else return Request["type"].ToString(); } } #endregion #region DataLoad private void DataLoad() { if (_Edit == "add") { Exception ex = new Exception("add error"); throw (ex); } else if (_Edit == "upt" || _Edit == "show") { #region upt & show object obj; if (_dbsort == "cnt") obj = _bllCnt.GetScalarByTx("select remark from " + tbName + " where " + keyName + "='" + keyValue + "' and QiyeGuid='" + base.EnterpriseGuid + "'"); else if (_dbsort == "log") obj = _bllLog.GetScalarByTx("select remark from " + tbName + " where " + keyName + "='" + keyValue + "' and QiyeGuid='" + base.EnterpriseGuid + "'"); else obj = _bllSet.GetScalarByTx("select remark from " + tbName + " where " + keyName + "='" + keyValue + "' and QiyeGuid='" + base.EnterpriseGuid + "'"); if (obj != DBNull.Value) { if (_sType == "html") this.tbRemark.Text = base.ConventTextToHtml_br(obj.ToString()); else if (_sType == "txt") this.tbRemark.Text = base.ConventHtmlToText(obj.ToString()); else this.tbRemark.Text = obj.ToString(); } #endregion } if (_Edit == "show") { #region show btnAddUpt.Enabled = false; this.tbRemark.ReadOnly = true; this.tbRemark.Attributes.Add("style", "color:#888888;");//备注 #endregion } } #endregion #region Add & Upt protected void btnAddUpt_Click(object sender, EventArgs e) { int k = 0; if (_dbsort == "cnt") k = _bllCnt.SetExByTx("update " + tbName + " set Remark='" + this.tbRemark.Text + "' where " + keyName + "='" + keyValue + "' and QiyeGuid='" + base.EnterpriseGuid + "'", _XUserLogin.UserLoginGuid, _XUserLogin.UserLoginID, _XUserLogin.UserIP); else if (_dbsort == "log") k = _bllLog.SetExByTx("update " + tbName + " set Remark='" + this.tbRemark.Text + "' where " + keyName + "='" + keyValue + "' and QiyeGuid='" + base.EnterpriseGuid + "'", _XUserLogin.UserLoginGuid, _XUserLogin.UserLoginID, _XUserLogin.UserIP); else k = _bllSet.SetExByTx("update " + tbName + " set Remark='" + this.tbRemark.Text + "' where " + keyName + "='" + keyValue + "' and QiyeGuid='" + base.EnterpriseGuid + "'", _XUserLogin.UserLoginGuid, _XUserLogin.UserLoginID, _XUserLogin.UserIP); if (k >= 1) { //this.LabelMsg.Text = "数据保存成功"; WebMessageBox1.MessageBox_tishi(700, 300, 200, 300, "数据保存成功"); string script = string.Empty; script += "<script language=javascript>"; if (_buttonClick == string.Empty) { script += base.GetSrcriptContentByClick("btnSearch"); } else { script += base.GetSrcriptContentByClick(_buttonClick); } script += "parent.WebPopupCancel();</script>"; ClientScript.RegisterClientScriptBlock(this.GetType(), "WebPopupCancel", script); } else { //this.LabelMsg.Text = "数据保存失败"; WebMessageBox1.MessageBox_tishi(700, 300, 200, 300, "数据保存失败"); } } #endregion protected void btnExit_Click(object sender, EventArgs e) { //string script = string.Empty; //script += "<script language=javascript>"; //script += base.GetSrcriptContentByClick("btnSearch"); //script += "parent.WebPopupCancel();</script>"; //ClientScript.RegisterClientScriptBlock(this.GetType(), "WebPopupCancel", script); ClientScript.RegisterClientScriptBlock(this.GetType(), "WebPopupCancel", "<script language=javascript>parent.WebPopupCancel();</script>"); } }