Files
ayanova7/source/MBI/memoto.aspx.cs
2018-06-29 19:47:36 +00:00

111 lines
2.7 KiB
C#

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using GZTW.AyaNova.BLL;
namespace AyaNovaMBI
{
public partial class memoto : System.Web.UI.Page
{
#region BizObject
public DataTable mdtTo;
protected DataTable dtTo
{
get
{
if (mdtTo != null) return mdtTo;
mdtTo = (DataTable)Session["memoto"];
if (mdtTo == null)
throw new ApplicationException("MemoToChooser - Userlist DataTable not found in session");
return mdtTo;
}
}
#endregion
protected void Page_Load(object sender, EventArgs e)
{
SetData();
}
private void SetData()
{
System.Text.StringBuilder s = new System.Text.StringBuilder();
int n = 0;
s.Append("<select name=\"selto\" multiple=\"multiple\">");
foreach (DataRow dr in dtTo.Rows)
{
s.Append("<option value=\"");
s.Append(n.ToString());
s.Append("\"");
if (((bool)dr["SELECTED"]))
s.Append(" selected=\"selected\"");
//s.Append("/>");
s.Append(">");
s.Append(dr["RECIPIENT"].ToString());
s.Append("</option>");
n++;
}
s.Append("</select>");
lit.Text = s.ToString();
}
private void GetData()
{
foreach (DataRow dr in dtTo.Rows)
{
dr["SELECTED"] = false;
}
string sraw = Request.Form.Get("selto");
if (util.mt(sraw))//nothing selected
return;
string[] arselected = sraw.Split(',');
int n = 0;
foreach (string s in arselected)
{
n = int.Parse(s);
dtTo.Rows[n]["SELECTED"] = true;
}
}
protected void btnOK_Click(object sender, EventArgs e)
{
GetData();
Response.Redirect("memoedit.aspx");
}
protected void btnCancel_Click(object sender, EventArgs e)
{
Response.Redirect("memoedit.aspx");
}
//-----------------------------------------------
}
}