public frmLineModify(LineDataBean line) { InitializeComponent(); agent = SQLAgent.GetInstance(); cityList = agent.GetCityList(); foreach (var city in cityList) { cmbDep.Items.Add(city.cityName); cmbArr.Items.Add(city.cityName); if (city.cityId.Equals(line.depCity.ToString())) { cmbDep.Text = city.cityName; } if (city.cityId.Equals(line.arrCity.ToString())) { cmbArr.Text = city.cityName; } } id = line.id; txtNum.Text = line.trainNum; txtPrice.Text = line.price.ToString(); dateArr.Value = line.arrDate; dateDep.Value = line.depDate; }
public frmLineRUD(bool login, string user_id) { InitializeComponent(); agent = SQLAgent.GetInstance(); isLogin = login; this.user_id = user_id; }
private void frmViewCity_Load(object sender, EventArgs e) { SQLAgent agent = SQLAgent.GetInstance(); List <CityDataBean> cityList = agent.GetCityList(); dataView.Columns.Add("city_id", "城市ID"); dataView.Columns.Add("city_name", "城市名称"); for (int i = 0; i < cityList.Count; i++) { dataView.Rows.Add(cityList[i].cityId, cityList[i].cityName); } }
private void btnOK_Click(object sender, EventArgs e) { SQLAgent agent = SQLAgent.GetInstance(); if (!txtPass.Text.Equals(string.Empty) && !txtId.Text.Equals(string.Empty) && !txtRName.Text.Equals(string.Empty) && !txtTel.Text.Equals(string.Empty) && !txtUser.Text.Equals(string.Empty) && cmbSex.Items.Contains(cmbSex.Text)) { agent.AddUser(txtId.Text, txtRName.Text, cmbSex.SelectedIndex, txtTel.Text, txtUser.Text, txtPass.Text); MessageBox.Show("Registered", "Finished", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } else { MessageBox.Show("Not enough information", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
protected void Page_Load(object sender, EventArgs e) { string userid = HttpContext.Current.User.Identity.Name; string voiceText = SQLConditionGenderInfo.GetVoiceText(userid); if (SQLAgent.GetAgentSetting(userid) && voiceText == "text") { Response.Redirect("ProblemPageAgentText.aspx", false); } else if (SQLAgent.GetAgentSetting(userid)) { Response.Redirect("ProblemPageAgent.aspx", false); } else { Response.Redirect("Intro.aspx", false); } }
private void btnLogin_Click(object sender, EventArgs e) { if (txtUser.Text != string.Empty && txtPass.Text != string.Empty) { try { var sqlAgent = SQLAgent.GetInstance(); sqlAgent.Connect(File.ReadAllText("server.inf")); if (!sqlAgent.AdminLogin(txtUser.Text, txtPass.Text)) { MessageBox.Show("User name or password incorrect", "Login failed", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } this.Hide(); frmFunctions functions = new frmFunctions(); functions.Show(); } catch (Exception ex) { MessageBox.Show("Error connecting server\n" + ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); if (ex is WebException) { frmServerConfigure frm = new frmServerConfigure(); this.Enabled = false; frm.FormClosed += (o, arg) => { this.Enabled = true; }; frm.Show(); } } } else { MessageBox.Show("Please enter both user name and password", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
protected void Submit(object sender, EventArgs e) { string gender = Request.Form["selectGender"]; string agent = Request.Form["selectAgent"]; string condition = Request.Form["selectCondition"]; string enttype = Request.Form["selectEntrainment"]; string problemSet = Request.Form["selectProblemSet"]; string voiceText = Request.Form["selectVoiceText"]; string path = Request.PhysicalApplicationPath; string userid = HttpContext.Current.User.Identity.Name; string robotAddress = robotIP.Value; if (voiceText == "text" && condition.Contains("entrain")) { string script = "alert('You cannot select both text output and entrainment. Please select social or non-social if you want to use a text-based agent.');"; System.Web.UI.ScriptManager.RegisterClientScriptBlock(submitbutton, this.GetType(), "Test", script, true); } else if (agent == "false" && voiceText == "text") { string script = "alert('You cannot select both text output and a robot version. Please select agent if you want to use a text.');"; System.Web.UI.ScriptManager.RegisterClientScriptBlock(submitbutton, this.GetType(), "Test", script, true); } else { try { SQLConditionGenderInfo.UpdateConditionGender(userid, condition, gender, robotAddress, enttype, problemSet, voiceText); SQLAgent.SetAgent(agent, userid); Response.Redirect("default.aspx", false); } catch (Exception error) { SQLLog.InsertLog(DateTime.Now, error.Message, error.ToString(), "UpdateStep.ashx.cs", 0, userid); } } }
public frmLineRUD() { InitializeComponent(); agent = SQLAgent.GetInstance(); }
public frmAddCity() { InitializeComponent(); agent = SQLAgent.GetInstance(); cityList = new List <CityDataBean>(); }