private void ErrorBox_OnRevertValidText(object sender, EventArgs e) { TextBox1.Text = _lastValidSql; TextBox1.Focus(); }
private void Button1_Click(object sender, EventArgs e) { Person one = new Person(); one.Name = TextBox1.Text; foreach (Control item in this.Controls) { if (item is RadioButton) { RadioButton temp = item as RadioButton; if (temp.Checked) { one.Gender = temp.Text; } } } one.Bitrhday = DateTimePicker1.Value; foreach (Control x in panel1.Controls) { if (x is CheckBox) { CheckBox temp = x as CheckBox; temp.ThreeState = false; if (temp.Checked) { one.Language.Add(temp.Text); } } } //foreach (var item in one.Language) //{ // MessageBox.Show($"Language: {item}"); //} foreach (Control x in panel2.Controls) { if (x is CheckBox) { CheckBox temp = x as CheckBox; temp.ThreeState = false; if (temp.Checked) { one.Language_.Add(temp.Text); } } } //foreach (var item in one.Language_) //{ // MessageBox.Show($"Language: {item}"); //} foreach (Control x in panel3.Controls) { if (x is CheckBox) { CheckBox temp = x as CheckBox; temp.ThreeState = false; if (temp.Checked && temp.Text != "Another") { one.Hobby.Add(temp.Text); } if (temp.Checked && temp.Text == "Another") { one.Hobby.Add(textBox2.Text); } } } if (one.Name == "Enter name" || one.Name == null) { MessageBox.Show("Enter name, please"); TextBox1.Focus(); return; } if (one.Gender == null) { MessageBox.Show("Select gender, please"); return; } textBox2.Visible = false; people.Add(one); ListBox1.Items.Add(one.Name); ListBox1.Items.Add(one.Bitrhday); ListBox1.Items.Add(one.Gender); foreach (var item in one.Language) { ListBox1.Items.Add(item); } foreach (var item in one.Language_) { ListBox1.Items.Add(item); } foreach (var item in one.Hobby) { ListBox1.Items.Add(item); } ////////////////////////// TextBox1.Clear(); TextBox1.Focus(); DateTimePicker1.Value = DateTime.Now; foreach (Control x in Controls) { if (x is RadioButton) { RadioButton temp = x as RadioButton; if (temp.Checked) { temp.Checked = false; } } } foreach (Control x in panel1.Controls) { if (x is CheckBox) { CheckBox temp = x as CheckBox; temp.ThreeState = false; if (temp.Checked) { temp.Checked = false; } } } foreach (Control x in panel2.Controls) { if (x is CheckBox) { CheckBox temp = x as CheckBox; temp.ThreeState = false; if (temp.Checked) { temp.Checked = false; } } } foreach (Control x in panel3.Controls) { if (x is CheckBox) { CheckBox temp = x as CheckBox; temp.ThreeState = false; if (temp.Checked) { temp.Checked = false; textBox2.Text = String.Empty; textBox2.Visible = false; } } } MessageBox.Show($"Questionnaire saved"); }
protected void Page_Load(object sender, EventArgs e) { TextBox1.Focus(); }
private void Validation_Status() { try { Double str1 = Convert.ToDouble(Label11.Text); Double str2 = Convert.ToDouble(Label10.Text); Double LL1 = str1; Double L1 = 0; Double H1 = 0; Double HH1 = str2; //Double LL2 = str1; //Double L2 = 0; //Double H2 = 0; //Double HH2 = str2; if ((TextBox1.BackColor != Color.LightGray)) { LL1 = Convert.ToDouble(TextBox1.Text.Substring(1, (TextBox1.Text.Length - 1))); } if ((TextBox2.BackColor != Color.LightGray)) { L1 = Convert.ToDouble(TextBox2.Text.Substring(1, (TextBox2.Text.Length - 1))); } if ((TextBox3.BackColor != Color.LightGray)) { H1 = Convert.ToDouble(TextBox3.Text.Substring(1, (TextBox3.Text.Length - 1))); } if ((TextBox4.BackColor != Color.LightGray)) { HH1 = Convert.ToDouble(TextBox4.Text.Substring(1, (TextBox4.Text.Length - 1))); } if (((LL1 < str1) || (LL1 > str2)) && (TextBox1.BackColor != Color.LightGray)) { MessageBox.Show("L-Low1 'Limit' value must be between Parameter Min and Max Value. !! "); TextBox1.Focus(); return; } if ((LL1 > L1) && (TextBox2.BackColor != Color.LightGray)) { MessageBox.Show("L-Low1 'Limit' value must be Less then Low1 'Limit' value !!"); TextBox1.Focus(); return; } if (((L1 < str1) || (L1 > str2)) && (TextBox2.BackColor != Color.LightGray)) { MessageBox.Show("Low1 'Limit' value must be between Parameter Min and Max Value. !! "); TextBox2.Focus(); return; } if ((L1 > H1) && (TextBox3.BackColor != Color.LightGray)) { MessageBox.Show("Low1 'Limit' value must be Less then High1 'Limit' value !!"); TextBox2.Focus(); return; } if (((H1 < str1) || (H1 > str2)) && (TextBox3.BackColor != Color.LightGray)) { MessageBox.Show("High1 'Limit' value must be between Parameter Min and Max Value. !! "); TextBox3.Focus(); return; } if ((H1 > HH1) && (TextBox4.BackColor != Color.LightGray)) { MessageBox.Show("High1 'Limit' value must be Less then H-High1 'Limit' value !!"); TextBox3.Focus(); return; } if (((HH1 < str1) || (HH1 > str2)) && (TextBox4.BackColor != Color.LightGray)) { MessageBox.Show("H-High1 'Limit' value must be between Parameter Min and Max Value. !! "); TextBox4.Focus(); return; } } catch (Exception ex) { MessageBox.Show("Validation_Status @ Error Code:7019" + ex.Message); } }
public void FocusOnTextbox() { TextBox1.Focus(); }
protected void reset_Click(object sender, EventArgs e) { TextBox1.Text = string.Empty; TextBox1.Focus(); }
/*........................................................................................................*/ protected void Page_Load(object sender, EventArgs e) { if (Session["Index"] == null) { Session["Index"] = 0; } int galka = 0; Session["galka"] = null; /***------------------------------------------блок списка вопросов----------------------------------***/ var questId = Convert.ToInt32(Request["questId"]); if (Session["quest_list"] != null) { int r = 1; int i = 0; var Qest_list = (List <Questionss>)Session["quest_list"]; var Answ_list = (List <Answerss>)Session["answ_list"]; var Flag_list = (List <FLAGLARsew>)Session["chks"]; var countqest = Qest_list.Count(); //для первого вопроса if (questId == 0) { foreach (var td in Qest_list) { if (questId != td.ID) { questId = td.ID; } break; } } //загрузка ответов из сессии QuestionsPerPart.Items.Clear(); foreach (var t in Qest_list) { var item = new ListItem { Value = t.ID.ToString(), Text = string.Concat("Вопрос ", r)//t.ID.ToString() + "-- }; if (t.ID == questId) { item.Selected = true; } else { item.Selected = false; } QuestionsPerPart.Items.Add(item); if (Session["Values"] != null) { var enums = Session["Values"] as List <ResultClassMy>; var cur_flag = enums.Where(en => en.QuestionId == t.ID); if (cur_flag.Count() > 0) { if (cur_flag.First().Result) { QuestionsPerPart.Items[i].Attributes["style"] = "color:green"; } //ответ верный else { QuestionsPerPart.Items[i].Attributes["style"] = "color:red"; } //ответ не правильный } else { QuestionsPerPart.Items[i].Attributes["style"] = "color:black";//нет ответа } } i++; r++; } i = 0; /*------------------------------------------------------------------------------------------------------*/ /*-------------------------------------------блок выводa названия вопроса-------------------------------------------*/ foreach (var item in Qest_list) { if (item.ID == questId) { LabelVoprosa.Text = item.QuestName;//вывод текста вопроса + item.ID"Вопрос: " + " " + LabelVoprosa.ForeColor = System.Drawing.Color.Black; LabelVoprosa.Font.Bold = true; } continue; } /*------------------------------------------блок вывода ответов-------------------------------------------*/ int f = 0; int max = 0; List <string> _otv_list; List <string> Perem_otv_list; string otv; if (Session["quiestid"] == null) { Session["ff"] = questId; } if ((int)Session["ff"] != questId) { Session["Perem_otv_list"] = null; Session["quiestid"] = null; } if (Session["Perem_otv_list"] == null && Session["quiestid"] == null) { _otv_list = new List <string>(); Perem_otv_list = new List <string>(); foreach (var c in Answ_list) { if (c.QuestionId == questId && c.Porydoc == null) { otv = c.TextOtv; _otv_list.Add(otv); } } Perem_otv_list = Operation.PermOtveti(_otv_list); Session["quiestid"] = questId; Session["ff"] = questId; Session["Perem_otv_list"] = Perem_otv_list; } else { Perem_otv_list = (List <string>)Session["Perem_otv_list"]; } if (Flag_list == null)/* ...если ответ не получен еще ни один*/ { int maxlengh = 0; int l = 1; int ses = 0; foreach (var n in Answ_list) { if (n.QuestionId == questId && n.Porydoc == null) { foreach (var d in Perem_otv_list) { var chk = new CheckBox//создание чкбоксов { BackColor = System.Drawing.Color.Yellow, Text = d,//n.TextOtv, ID = "chk" + f.ToString(), AutoPostBack = true, Checked = false, }; chk.Width = Request.Browser.ScreenPixelsWidth; chk.Font.Size = 14; chk.CheckedChanged += new EventHandler(chk_CheckedChanged); chk.ForeColor = System.Drawing.Color.Black; chk.Font.Name = "Calibri"; Panel2.Controls.Add(chk); Panel2.Controls.Add(new LiteralControl("<br /><br />")); f++; } break; } else if (n.AnswerCorrect == true && n.Porydoc != null && n.QuestionId == questId) { if (Session["galka"] == null) { Panel2.Controls.Add(new LiteralControl("<table border='1'>")); } AnswerButton.Enabled = true; Label3.Visible = true; maxlengh++; TextBox1.Visible = true; TextBox1.Focus(); Label2.Visible = true; //Button1.Visible = true; Panel2.Controls.Add(new LiteralControl("<tr><td><span style='font-weight: bold; color: black;'>")); var llab = new Label { BackColor = System.Drawing.Color.Yellow, Text = n.TextOtv, ID = "llab" + f.ToString(), }; llab.Width = 300; llab.Font.Size = 14; llab.ForeColor = System.Drawing.Color.Black; llab.BorderColor = System.Drawing.Color.Black; llab.Font.Name = "Calibri"; Panel2.Controls.Add(llab); Panel2.Controls.Add(new LiteralControl("</span></td>")); f++; Session["galka"] = ++galka; //continue; } else if (n.AnswerCorrect == false && n.Porydoc != null && n.QuestionId == questId) { if (Session["ss"] == null) { Session["ss"] = ses; } Panel2.Controls.Add(new LiteralControl("<td><span style='font-weight: bold; color: black;'>")); var labfs = new Label { BackColor = System.Drawing.Color.Yellow, Text = "[" + l + "]" + n.TextOtv, ID = "labfs" + l.ToString(), }; labfs.Width = 400; labfs.Font.Size = 14; labfs.ForeColor = System.Drawing.Color.Black; labfs.BorderColor = System.Drawing.Color.Black; labfs.Font.Name = "Calibri"; Panel2.Controls.Add(labfs); l++; Panel2.Controls.Add(new LiteralControl("</span></td></tr>")); max = maxlengh + (maxlengh - 1); //Session["maxl"] = max; TextBox1.MaxLength = max; TextBox1.Visible = true; switch (maxlengh) { case 2: RegularExpressionValidator1.ValidationExpression = "[1-" + maxlengh + "],[1-" + maxlengh + "]"; break; case 3: RegularExpressionValidator1.ValidationExpression = "[1-" + maxlengh + "],[1-" + maxlengh + "],[1-" + maxlengh + "]"; break; case 4: RegularExpressionValidator1.ValidationExpression = "[1-" + maxlengh + "],[1-" + maxlengh + "],[1-" + maxlengh + "],[1-" + maxlengh + "]"; break; case 5: RegularExpressionValidator1.ValidationExpression = "[1-" + maxlengh + "],[1-" + maxlengh + "],[1-" + maxlengh + "],[1-" + maxlengh + "],[1-" + maxlengh + "]"; break; } } Session["galka"] = ++galka; } if (Session["galka"] != null) { Panel2.Controls.Add(new LiteralControl("</table>")); Session["galka"] = null; } } else /*..........................................если ответs хотя бы один плучен......................*/ { int contin = 0; int maxlengh = 0; foreach (var hj in Flag_list) { if (hj.IDvoprosa == questId) { contin++; } if (contin > 1) //это повторяется вопрос, если истинно { break; } } if (contin == 0) //вопрос не повторялся { int l = 1; int ses = 0; foreach (var n in Answ_list) { if (n.QuestionId == questId && n.Porydoc == null) { var chk = new CheckBox //создание чкбоксов { BackColor = System.Drawing.Color.Yellow, Text = n.TextOtv, ID = "chk" + f.ToString(), AutoPostBack = true, Checked = false, }; chk.Width = Request.Browser.ScreenPixelsWidth; chk.Font.Size = 14; chk.CheckedChanged += new EventHandler(chk_CheckedChanged); chk.ForeColor = System.Drawing.Color.Black; chk.Font.Name = "Calibri"; Panel2.Controls.Add(chk); Panel2.Controls.Add(new LiteralControl("<br /><br />")); f++; } else if (n.AnswerCorrect == true && n.Porydoc != null && n.QuestionId == questId) { maxlengh++; if (Session["galka"] == null) { Panel2.Controls.Add(new LiteralControl("<table border='1'>")); } TextBox1.Visible = true; AnswerButton.Enabled = true; Label2.Visible = true; TextBox1.Focus(); Label3.Visible = true; Panel2.Controls.Add(new LiteralControl("<tr><td><span style='font-weight: bold; color: black;'>")); var llab = new Label { BackColor = System.Drawing.Color.Yellow, Text = n.TextOtv, ID = "llab" + f.ToString(), }; llab.Width = 300; llab.Font.Size = 14; llab.ForeColor = System.Drawing.Color.Black; llab.BorderColor = System.Drawing.Color.Black; llab.Font.Name = "Calibri"; Panel2.Controls.Add(llab); Panel2.Controls.Add(new LiteralControl("</span></td>")); //Session["maxlengh"] = maxlengh; f++; Session["galka"] = ++galka; } if (n.AnswerCorrect == false && n.Porydoc != null && n.QuestionId == questId) { if (Session["ss"] == null) { Session["ss"] = ses; } Panel2.Controls.Add(new LiteralControl("<td><span style='font-weight: bold; color: black;'>")); var labf = new Label { BackColor = System.Drawing.Color.Yellow, Text = "[" + l + "]" + n.TextOtv, ID = "labf" + l.ToString(), }; labf.Width = 400; labf.Font.Size = 14; labf.ForeColor = System.Drawing.Color.Black; labf.BorderColor = System.Drawing.Color.Black; labf.Font.Name = "Calibri"; Panel2.Controls.Add(labf); l++; Panel2.Controls.Add(new LiteralControl("</span></td></tr>")); max = maxlengh + (maxlengh - 1); TextBox1.MaxLength = max; // Session["maxl"] = max; TextBox1.Visible = true; switch (maxlengh) { case 2: RegularExpressionValidator1.ValidationExpression = "[1-" + maxlengh + "],[1-" + maxlengh + "]"; break; case 3: RegularExpressionValidator1.ValidationExpression = "[1-" + maxlengh + "],[1-" + maxlengh + "],[1-" + maxlengh + "]"; break; case 4: RegularExpressionValidator1.ValidationExpression = "[1-" + maxlengh + "],[1-" + maxlengh + "],[1-" + maxlengh + "],[1-" + maxlengh + "]"; break; case 5: RegularExpressionValidator1.ValidationExpression = "[1-" + maxlengh + "],[1-" + maxlengh + "],[1-" + maxlengh + "],[1-" + maxlengh + "],[1-" + maxlengh + "]"; break; } } Session["galka"] = ++galka; } if (Session["galka"] != null) { Panel2.Controls.Add(new LiteralControl("</table>")); Session["galka"] = null; } } //если отвечал на вопрос else { int tx = 0; var txt = new Label { BackColor = System.Drawing.Color.Red, Text = "Вы ответили на этот вопрос.Перейдите к вопросу помеченному черным цветом", ID = "txt" + tx.ToString() }; txt.Width = Request.Browser.ScreenPixelsWidth; // txt.Height = 40; txt.Font.Size = 14; txt.ForeColor = System.Drawing.Color.White; txt.Font.Name = "Calibri"; Panel2.Controls.Add(txt); } } } }
void clk_new() { DataTable get_value1 = new DataTable(); get_value1 = DBCon.Ora_Execute_table("select * From KW_Ref_Carta_Akaun where Id='" + lbl_name.Text + "'"); if (get_value1.Rows.Count != 0) { kat_akaun.SelectedValue = get_value1.Rows[0]["kat_akaun"].ToString(); TextBox2.Text = get_value1.Rows[0]["nama_akaun"].ToString(); get_cd.Text = get_value1.Rows[0]["kod_akaun"].ToString(); dd_kodind.SelectedValue = get_value1.Rows[0]["ct_kod_industry"].ToString(); dd_list_sts.SelectedValue = get_value1.Rows[0]["Status"].ToString(); if (get_value1.Rows[0]["kkk_rep"].ToString() == "1") { CheckBox1.Checked = true; } else { CheckBox1.Checked = false; } if (get_value1.Rows[0]["PAL_rep"].ToString() == "1") { CheckBox2.Checked = true; } else { CheckBox2.Checked = false; } if (get_value1.Rows[0]["AT_rep"].ToString() == "1") { CheckBox3.Checked = true; } else { CheckBox3.Checked = false; } if (get_value1.Rows[0]["AP_rep"].ToString() == "1") { CheckBox4.Checked = true; } else { CheckBox4.Checked = false; } if (get_value1.Rows[0]["COGS_rep"].ToString() == "1") { CheckBox5.Checked = true; } else { CheckBox5.Checked = false; } if (get_value1.Rows[0]["jenis_akaun_type"].ToString() != "1") { ss1.Visible = true; } else { ss1.Visible = false; } } TextBox1.Text = ""; TextBox1.Focus(); ver_id.Text = "0"; show_ddvalue(); }
void clk_update() { DataTable get_value = new DataTable(); get_value = DBCon.Ora_Execute_table("select * From KW_Ref_Carta_Akaun where Id='" + lbl_name.Text + "'"); if (get_value.Rows.Count != 0) { Button4.Text = "Kemaskini"; ver_id.Text = "1"; //Button6.Visible = true; DataTable get_value2 = new DataTable(); get_value2 = DBCon.Ora_Execute_table("select * From KW_Ref_Carta_Akaun where kod_akaun='" + get_value.Rows[0]["jenis_akaun"].ToString() + "'"); if (get_value2.Rows.Count != 0) { TextBox2.Text = get_value2.Rows[0]["nama_akaun"].ToString(); } kat_akaun.SelectedValue = get_value.Rows[0]["kat_akaun"].ToString(); TextBox1.Text = get_value.Rows[0]["nama_akaun"].ToString(); dd_akaun.SelectedValue = get_value.Rows[0]["under_jenis"].ToString(); dd_kodind.SelectedValue = get_value.Rows[0]["ct_kod_industry"].ToString(); dd_list_sts.SelectedValue = get_value.Rows[0]["Status"].ToString(); if (get_value.Rows[0]["Susu_nilai"].ToString() == "1") { RadioButton1.Checked = true; } else { RadioButton1.Checked = false; } if (get_value.Rows[0]["kkk_rep"].ToString() == "1") { CheckBox1.Checked = true; } else { CheckBox1.Checked = false; } if (get_value.Rows[0]["PAL_rep"].ToString() == "1") { CheckBox2.Checked = true; } else { CheckBox2.Checked = false; } if (get_value.Rows[0]["AT_rep"].ToString() == "1") { CheckBox3.Checked = true; } else { CheckBox3.Checked = false; } if (get_value.Rows[0]["AP_rep"].ToString() == "1") { CheckBox4.Checked = true; } else { CheckBox4.Checked = false; } if (get_value.Rows[0]["COGS_rep"].ToString() == "1") { CheckBox5.Checked = true; } else { CheckBox5.Checked = false; } if (get_value.Rows[0]["jenis_akaun_type"].ToString() == "1") { TextBox1.Attributes.Add("Readonly", "Readonly"); ss1.Visible = false; } else { TextBox1.Attributes.Remove("Readonly"); ss1.Visible = true; } TextBox1.Focus(); show_ddvalue(); } }
protected void Button_Click(object sender, EventArgs e) { try { if (TextBox1.Text.Trim() == "" && TextBox.Text.Trim() == "") { Response.Write("<script language=javascript>alert('Falta ingresar el nombre de Usuario y contraseña')</script>"); TextBox1.Focus(); return; } if (TextBox1.Text.Trim() == "") { Response.Write("<script language=javascript>alert('Falta ingresar el nombre de Usuario')</script>"); TextBox1.Focus(); return; } if (TextBox.Text.Trim() == "") { Response.Write("<script language=javascript>alert('Falta ingresar la contraseña')</script>"); TextBox.Focus(); return; } if (TextBox1.Text.Trim() != "" && TextBox.Text.Trim() != "") { String existe = ""; objUsuarioBE.Usuario = TextBox1.Text.Trim(); objUsuarioBE.Password = Convert.ToInt32(TextBox.Text.Trim()); existe = objUsuarioBL.ConsultarUsuario(objUsuarioBE); if (existe.Equals("1")) { string[] datoUsuario = new string[2]; objUsuarioBL.IniciarSesion(objUsuarioBE, datoUsuario); if (!datoUsuario[0].ToString().Equals("")) { if (datoUsuario[0].ToString() == "1") { Session["usuario"] = TextBox1.Text.ToString(); Session["usuarioRol"] = datoUsuario[0].ToString(); Session["idUsuario"] = datoUsuario[1].ToString(); Response.Redirect("WF_Administrador.aspx"); } if (datoUsuario[0].ToString() == "2") { Session["usuario"] = TextBox1.Text.ToString(); Session["usuarioRol"] = datoUsuario[0].ToString(); Session["idUsuario"] = datoUsuario[1].ToString(); Response.Redirect("WF_Proveedor.aspx"); } if (datoUsuario[0].ToString() == "3") { Session["usuario"] = TextBox1.Text.ToString(); Session["usuarioRol"] = datoUsuario[0].ToString(); Session["idUsuario"] = datoUsuario[1].ToString(); Response.Redirect("WF_Almacenero.aspx"); } if (datoUsuario[0].ToString() == "4") { Session["usuario"] = TextBox1.Text.ToString(); Session["usuarioRol"] = datoUsuario[0].ToString(); Session["idUsuario"] = datoUsuario[1].ToString(); Response.Redirect("WF_Cliente.aspx"); } if (datoUsuario[0].ToString() == "5") { Session["usuario"] = TextBox1.Text.ToString(); Session["usuarioRol"] = datoUsuario[0].ToString(); Session["idUsuario"] = datoUsuario[1].ToString(); Response.Redirect("WF_JefeDeLogistica.aspx"); } if (datoUsuario[0].ToString() == "6") { Session["usuario"] = TextBox1.Text.ToString(); Session["usuarioRol"] = datoUsuario[0].ToString(); Session["idUsuario"] = datoUsuario[1].ToString(); Response.Redirect("WF_Vendedora.aspx"); } if (datoUsuario[0].ToString() == "7") { Session["usuario"] = TextBox1.Text.ToString(); Session["usuarioRol"] = datoUsuario[0].ToString(); Session["idUsuario"] = datoUsuario[1].ToString(); Response.Redirect("WF_JefeDeInventario.aspx"); } } else { Response.Write("<script language=javascript>alert('El usuario no existe o contraseña invalida.')</script>"); TextBox1.Focus(); return; } } else { Response.Write("<script language=javascript>alert('El usuario no existe o contraseña invalida.')</script>"); TextBox1.Focus(); return; } } } catch (Exception ex) { Response.Write("<script language=javascript>alert('Error: " + ex.Message.ToString() + "')</script>" + ex.Message); return; //txtUsuario.Text = ""; //txtUsuario.Focus(); } }
protected void zaloguj() { int err = 0; Label3.Text = ""; DataSet login = new DataSet(); log.Info("Rozpoczecie logowania uzytkownika " + TextBox1.Text.Trim()); login = cl.loguj(TextBox1.Text.Trim(), TextBox2.Text.Trim()); try { DataRow dr = login.Tables[0].Rows[0]; string id = dr[0].ToString(); string imie = dr[0].ToString(); string nazwisko = dr[0].ToString(); string rola = dr[1].ToString(); if (rola != "0") { Session["user_id"] = id; Session["rola"] = rola; } else { err = 2; } } catch (Exception ex) { log.Error("logowanie : " + ex.Message); err = 1; } switch (err) { case 0: { Server.Transfer("default.aspx"); TextBox1.Text = ""; TextBox2.Text = ""; TextBox1.Focus(); } break; case 1: { Label3.Text = "Bład logowania"; TextBox1.Text = ""; TextBox2.Text = ""; TextBox1.Focus(); } break; case 2: { Label3.Text = "Nie masz praw do logowania!"; log.Error("logowanie : " + "Nie masz praw do logowania!"); } break; default: break; } }//zaloguj
private void MainWindow_KeyDown(object sender, KeyEventArgs e) { //MessageBox.Show(e.Key.ToString()); TextBox1.Focus(); bool flag = true; switch (e.Key) { case Key.Capital: foreach (TeButton item in all_buttons) { item.ChangeRegisterCaps(); } break; case Key.LeftShift: case Key.RightShift: foreach (TeButton item in all_buttons) { item.ChangeRegisterUp(); } flag = false; break; default: foreach (TeButton item in all_buttons) { if (e.Key.ToString() == item.Name) { item.Press(); } } break; } if (action) { string str = e.Key.ToString(); if (str.Length == 1) { char symbol = str[0]; if (!Console.CapsLock && flag) { if (core.Check_Сharacter(char.ToLower(symbol))) { TextBox1.SelectionLength++; } } else { if (core.Check_Сharacter(symbol)) { TextBox1.SelectionLength++; } } Label_Fails.Content = "Fails: " + core.GetFails.ToString(); } } }
protected void Page_Load(object sender, EventArgs e) { con = new SqlConnection(s); con.Open(); TextBox1.Focus(); }
private void Button2_Click(object sender, EventArgs e) { TextBox1.Text = ""; TextBox2.Clear(); TextBox1.Focus(); }
protected void Page_Load(object sender, EventArgs e) { Session["switch_emno"] = ""; string serverIP = Request.Url.ToString(); if (!Page.IsPostBack) { Session["textbox_text"] = ""; if (serverIP == "http://*****:*****@"<hr/> <script language=javascript>alert('尚未登入,請由系統首頁登入。'); window.location.href='/logout.asp'</script>" + ex.ToString()); } //if (Session["chktimeout"] == null) //{ // Session.Timeout = 15; // Session["chktimeout"] = "15"; //} } else { if (Session["userauth"] != null) { if (Session["userauth"].ToString() == "管理者") { Response.Redirect("./default.aspx"); //if (Request.Url.ToString() == "http://localhost:61434/management_page.aspx") // Response.Redirect("~/default.aspx"); //else // Response.Redirect("http://192.168.101.33/WebTest/5682/ecsfc/default.aspx"); } else { Response.Redirect("./pman_hour_collect.aspx?empl=" + Session["emplnet"] + ""); } } //else //{ // Session.RemoveAll(); // Response.Redirect("./management_page.aspx"); // //if (Request.Url.ToString() == "http://localhost:61434/management_page.aspx") // // Response.Redirect("~/management_page.aspx"); // //else // // Response.Redirect("http://192.168.101.33/WebTest/5682/ecsfc/management_page.aspx"); //} } } TextBox1.Focus(); }
protected void Page_Load(object sender, EventArgs e) { // ((Button)this.Master.FindControl("btnLogout")).Visible = false; // ((Button)this.Master.FindControl("btnMenu")).Visible = false; TextBox1.Focus(); }
protected void Button1_Click(object sender, EventArgs e) { if (TextBox1.Text.ToString().Trim().Length >= 7) { string customer = TextBox1.Text.Trim().Substring(0, 3); int product = Convert.ToInt32(TextBox1.Text.Trim().Substring(3, 3)); int version = 0; try { version = Convert.ToInt32(TextBox1.Text.Trim().Substring(6)); } catch (Exception es) { Response.Write("<script language=javascript>alert('编号的版本部分错误!')</script>"); TextBox1.Focus(); return; } if (version <= 0) { Response.Write("<script language=javascript>alert('编号的版本部分错误!')</script>"); TextBox1.Focus(); return; } SqlConnection conn = new DataBase().getSqlConnection(); SqlCommand cmd = conn.CreateCommand(); cmd.CommandText = "select id from 客户信息 where no=" + customer; try { conn.Open(); string customerID = cmd.ExecuteScalar().ToString(); if (customerID == null) { Response.Write("<script language=javascript>alert('编号的客户编码部分错误!')</script>"); TextBox1.Focus(); return; } cmd.CommandText = "select id from 成品编码_产品 where customer=" + customerID + " and no=" + product; string productID = cmd.ExecuteScalar().ToString(); if (productID == null) { Response.Write("<script language=javascript>alert('编号的产品编码部分错误!')</script>"); TextBox1.Focus(); return; } char versions = (char)((int)'A' + version - 1); cmd.CommandText = "select id from 成品编码_印刷 where no= " + productID + " and version='" + versions + "'"; string versionID = cmd.ExecuteScalar().ToString(); if (versionID == null) { Response.Write("<script language=javascript>alert('无此编码产品!')</script>"); TextBox1.Focus(); return; } cmd.CommandText = "select * from lastvisityinban where no=" + versionID; if (cmd.ExecuteNonQuery() == 1) { cmd.CommandText = "update lastvisityinban set lastdate='" + System.DateTime.Now.ToShortDateString() + "' where no=" + versionID + ")"; } else { cmd.CommandText = "insert into lastvisityinban values (" + versionID + ",'" + System.DateTime.Now.ToShortDateString() + "')"; } if (cmd.ExecuteNonQuery() == 1) { Response.Write("<script language=javascript>alert('日期已登记!')</script>"); TextBox1.Text = ""; TextBox1.Focus(); } else { Response.Write("<script language=javascript>alert('日期登记失败!')</script>"); TextBox1.Text = ""; TextBox1.Focus(); } } catch (Exception ey) { } finally { conn.Close(); } } else { Response.Write("<script language=javascript>alert('编号格式错误,请重新输入!')</script>"); TextBox1.Focus(); } }
public UserControl1() { InitializeComponent(); TextBox1.Select(); TextBox1.Focus(); }
protected void Button1_Click(object sender, EventArgs e) { uniqueno = Label21.Text; name = TextBox1.Text; lastname = TextBox11.Text; address = TextBox3.Text; phoneno = TextBox2.Text; mobileno = TextBox4.Text; email = TextBox5.Text; bikecompany = TextBox7.Text; bikename = TextBox8.Text; cardtype = DropDownList2.Text; cardno = TextBox9.Text; // amount = int.Parse(TextBox10.Text); city = DropDownList1.Text; date = Label19.Text; query = "select * from bank where name='" + name + "'"; cmd = new SqlCommand(query, conn); dr = cmd.ExecuteReader(); while (dr.Read()) { dbcardno = dr[1].ToString(); } dr.Close(); if (dbcardno.Equals(cardno)) { Label24.Text = ""; query = "insert into bikebooking(cust_no,cust_name,cust_lastname,cust_address,cust_phoneno,cust_mobileno,cust_email,bike_company,bike_name,card_type,card_no,amount,city,Day_Time,status) values('" + uniqueno + "','" + name + "','" + lastname + "','" + address + "','" + phoneno + "','" + mobileno + "','" + email + "','" + bikecompany + "','" + bikename + "','" + cardtype + "','" + cardno + "','" + amount + "','" + city + "','" + date + "','pending')"; cmd = new SqlCommand(query, conn); cmd.ExecuteNonQuery(); conn.Close(); MailMessage m = new MailMessage(); SmtpClient sc = new SmtpClient(); try { m.From = new MailAddress("*****@*****.**", "Volcania Automobiles"); m.To.Add(new MailAddress(email, name)); // m.CC.Add(new MailAddress("*****@*****.**", "Display name CC")); //similarly BCC m.Subject = "Bike booking confirmation."; m.IsBodyHtml = true; m.Body = "This Mail is from volcania automobiles to confirm the booking of your " + bikecompany + " " + bikename + " with the reciept of payment(Rs 10,000), your unique id is " + uniqueno + "."; sc.Host = "smtp.gmail.com"; sc.Port = 587; sc.Credentials = new System.Net.NetworkCredential("*****@*****.**", "bmmercaudiwdes"); sc.EnableSsl = true; sc.Send(m); Console.ReadLine(); } catch (Exception ex) { Console.WriteLine(ex.Message); Console.ReadLine(); } TextBox1.Text = ""; TextBox2.Text = ""; TextBox3.Text = ""; TextBox4.Text = ""; TextBox5.Text = ""; TextBox6.Text = ""; TextBox7.Text = ""; TextBox8.Text = ""; TextBox9.Text = ""; TextBox11.Text = ""; TextBox1.Focus(); Label23.Text = "Your Booking has been confirmed..."; } else { Label24.Text = "Invalid card Transaction...!!"; } }
private void UserControl1_Load(object sender, EventArgs e) { TextBox1.Select(); TextBox1.Focus(); }
protected void Button1_Click(object sender, EventArgs e) { conn.Open(); cmd = new SqlCommand("select UserType,Full_Name from LoginDetails INNER JOIN CustomerDetails on LoginDetails.Email=CustomerDetails.Email where LoginDetails.Email='" + TextBox1.Text + "' AND Pasword='" + TextBox2.Text + "'", conn); dr = cmd.ExecuteReader(); dr.Read(); if (dr.HasRows == true) { TextBox3.Text = dr["userType"].ToString(); Session["UID"] = TextBox1.Text; Session["UD"] = TextBox1.Text; Session["un"] = dr["Full_Name"].ToString(); Session["MPS"] = TextBox3.Text; Session.Timeout = 30; if (TextBox3.Text == "Customer") { Response.Redirect("CHome.aspx"); } Label1.Text = ""; } else { dr.Close(); cmd = new SqlCommand("select Usertype,Res_Name from LoginDetails INNER JOIN RestaurantDetails on LoginDetails.Email=RestaurantDetails.Email where LoginDetails.Email='" + TextBox1.Text + "' AND Pasword='" + TextBox2.Text + "'", conn); dr = cmd.ExecuteReader(); dr.Read(); if (dr.HasRows == true) { TextBox3.Text = dr["usertype"].ToString(); Session["UID"] = TextBox1.Text; Session["un"] = dr["Res_Name"].ToString(); Session.Timeout = 30; Session["MPS"] = TextBox3.Text; if (TextBox3.Text == "RESTURANT") { Response.Redirect("Rhomee.aspx"); } Label1.Text = ""; } else { dr.Close(); cmd = new SqlCommand("select userType,email from loginDetails where email='" + TextBox1.Text + "' and Pasword = '" + TextBox2.Text + "'", conn); dr = cmd.ExecuteReader(); dr.Read(); if (dr.HasRows == true) { Session["UID"] = TextBox1.Text; TextBox3.Text = dr["usertype"].ToString(); Session["MPS"] = TextBox3.Text; Session.Timeout = 30; if (TextBox3.Text == "Admin") { Response.Redirect("AHome.aspx"); } } else { TextBox1.Focus(); Label1.Text = "Invalid email id or password"; } } dr.Close(); conn.Close(); } }
//SqlConnection baglanti = new SqlConnection(@"Data Source=DESKTOP-BFA5AD8;Initial Catalog=Db_nkuyemekhane;Integrated Security=True"); protected void Button1_Click(object sender, EventArgs e) { ListBox1.Items.Add(TextBox1.Text); TextBox1.Text = ""; TextBox1.Focus(); }
new public void Focus() { TextBox1.Focus(); // TextBox1.Select(); }
private void btnASave_Click(object sender, EventArgs e) { try { Global.JobOrdNo = "***"; Process[] prs = Process.GetProcesses(); foreach (Process pr in prs) { //if (pr.ProcessName == "ModbusPollCS") pr.Kill(); if (pr.ProcessName == "Editors") { pr.Kill(); } if (pr.ProcessName == "Dataappliacation") { pr.Kill(); } } if (TextBox1.Text == String.Empty) // "") { MessageBox.Show("Please Type Engine No. ...... "); TextBox1.Focus(); } else if (PrjCombo.Text == String.Empty) { MessageBox.Show("Please Select Project. ...... "); PrjCombo.Focus(); } else if ((textBox7.Text == String.Empty) || (textBox8.Text == String.Empty) || (textBox13.Text == String.Empty)) { Erp1.SetError(groupBox2, "Some Input Value Is missing." + "\n\n" + " 1. Engine Idle RPM " + "\n" + " 2. Engine FlyUp RPM " + "\n" + " 3. Engine Max Power @ RPM " + "\n" + " 4. Engine Max Torque@ RPM "); MessageBox.Show("Some Input Value Is missing." + "\n\n" + " 1. Engine Idle RPM " + "\n" + " 2. Engine FlyUp RPM " + "\n" + " 3. Engine Max Power @ RPM " + "\n" + " 4. Engine Max Torque@ RPM "); groupBox2.Focus(); } else { Global.EngNo = TextBox1.Text; Global.EngineNo = TextBox1.Text; Global.FipNo = TextBox2.Text; Global.EngMd = TextBox3.Text; Global.OperatorNm = TextBox4.Text; Global.EnginerNm = TextBox5.Text; Global.TestRef = TextBox6.Text; Global.PrjNm = PrjCombo.Text; Global.T_Date = TextBox9.Text; Global.Shift = TextBox10.Text; Global.HzLog = HzCombo.Text; if (checkBox1.CheckState == CheckState.Checked) { Global.flg_smk = true; } else { Global.flg_smk = false; } if (checkBox2.CheckState == CheckState.Checked) { Global.flg_Radiator = true; } else { Global.flg_Radiator = false; } if (checkBox3.CheckState == CheckState.Checked) { Global.flg_Fan = true; } else { Global.flg_Fan = false; } if (checkBox4.CheckState == CheckState.Checked) { Global.flg_AirCln = true; } else { Global.flg_AirCln = false; } if (checkBox5.CheckState == CheckState.Checked) { Global.flg_Silincer = true; } else { Global.flg_Silincer = false; } if (rd_New.Checked == true) { Global.flg_NewFile = true; } else { Global.flg_NewFile = false; } if (rd_Last.Checked == true) { Global.flg_OldFile = true; } else { Global.flg_OldFile = false; } if (rd_smooth.Checked == true) { Global.flg_Smt_Changeover = true; } else { Global.flg_Smt_Changeover = false; } if (rd_standard.Checked == true) { Global.flg_Std_Changeover = true; } else { Global.flg_Std_Changeover = false; } String X = textBox7.Text; Global.S_Rpm = int.Parse(X); Global.I_Rpm = (int.Parse(X) + int.Parse(X) / 10); String Y = textBox8.Text; Global.F_Rpm = (int.Parse(Y) + int.Parse(Y) / 10); String Z = textBox13.Text; Global.Max_Trq = (Double.Parse(Z) + (Double.Parse(Z) / 10)); Global.Open_Connection("gen_db", "con"); MySqlCommand cmd = new MySqlCommand("UPDATE TbSys SET " + " CH1 = '" + Global.EngNo + "'," + " CH2 = '" + Global.FipNo + "'," + " CH3 = '" + Global.EngMd + "'," + " CH4 = '" + Global.OperatorNm + "'," + " CH5 = '" + Global.TKnNo + "'," + " CH6 = '" + Global.TestRef + "'," + " CH7 = '" + Global.PrjNm + "'," + " CH8 = '" + Global.flg_smk + "'," + " CH9 = '" + Global.flg_Radiator + "'," + " CH10 = '" + Global.flg_Fan + "'," + " CH11 = '" + Global.flg_AirCln + "'," + " CH12 = '" + Global.flg_Silincer + "'," + " CH13 = '" + Global.flg_NewFile + "'," + " CH14 = '" + Global.flg_OldFile + "'," + " CH15 = '" + Global.flg_Smt_Changeover + "'," + " CH16 = '" + Global.flg_Std_Changeover + "'," + " CH17 = '" + X + "'," + " CH18 = '" + Y + "'," + " CH19 = '" + Z + "'," + " CH20 = '" + Global.HzLog + "'" + " WHERE FileName = 'EngNo'", Global.con); cmd.ExecuteNonQuery(); Global.con.Close(); Global.Rd_System(); Global.PrjNm = PrjCombo.Text; Check_File_Validation(); Global.flg_Auto = true; Global.flg_Manual = false; Global.Read_Eng(); clsLimit.Read_Limfl(); Global.Flg_Ready = true; Global.main.BtnSA.Enabled = false; Global.main.Btn21.Enabled = true; Global.flg_Semi_Auto = false; switch (HzCombo.Text) { case "100 Hz": Global.Dly_cnt = 10000; break; case "080 Hz": Global.Dly_cnt = 12500; break; case "060 Hz": Global.Dly_cnt = 16667; break; case "050 Hz": Global.Dly_cnt = 20000; break; case "040 Hz": Global.Dly_cnt = 25000; break; case "020 Hz": Global.Dly_cnt = 50000; break; case "010 Hz": Global.Dly_cnt = 100000; break; case "001 Hz": Global.Dly_cnt = 1000000; break; default: Global.Dly_cnt = 1000000; break; } //Global.flg_RunStart = true; this.Close(); } } catch (Exception ex) { Global.Create_OnLog(ex.Message + " : Engine Dialog Save Auto File....", "Alart"); } }
protected void Button2_Click(object sender, EventArgs e) { TextBox1.Text = ""; TextBox2.Text = ""; TextBox1.Focus(); }
private void TextBoxBase_Enter(object sender, System.EventArgs e) { TextBox1.Focus(); }
private void Button1_Click(object sender, RoutedEventArgs e) { manzana.Visibility = Visibility.Collapsed; pera.Visibility = Visibility.Collapsed; if ((TextBox1.Text == "" || TextBox2.Text == "") || (RadioButton1.IsChecked == false && RadioButton2.IsChecked == false)) { TextBox1.Text = ""; TextBox1.Focus(); TextBox2.Text = ""; TextBlock1.Text = "Enter real fields"; TextBlock2.Text = ""; } else { double Cintura = Convert.ToDouble(TextBox1.Text); double Cadera = Convert.ToDouble(TextBox2.Text); double icc = (Cintura / Cadera); if (RadioButton1.IsChecked == true) { //// HOMBRE if (icc >= 0.71 || icc <= 0.84) { TextBlock1.Text = Math.Round(icc, 2) + " WHR"; TextBlock2.Text = "Within the standard body"; } if (icc < 0.71) { TextBlock1.Text = Math.Round(icc, 2) + " WHR"; TextBlock2.Text = "Pear body"; pera.Visibility = Visibility.Visible; } if (icc > 0.84) { TextBlock1.Text = Math.Round(icc, 2) + " WHR"; TextBlock2.Text = "Apple body"; manzana.Visibility = Visibility.Visible; } } if (RadioButton2.IsChecked == true) { //MUJER if (icc >= 0.78 || icc <= 0.94) { TextBlock1.Text = Math.Round(icc, 2) + " WHR"; TextBlock2.Text = "Within the standard body"; } if (icc < 0.78) { TextBlock1.Text = Math.Round(icc, 2) + " WHR"; TextBlock2.Text = "Pear body"; pera.Visibility = Visibility.Visible; } if (icc > 0.94) { TextBlock1.Text = Math.Round(icc, 2) + " WHR"; TextBlock2.Text = "Apple body"; manzana.Visibility = Visibility.Visible; } } } }
private void ButtonWissen_Click(object sender, EventArgs e) { TextBox1.Clear(); TextBox1.Focus(); RadioButton1.Checked = true; }
private void Clear_Rec() { TextBox1.Text = String.Empty; TextBox1.Focus(); }
protected void ImageButton2_Click(object sender, ImageClickEventArgs e) { TextBox1.Focus(); TextBox1.Visible = true; Button1.Visible = true; }