private void FrmTextfeldKoppeln_Activated(object sender, EventArgs e) { TxtName.Focus(); TxtName.SelectAll(); Kopplung = true; Warning(); }
private void BtnEdit_Click(object sender, EventArgs e) { _Tag = "EDIT"; ControlEnableDisable(false, true); Text = "Company Setup [EDIT]"; _Initial = ClsGlobal.Initial; DataTable dt = _objCompany.GetDataCompany(_Initial); TxtInitial.Text = dt.Rows[0]["Initial"].ToString(); TxtInitial.Enabled = false; TxtName.Text = dt.Rows[0]["CompanyName"].ToString(); TxtStartDate.Text = dt.Rows[0]["StartDate"].ToString(); TxtEndDate.Text = dt.Rows[0]["EndDate"].ToString(); TxtFiscalYear.Text = dt.Rows[0]["FiscalYear"].ToString(); TxtAddress.Text = dt.Rows[0]["Address"].ToString(); TxtDistrict.Text = dt.Rows[0]["District"].ToString(); TxtCity.Text = dt.Rows[0]["City"].ToString(); TxtState.Text = dt.Rows[0]["State"].ToString(); TxtCountry.Text = dt.Rows[0]["Country"].ToString(); TxtPhoneNo.Text = dt.Rows[0]["PhoneNo"].ToString(); TxtFax.Text = dt.Rows[0]["Fax"].ToString(); TxtEmail.Text = dt.Rows[0]["Email"].ToString(); TxtWebSite.Text = dt.Rows[0]["Website"].ToString(); TxtPanNo.Text = dt.Rows[0]["PanNo"].ToString(); //CbActive.Checked = Convert.ToBoolean(dt.Rows[0]["Status"].ToString()); TxtName.SelectAll(); }
}//End GetInput() /// <summary> /// An Event to fill the array, and on full or empty string, display the results. /// </summary> /// <param name="sender">BtnAdd_Clic</param> /// <param name="e">Not Used</param> private void BtnAdd_Click(object sender, EventArgs e) { if (GetInput() == false) { RTxtDisplay.AppendText(bl.DisplayResults()); } TxtName.Focus(); TxtName.SelectAll(); }//End BtnAdd()
private void button1_Click(object sender, EventArgs e) { label1.Text = ""; int i = 0; if (TxtName.Text == "" && TxtPassWord.Text == "") { MessageBox.Show("请输入账号!"); TxtName.Focus(); } else if (TxtName.Text != "" && TxtPassWord.Text == "") { MessageBox.Show("请输入密码…"); TxtPassWord.Focus(); } else { while (true) { if (TxtName.Text == users[i].Name && TxtPassWord.Text == users[i].passWord) { label1.Text = "用户:" + users[i].Name + " 已登录"; button1.Visible = false; button2.Text = "注销"; TxtName.Clear(); TxtPassWord.Clear(); if (!File.Exists("Log.txt")) { File.Create("Log.txt").Close(); } string strLog = users[i].Name + "\t" + DateTime.Now.ToString(); StreamWriter sWriter = new StreamWriter("Log.txt", true); sWriter.WriteLine(strLog); sWriter.Close(); } i++; if (i > 4) { if (label1.Text == "") { MessageBox.Show("账号或密码错误!"); TxtName.Focus(); TxtName.SelectAll(); } break; } } } }
private void Form1_Activated(object sender, EventArgs e) { TxtName.Focus(); TxtName.SelectAll(); Kopplung = true; }
/// <summary> /// 添加用户 /// </summary> private void AddUser() { addUserArgs.UserNo = TxtUserNo.Text; if (TxtUserNo.Text != "" && TxtUserNo.Text.Length <= 20) { this.OnLeave(null, addUserArgs); if (isUserNoRepeat) { this.OnLeave(null, addUserArgs); CJia.PIVAS.Tools.Message.Show("此工号已存在"); TxtUserNo.Focus(); TxtUserNo.SelectAll(); isUserNoRepeat = false; return; } } else { CJia.PIVAS.Tools.Message.Show("工号不能为空且不能长于20位"); TxtUserNo.Focus(); TxtUserNo.SelectAll(); return; } if (TxtName.Text != "" && TxtName.Text.Length < 20) { addUserArgs.UserName = TxtName.Text; } else { CJia.PIVAS.Tools.Message.Show("请填写用户名称,并且长度不能大于20位"); TxtName.Focus(); TxtName.SelectAll(); return; } if (TxtNewPwd.Text != "" && TxtNewPwd.Text.Length <= 6) { if (TxtSurePwd.Text != "" && TxtSurePwd.Text.Length <= 6) { if (TxtNewPwd.Text == TxtSurePwd.Text) { addUserArgs.Pwd = CJia.PIVAS.Common.EncryptString(TxtNewPwd.Text); addUserArgs.IsAdmin = this.cbAdmin.Checked ? "1" : "0"; addUserArgs.UserId = User.UserId; addUserArgs.DeptId = "1000000000"; addUserArgs.DeptName = "静脉药物配置中心"; this.OnaddUser(null, addUserArgs); } else { CJia.PIVAS.Tools.Message.Show("密码必须一致!"); TxtNewPwd.Focus(); TxtNewPwd.SelectAll(); return; } } else { CJia.PIVAS.Tools.Message.Show("请填写确认密码,并且长度不能大于6位"); TxtSurePwd.Focus(); TxtSurePwd.SelectAll(); return; } } else { CJia.PIVAS.Tools.Message.Show("请填写密码,并且长度不能大于6位"); TxtNewPwd.Focus(); TxtNewPwd.SelectAll(); return; } }