using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Drawing; using System.Web; using System.Web.SessionState; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; using System.Data.OleDb; using System.IO; using System.Globalization; namespace Reservation { /// /// Users form. /// Methods created or modified: ///

Copyright (c) 2002 Alexis Grandemange
/// Mail: alexis.grandemange@pagebox.net

///
This program is free software; you can redistribute it and/or
	/// modify it under the terms of the GNU Lesser General Public
	/// License as published by the Free Software Foundation; version
	/// 2.1 of the License.
	/// This library is distributed in the hope that it will be useful,
	/// but WITHOUT ANY WARRANTY; without even the implied warranty of
	/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
	/// GNU Lesser General Public License for more details.
	/// A copy of the GNU Lesser General Public License lesser.txt should be
	/// included in the distribution.
///
public class Users : System.Web.UI.Page { protected System.Web.UI.WebControls.TextBox tbId; protected System.Web.UI.WebControls.TextBox tbName; protected System.Web.UI.WebControls.TextBox tbInfo; protected System.Web.UI.WebControls.Button btnUpdate; protected System.Web.UI.WebControls.TextBox tbMail; protected System.Web.UI.WebControls.Label lblStatus; protected System.Web.UI.WebControls.CheckBox tbType; protected System.Web.UI.WebControls.TextBox tbPasswordV; protected System.Web.UI.WebControls.TextBox tbPassword; protected System.Web.UI.WebControls.DataGrid dgUsers; protected System.Web.UI.WebControls.TextBox tbAddress; protected System.Web.UI.WebControls.TextBox tbCity; protected System.Web.UI.WebControls.TextBox tbZip; protected System.Web.UI.WebControls.TextBox tbRegion; protected System.Web.UI.WebControls.TextBox tbLatitude; protected System.Web.UI.WebControls.TextBox tbLongitude; protected System.Web.UI.WebControls.HyperLink hlCheck; protected System.Web.UI.WebControls.Button btnRefresh; protected System.Web.UI.WebControls.DropDownList ddState; protected System.Web.UI.WebControls.DropDownList ddCountry; /// /// Id of the logged user /// private string userid; public Users() { Page.Init += new System.EventHandler(Page_Init); } /// /// Checks credentials. /// Populates the form from the Reservation configuration. /// Calls bind. /// /// /// private void Page_Load(object sender, System.EventArgs e) { userid = (string)Context.Session["userid"]; if (userid == null) { Context.Session.Add("from", "Users.aspx"); Context.Response.Redirect("Login.aspx"); return; } short type = (short)Context.Session["type"]; if (type < 2) { Context.Session.Add("status", "Log-in with a employee user id"); Context.Session.Add("from", "Users.aspx"); Context.Response.Redirect("Login.aspx"); return; } if (!IsPostBack) { string deleteLog = Request.QueryString["deleteLog"]; if ((deleteLog != null) && (deleteLog.Length != 0)) { File.Delete(Global.path + "\\user_delete.html"); } tbAddress.Text = Global.address; tbCity.Text = Global.city; ddState.DataSource = Global.stateAl; ddState.DataBind(); ddState.SelectedIndex = Global.stateIndex; tbZip.Text = Global.zipcode; ddCountry.DataSource = Global.countryAl; ddCountry.DataBind(); ddCountry.SelectedIndex = Global.countryIndex; tbRegion.Text = Global.region; tbLatitude.Text = Global.latitude; tbLongitude.Text = Global.longitude; OleDbConnection odc = new OleDbConnection(Global.connectionString); odc.Open(); bind(odc); odc.Close(); } } /// /// Populates the datagrid from the users table. /// /// Database connection private void bind(OleDbConnection odc) { OleDbCommand odcmd = new OleDbCommand( "select id, type, name, mail from users where deltime=0", odc); OleDbDataReader odr = odcmd.ExecuteReader(); ArrayList al = new ArrayList(); while (odr.Read()) { string id = (string)odr["id"]; short type = (short)odr["type"]; string name = (string)odr["name"]; string mail = (string)odr["mail"]; UserEntry ue = new UserEntry(id, type, name, mail); al.Add(ue); } odr.Close(); dgUsers.DataSource = al; dgUsers.DataBind(); checkLog_bind(); } private void Page_Init(object sender, EventArgs e) { // // CODEGEN: This call is required by the ASP.NET Web Form Designer. // InitializeComponent(); } #region Web Form Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.dgUsers.ItemCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.dgUser_delete); this.tbType.CheckedChanged += new System.EventHandler(this.OnCheckedChanged); this.btnUpdate.Click += new System.EventHandler(this.OnUpdate); this.btnRefresh.Click += new System.EventHandler(this.OnRefresh); this.Load += new System.EventHandler(this.Page_Load); } #endregion /// /// Event triggered when the user clicks on the Update button. /// Updates the users database. /// private void OnUpdate(object sender, System.EventArgs e) { if (tbId.Text.Length == 0) { lblStatus.Text = "You must set the ID field"; return; } if ((tbPassword.Text.Length == 0) || (tbPasswordV.Text.Length == 0)) { lblStatus.Text = "You must set the Password field"; return; } if (!tbPassword.Text.Equals(tbPasswordV.Text)) { lblStatus.Text = "Re-enter the password"; return; } if (tbName.Text.Length == 0) { lblStatus.Text = "You must set the Name field"; return; } if (tbMail.Text.Length == 0) { lblStatus.Text = "You must set the Mail field"; return; } string st = ddState.SelectedItem.Value; string state = ""; if (!st.Equals("N/A")) { if (Global.states.Contains(st)) state = (string)Global.states[st]; else state = (string)Global.provinces[st]; } string c = ddCountry.SelectedItem.Value; string country = (string)Global.countries[c]; OleDbConnection odc = new OleDbConnection(Global.connectionString); odc.Open(); OleDbCommand odcmd = new OleDbCommand("select type from users where id='" + tbId.Text.PadRight(10, ' ') + "'", odc); OleDbDataReader odr = odcmd.ExecuteReader(); short type = 2; if (odr.Read()) { type = (short)odr["type"]; odr.Close(); switch (type) { case 0: lblStatus.Text = "You cannot update a customer account"; break; case 1: if (!tbType.Checked) { lblStatus.Text = "You cannot change the account type"; break; } odcmd.CommandText = "update users set password='" + tbPassword.Text + "', name='" + tbName.Text + "', mail='" + tbMail.Text + "', address='" + tbAddress.Text + "', city='" + tbCity.Text + "', state='" + state + "', zip='" + tbZip.Text + "', country='" + country + "', region='" + tbRegion.Text + "', latitude='" + tbLatitude.Text + "', longitude='" + tbLongitude.Text + "' where id='" + tbId.Text.PadRight(10, ' ') + "'"; odcmd.ExecuteNonQuery(); lblStatus.Text = tbId.Text + " updated"; break; default: if (tbType.Checked) { lblStatus.Text = "You cannot change the account type"; break; } odcmd.Transaction = odc.BeginTransaction(); odcmd.CommandText = "update users set password='" + tbPassword.Text + "', name='" + tbName.Text + "', mail='" + tbMail.Text + "', address='" + tbAddress.Text + "', city='" + tbCity.Text + "', state='" + state + "', zip='" + tbZip.Text + "', country='" + country + "', region='" + tbRegion.Text + "', latitude='" + tbLatitude.Text + "', longitude='" + tbLongitude.Text + "' where id='" + tbId.Text.PadRight(10, ' ') + "'"; odcmd.ExecuteNonQuery(); odcmd.CommandText = "update resources_info set info='" + tbInfo.Text + "' where id='" + tbId.Text.PadRight(10, ' ') + "'"; odcmd.ExecuteNonQuery(); lblStatus.Text = tbId.Text + " updated"; odcmd.Transaction.Commit(); break; } } else { odr.Close(); if (tbType.Checked) { type = 1; odcmd.CommandText = "insert into users (id, password, type, name, mail, deltime," + "address, city, state, zip, country, region, latitude, longitude) values ('" + tbId.Text + "', '" + tbPassword.Text + "', 1, '" + tbName.Text + "', '" + tbMail.Text + "', 0, '" + tbAddress.Text + "', '" + tbCity.Text + "', '" + state + "', '" + tbZip.Text + "', '" + country + "', '" + tbRegion.Text + "', '" + tbLatitude.Text + "', '" + tbLongitude.Text + "')"; odcmd.ExecuteNonQuery(); } else { type = 2; odcmd.Transaction = odc.BeginTransaction(IsolationLevel.ReadCommitted); odcmd.CommandText = "insert into users (id, password, type, name, mail, deltime," + "address, city, state, zip, country, region, latitude, longitude) values ('" + tbId.Text + "', '" + tbPassword.Text + "', 2, '" + tbName.Text + "', '" + tbMail.Text + "', 0, '" + tbAddress.Text + "', '" + tbCity.Text + "', '" + state + "', '" + tbZip.Text + "', '" + country + "', '" + tbRegion.Text + "', '" + tbLatitude.Text + "', '" + tbLongitude.Text + "')"; odcmd.ExecuteNonQuery(); odcmd.CommandText = "insert into resources_info (id, info) values ('" + tbId.Text + "', '" + tbInfo.Text + "')"; odcmd.ExecuteNonQuery(); odcmd.Transaction.Commit(); } lblStatus.Text = tbId.Text + " added"; } object uu = Context.Session["UserUpdate"]; if (uu == null) { tbType.Enabled = true; tbId.Enabled = true; } else { tbType.Enabled = false; tbId.Enabled = false; } switch(type) { case 0: case 1: tbInfo.Enabled = false; tbType.Checked = true; break; case 2: tbInfo.Enabled = true; tbType.Checked = false; break; } bind(odc); odc.Close(); } /// /// Triggered when the user clicks on a sel or del button. /// If it clicked on sel, populates the form. /// If if clicked on del, invalidate the account and removes the resource. /// private void dgUser_delete(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { int sel = e.Item.ItemIndex; if (sel != -1) { string id = (string)dgUsers.DataKeys[sel]; OleDbConnection odc = new OleDbConnection(Global.connectionString); odc.Open(); Button b = (Button)e.CommandSource; if (b.CommandName.Equals("delete")) { DateTime dt = DateTime.Today; OleDbTransaction odt = odc.BeginTransaction(); OleDbCommand odcmd = new OleDbCommand("select type from users where id='" + id.PadRight(10, ' ') + "' and deltime=0", odc, odt); OleDbDataReader odr = odcmd.ExecuteReader(); if (odr.Read()) { short type = (short)odr["type"]; odr.Close(); if (type > 1) { lock(this) { if (!checkLog_init(id)) { odt.Rollback(); odc.Close(); return; } odcmd.CommandText = "select * from resources where id='" + id.PadRight(10, ' ') + "' and time >= " + dt.ToFileTime(); odr = odcmd.ExecuteReader(); OleDbCommand odcmd2 = new OleDbCommand(); OleDbConnection odc2 = new OleDbConnection(Global.connectionString); odc2.Open(); odcmd2.Connection = odc2; odcmd2.Transaction = odt; OleDbDataReader odr2; int h800 = 0; int h830 = 0; int h900 = 0; int h930 = 0; int h1000 = 0; int h1030 = 0; int h1100 = 0; int h1130 = 0; int h1200 = 0; int h1230 = 0; int h1300 = 0; int h1330 = 0; int h1400 = 0; int h1430 = 0; int h1500 = 0; int h1530 = 0; int h1600 = 0; int h1630 = 0; int h1700 = 0; int h1730 = 0; int h1800 = 0; int h1830 = 0; while(odr.Read()) { decimal ticks = (decimal)odr["time"]; odcmd2.CommandText = "select * from resources where id='total ' and time=" + ticks; odr2 = odcmd2.ExecuteReader(); if (odr2.Read()) { h800 = (short)odr2["h800"] - (short)odr["h800"]; h830 = (short)odr2["h830"] - (short)odr["h830"]; h900 = (short)odr2["h900"] - (short)odr["h900"]; h930 = (short)odr2["h930"] - (short)odr["h930"]; h1000 = (short)odr2["h1100"] - (short)odr["h1100"]; h1030 = (short)odr2["h1030"] - (short)odr["h1030"]; h1100 = (short)odr2["h1100"] - (short)odr["h1100"]; h1130 = (short)odr2["h1130"] - (short)odr["h1130"]; h1200 = (short)odr2["h1200"] - (short)odr["h1200"]; h1230 = (short)odr2["h1230"] - (short)odr["h1230"]; h1300 = (short)odr2["h1300"] - (short)odr["h1300"]; h1330 = (short)odr2["h1330"] - (short)odr["h1330"]; h1400 = (short)odr2["h1400"] - (short)odr["h1400"]; h1430 = (short)odr2["h1430"] - (short)odr["h1430"]; h1500 = (short)odr2["h1500"] - (short)odr["h1500"]; h1530 = (short)odr2["h1530"] - (short)odr["h1530"]; h1600 = (short)odr2["h1600"] - (short)odr["h1600"]; h1630 = (short)odr2["h1630"] - (short)odr["h1630"]; h1700 = (short)odr2["h1700"] - (short)odr["h1700"]; h1730 = (short)odr2["h1730"] - (short)odr["h1730"]; h1800 = (short)odr2["h1800"] - (short)odr["h1800"]; h1830 = (short)odr2["h1830"] - (short)odr["h1830"]; } odr2.Close(); odcmd2.CommandText = "update resources set h800=" + h800 + ", h830=" + h830 + ", h900=" + h900 + ", h930=" + h930 + ", h1000=" + h1000 + ", h1030=" + h1030 + ", h1100=" + h1100 + ", h1130=" + h1130 + ", h1200=" + h1200 + ", h1230=" + h1230 + ", h1300=" + h1300 + ", h1330=" + h1330 + ", h1400=" + h1400 + ", h1430=" + h1430 + ", h1500=" + h1500 + ", h1530=" + h1530 + ", h1600=" + h1600 + ", h1630=" + h1630 + ", h1700=" + h1700 + ", h1730=" + h1730 + ", h1800=" + h1800 + ", h1830=" + h1830 + " where id='total ' and time=" + ticks; odcmd2.ExecuteNonQuery(); odcmd2.CommandText = "select * from resources where id='available ' and time=" + ticks; odr2 = odcmd2.ExecuteReader(); if (odr2.Read()) { h800 = (short)odr2["h800"] - (short)odr["h800"]; checkLog(ticks, "08:00", h800); h830 = (short)odr2["h830"] - (short)odr["h830"]; checkLog(ticks, "08:30", h830); h900 = (short)odr2["h900"] - (short)odr["h900"]; checkLog(ticks, "09:00", h900); h930 = (short)odr2["h930"] - (short)odr["h930"]; checkLog(ticks, "09:30", h930); h1000 = (short)odr2["h1100"] - (short)odr["h1100"]; checkLog(ticks, "10:00", h1000); h1030 = (short)odr2["h1030"] - (short)odr["h1030"]; checkLog(ticks, "10:30", h1030); h1100 = (short)odr2["h1100"] - (short)odr["h1100"]; checkLog(ticks, "11:00", h1100); h1130 = (short)odr2["h1130"] - (short)odr["h1130"]; checkLog(ticks, "11:30", h1130); h1200 = (short)odr2["h1200"] - (short)odr["h1200"]; checkLog(ticks, "12:00", h1200); h1230 = (short)odr2["h1230"] - (short)odr["h1230"]; checkLog(ticks, "12:30", h1230); h1300 = (short)odr2["h1300"] - (short)odr["h1300"]; checkLog(ticks, "13:00", h1300); h1330 = (short)odr2["h1330"] - (short)odr["h1330"]; checkLog(ticks, "13:30", h1330); h1400 = (short)odr2["h1400"] - (short)odr["h1400"]; checkLog(ticks, "14:00", h1400); h1430 = (short)odr2["h1430"] - (short)odr["h1430"]; checkLog(ticks, "14:30", h1430); h1500 = (short)odr2["h1500"] - (short)odr["h1500"]; checkLog(ticks, "15:00", h1500); h1530 = (short)odr2["h1530"] - (short)odr["h1530"]; checkLog(ticks, "15:30", h1530); h1600 = (short)odr2["h1600"] - (short)odr["h1600"]; checkLog(ticks, "16:00", h1600); h1630 = (short)odr2["h1630"] - (short)odr["h1630"]; checkLog(ticks, "16:30", h1630); h1700 = (short)odr2["h1700"] - (short)odr["h1700"]; checkLog(ticks, "17:00", h1700); h1730 = (short)odr2["h1730"] - (short)odr["h1730"]; checkLog(ticks, "17:30", h1730); h1800 = (short)odr2["h1800"] - (short)odr["h1800"]; checkLog(ticks, "18:00", h1800); h1830 = (short)odr2["h1830"] - (short)odr["h1830"]; checkLog(ticks, "18:30", h1830); } odr2.Close(); odcmd2.CommandText = "update resources set h800=" + h800 + ", h830=" + h830 + ", h900=" + h900 + ", h930=" + h930 + ", h1000=" + h1000 + ", h1030=" + h1030 + ", h1100=" + h1100 + ", h1130=" + h1130 + ", h1200=" + h1200 + ", h1230=" + h1230 + ", h1300=" + h1300 + ", h1330=" + h1330 + ", h1400=" + h1400 + ", h1430=" + h1430 + ", h1500=" + h1500 + ", h1530=" + h1530 + ", h1600=" + h1600 + ", h1630=" + h1630 + ", h1700=" + h1700 + ", h1730=" + h1730 + ", h1800=" + h1800 + ", h1830=" + h1830 + " where id='available ' and time=" + ticks; odcmd2.ExecuteNonQuery(); } odc2.Close(); } // lock odr.Close(); odcmd.CommandText = "update users set deltime=" + dt.ToFileTime() + " where id='" + id.PadRight(10, ' ') + "'"; odcmd.ExecuteNonQuery(); odcmd.CommandText = "delete from resources where id='" + id.PadRight(10, ' ') + "' and time >= " + dt.ToFileTime(); odcmd.ExecuteNonQuery(); checkLog_term(id); } else { odcmd.CommandText = "delete from users where id='" + id.PadRight(10, ' ') + "'"; odcmd.ExecuteNonQuery(); } } else odr.Close(); odt.Commit(); } else { OleDbCommand odcmd = new OleDbCommand( "select * from users where id='" + id.PadRight(10, ' ') + "'", odc); OleDbDataReader odr = odcmd.ExecuteReader(); if (odr.Read()) { short type = (short)odr["type"]; string password = (string)odr["password"]; string name = (string)odr["name"]; string mail = (string)odr["mail"]; string address = (string)odr["address"]; string city = (string)odr["city"]; string state = (string)odr["state"]; string zip = (string)odr["zip"]; string country = (string)odr["country"]; string region = (string)odr["region"]; string latitude = (string)odr["latitude"]; string longitude = (string)odr["longitude"]; odr.Close(); lblStatus.Text = id + " displayed"; char[] blank = new char[] { ' ' }; switch (type) { case 0: tbName.Enabled = false; tbMail.Enabled = false; tbAddress.Enabled = false; tbCity.Enabled = false; ddState.Enabled = false; ddCountry.Enabled = false; tbZip.Enabled = false; tbRegion.Enabled = false; tbLatitude.Enabled = false; tbLongitude.Enabled = false; btnUpdate.Enabled = false; setForm(id, name, mail, address, city, state, country, zip, region, latitude, longitude, blank); break; case 1: enable(); setForm(id, name, mail, address, city, state, country, zip, region, latitude, longitude, blank); Context.Session.Add("UserUpdate", true); break; default: enable(); odcmd.CommandText = "select info from resources_info where id='" + id.PadRight(10, ' ') + "'"; odr = odcmd.ExecuteReader(); if (odr.Read()) tbInfo.Text = (string)odr["info"]; odr.Close(); tbType.Enabled = false; tbId.Text = id.TrimEnd(blank); tbId.Enabled = false; tbInfo.Enabled = true; tbName.Text = name; tbMail.Text = mail; tbAddress.Text = address; tbCity.Text = city; setDropDown(state, country, blank); tbZip.Text = zip.TrimEnd(blank); tbRegion.Text = region.TrimEnd(blank); tbLatitude.Text = latitude.TrimEnd(blank); tbLongitude.Text = longitude.TrimEnd(blank); Context.Session.Add("UserUpdate", true); break; } } else odr.Close(); } bind(odc); odc.Close(); } } /// /// Set the form fields /// /// User ID /// User name /// eMail address /// User address /// City /// User state /// User country /// User zip code /// User region /// User latitude in N|S:ddd:mm.mmm format /// User longitude in W|E:ddd:mm.mmm format /// For trim private void setForm(string id, string name, string mail, string address, string city, string state, string country, string zip, string region, string latitude, string longitude, char[] blank) { tbType.Checked = true; tbType.Enabled = false; tbInfo.Text = ""; tbInfo.Enabled = false; tbId.Text = id.TrimEnd(blank); tbId.Enabled = false; tbName.Text = name; tbMail.Text = mail; tbAddress.Text = address; tbCity.Text = city; setDropDown(state, country, blank); tbZip.Text = zip.TrimEnd(blank); tbRegion.Text = region.TrimEnd(blank); tbLatitude.Text = latitude.TrimEnd(blank); tbLongitude.Text = longitude.TrimEnd(blank); lblStatus.Text = id + " displayed"; } /// /// Enable form fields /// private void enable() { tbName.Enabled = true; tbMail.Enabled = true; tbAddress.Enabled = true; tbCity.Enabled = true; ddState.Enabled = true; ddCountry.Enabled = true; tbZip.Enabled = true; tbRegion.Enabled = true; tbLatitude.Enabled = true; tbLongitude.Enabled = true; btnUpdate.Enabled = true; } /// /// Set the state and country drop down lists /// /// State or province code /// Country code /// For trim private void setDropDown(string state, string country, char[] blank) { string st = state.TrimEnd(blank); ddState.SelectedIndex = 0; if (st.Length > 0) { string sta = null; if (Global.statePerCode.Contains(st)) sta = (string)Global.statePerCode[st]; else { if (Global.provincePerCode.Contains(st)) sta = (string)Global.provincePerCode[st]; } for (int i = 0; i < Global.stateAl.Count; ++ i) { string s = (string)Global.stateAl[i]; if (s.Equals(sta)) { ddState.SelectedIndex = i; break; } } } string countryName = (string)Global.countryPerCode[country]; for (int i = 0; i < Global.countryAl.Count; ++ i) { string c = (string)Global.countryAl[i]; if (c.Equals(countryName)) { ddCountry.SelectedIndex = i; break; } } } /// /// Deletion error reporting. /// /// User id /// true if delete of an employee is allowed bool checkLog_init(string toDelete) { if (File.Exists(Global.path + "\\user_delete.html")) { lblStatus.Text = "You must first display and cleanup the deletion log"; return false; } checkId = toDelete; return true; } /// /// Set the link to the deletion error log. /// void checkLog_bind() { if (File.Exists(Global.path + "\\user_delete.html")) { hlCheck.ImageUrl = "CheckWarning.gif"; hlCheck.Enabled = true; } else { hlCheck.ImageUrl = "CheckDisabled.gif"; hlCheck.Enabled = false; } } /// /// Close the deletion log. /// /// User id void checkLog_term(string toDelete) { if (sw == null) { lblStatus.Text = toDelete + " deleted"; return; } sw.WriteLine( ""); sw.Close(); lblStatus.Text = "Check the deletion log: you need to reshuffle your schedule"; } /// /// Add an entry to the deletion log. /// /// Tick number of the day /// Hour in HHMM format /// Missing resources void checkLog(decimal ticks, string hhmm, int delta) { if (delta >= 0) return; DateTime dt = DateTime.FromFileTime((long)ticks); if (sw == null) { sw = File.CreateText(Global.path + "\\user_delete.html"); sw.WriteLine( "" + "
Reservation: " + checkId + " deletion
" + ""); } sw.WriteLine(""); } StreamWriter sw = null; string checkId = null; /// /// To enable the creation of new users with a model /// (enables the id and type). Note: ignored in case of update. /// private void OnRefresh(object sender, System.EventArgs e) { OleDbConnection odc = new OleDbConnection(Global.connectionString); odc.Open(); bind(odc); odc.Close(); object uu = Context.Session["UserUpdate"]; if (uu != null) Context.Session.Remove("UserUpdate"); tbType.Enabled = true; tbId.Enabled = true; enable(); if (tbType.Checked) tbInfo.Enabled = false; else tbInfo.Enabled = true; } /// /// Enables Info if employee type. /// private void OnCheckedChanged(object sender, System.EventArgs e) { if (tbType.Checked) tbInfo.Enabled = false; else tbInfo.Enabled = true; } } /// /// Datagrid row. /// public sealed class UserEntry { /// /// User id /// private string m_id; /// /// User type 0 registered end user, 1 proxy end user, 2 employee (resource) /// private short m_type; /// /// User name /// private string m_name; /// /// Mail address /// private string m_mail; /// /// Constructor /// /// User id /// User type /// user name /// Mail address public UserEntry(string id, short type, string name, string mail) { m_id = id; m_type = type; m_name = name; m_mail = mail; } /// /// User id /// public string id { get { return m_id; } } /// /// User type /// public string type { get { switch (m_type) { case 0: return "customer"; case 1: return "proxy"; case 2: return "employee"; default: return "????"; } } } /// /// User name /// public string name { get { return m_name; } } /// /// Mail address /// public string mail { get { return m_mail; } } } }
DayHourMissing
" + dt.ToShortDateString() + "" + hhmm + "" + delta + "