private void btnlogin_Click(object sender, EventArgs e) { string GetRetPass = ""; try { var sqlcom = new SqlCommand("SELECT PASSWORD FROM USERLOGIN WHERE USERNAME='******'", new SqlConnection(UniCon)); sqlcom.Connection.Open(); SqlDataReader reader_ = reader_ = sqlcom.ExecuteReader(); while (reader_.Read()) { GetRetPass = reader_["password"].ToString(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } string GetPass = txtPass.Text; if (GetPass.Trim() == GetRetPass.Trim()) { this.Hide(); var mdi_ = new MdiParent(); mdi_.Show(); } else { MessageBox.Show("Incorrect Login..."); } }
private void doneProcess_Click(object sender, EventArgs e) { if (_pd.insertRow(patient)) { MessageBox.Show("Information Saved!"); completeStatus = true; initPatientEntity(); MdiParent.Close(); MainMDIForm obj = new MainMDIForm(doctor); obj.getPatient(_pe); obj.Show(); this.Hide(); } else { MessageBox.Show("Unseccessful Attempt!"); getAddress.Text = ""; getFullName.Text = ""; getGender.Text = ""; return; } }
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { Login login = new Login(); MdiParent.Hide(); login.Show(); }
protected override void OnClosed(EventArgs args) { if (MdiParent != null) { MdiParent.Focus(); } base.OnClosed(args); }
private void button4_Click(object sender, EventArgs e) { DialogResult dlgResult = MessageBox.Show("Are you sure you want to quit?", "Leave Archery Worx", MessageBoxButtons.YesNo); if (dlgResult == DialogResult.Yes) { MdiParent.Close(); } }
protected virtual void OnNcMouseMove(MouseEventArgs e) { if (this.WindowState == FormWindowState.Minimized && _lastForm != this) { _lastForm = this; Point pt = MdiParent.PointToScreen(this.Location); ShowWindowTip(pt, _lastSnapshot); } }
private void resizeAll1_Click(object sender, EventArgs e) { //LayoutMdi - располагает дочерние MDI-формы внутри родительской MDI-формы. MdiParent.LayoutMdi(MdiLayout.Cascade); foreach (Form2 f in MdiParent.MdiChildren) { f.resize1_Click(f, null); } }
/// <summary> /// Zatvara parent formu i tada otvara opet HELP. /// </summary> private void CloseOneOpenAnother() { MdiParent.Close(); frmHELP frm = new frmHELP(eng, true); frm.Show(); frm.TopMost = true; frm.Activate(); }
private void btnCancel_Click(object sender, EventArgs e) { if (MessageBox.Show("Are You Sure?", "Exit", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes) { MdiParent.Close(); } else { txtName.Clear(); txtPass.Clear(); txtName.Focus(); } }
private void bunifuCards2_MouseClick(object sender, MouseEventArgs e) { if (new SerieController().ListALL().Count > 0) { PDV.FrmPosPdv frm = new PDV.FrmPosPdv((Main)this.MdiParent); frm.Show(); MdiParent.Hide(); } else { MessageBox.Show("Cadastre uma serie no sistema"); } }
private void goTreatment_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count == 0) { return; } PatientEntity pe = dataGridView1.SelectedRows[0].DataBoundItem as PatientEntity; MessageBox.Show(pe.patientName + " is selected!"); MdiParent.Close(); MainMDIForm obj = new MainMDIForm(doctor); obj.getPatient(pe); obj.Show(); this.Hide(); }
private void frmProsesGiroMasukUpdate_FormClosing(object sender, FormClosingEventArgs e) { MdiParent.Activate(); }
private void exit1_Click(object sender, EventArgs e) { MdiParent.Close(); }
private void btnCikis_Click(object sender, EventArgs e) { MdiParent.Close(); }
private void BsiStatis_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { ((MainForm)MdiParent.FindForm()).ShowLogPanel(); }
/* CERRAR SESIÓN */ private void btnCerrarSesion_Click(object sender, EventArgs e) { MdiParent.Close(); }
private void bntSave_Click(object sender, EventArgs e) { //string _groupID = this.menuGroupIdBox.Text.ToString(); string _displayIndex = this.buttonPositionTextBox.Text.ToString(); string _description = this.menuGroupDescriptionTextBox.Text.ToString(); string _pictureLocation = this.menuGroupPictureLocation.Text.ToString(); string _color = this.txBoxColor.Text.ToString(); int _showCaption = (this.checkBox1.Checked) ? 1:0; int _hidden = (this.checkBox2.Checked) ? 1 : 0; //int _hidden = 0; // string _color = this.menuGroupDescriptionTextBox. implement color picker // string _color = this._color; //"not implemented"; // string _pictureLocation = this.menuGroupPictureLocation; MessageBox.Show( "_displayIndex-->" + _displayIndex + "_desc-->" + _description + "pictureLocation---->" + _pictureLocation + "_color-->" + _color + "hidden-->" + _hidden + "show caption-->" + _showCaption ); // get the values from this class //this.menuGroupIdBox.Text = _groupID; try { // bad case nothing to save or update if (this.menuGroupIdBox.Text.ToString() == "" && string.IsNullOrEmpty(this.menuGroupDescriptionTextBox.Text.ToString())) { MessageBox.Show("Add description "); menuGroupDescriptionTextBox.Focus(); } // new Insert or update if (!string.IsNullOrEmpty(this.menuGroupDescriptionTextBox.Text.ToString())) { MessageBox.Show("Now, add/update"); //menuGroupDescriptionTextBox.Focus(); string sqlCommand = "insert into menugroup" + " (ID, DisplayIndex,Description,Color,PictureLocation, ShowCaption, Hidden)" + "values (' " + _groupId + "', '" + _displayIndex + "', '" + _description + "', '" + _color + "', '" + _pictureLocation + "', '" + _showCaption + "', '" + _hidden + "')" + "ON DUPLICATE KEY UPDATE " + "ID = Values(ID) ," + "DisplayIndex = VALUES(DisplayIndex)," + "Description = VALUES(Description)," + "Color= VALUES(Color)," + "PictureLocation= VALUES(PictureLocation)," + "ShowCaption= VALUES(ShowCaption)," + " Hidden=VALUES(Hidden)"; DataAccess.ExecuteSQL(sqlCommand); //MessageBox.Show("description--->"+_description.ToString()); /* * this.Close(); * MdiParent.Refresh(); */ } // end new insert else { if (menuGroupDescriptionTextBox.Text == "000") { string sqlCmd = " insert into menugroup (Description,DisplayIndex) values ('" + menuGroupDescriptionTextBox.Text + "5' )"; DataAccess.ExecuteSQL(sqlCmd); menuGroupDescriptionTextBox.Text = ""; //lblMsg.Visible = true; //lblMsg.Text = MessageBox.Show("Successfully saved"); } /* * else //Update * { * string sqlUpdateCmd = " update tbl_category set category_name = '" + txtCategoryName.Text + "' where ID = '" + lblID.Text + "'"; * DataAccess.ExecuteSQL(sqlUpdateCmd); * // lblMsg.Visible = true; * // lblMsg.Text = "Successfully Updated"; * this.Hide(); * Items.Categories mkc = new Items.Categories(); * mkc.MdiParent = this.ParentForm; * mkc.Show(); * } */ } this.Close(); //MdiParent.con MdiParent.Refresh(); } catch (Exception exp) { MessageBox.Show("Sorry\r\n this id already added \n\n " + exp.Message); } }
/// <summary> /// This method is overridden to be able to capture the event raised upon /// dropping this form. Both dropping and resizing raise the same event. To desern /// between them the boolean switch 'inSizing' is available. The overridden /// 'OnSizeChanged' event is used to switch between a drop action and a size action. /// /// When the form is dropped, the new screenlocation of the mouse is accessed. When the /// form is dropped on a fixed size (hotLength) from the border, the form is docked to that /// border. /// </summary> /// <param name="m">The Window Message sent by Windows.</param> protected override void WndProc(ref Message m) { switch (m.Msg) { case (WM_EXITSIZEMOVE): // Are we dropping or done with resizing?? if (this.inSizing) { // Check if DockStyle = DockStyle.None, if so // remember the currentsize. if (Dock == DockStyle.None) { formSizeBeforeDock = this.Size; } // Convert mouseposition to position on hostForm. Point screenPoint = Cursor.Position; Point parentPoint = MdiParent.PointToClient(screenPoint); // Find the client rectangle of the form Size parentSize = MdiParent.ClientRectangle.Size; // Find new docking position if (parentPoint.X < hotLength) { Dock = DockStyle.Left; } else if (parentPoint.Y < hotLength) { Dock = DockStyle.Top; } else if (parentPoint.X >= (parentSize.Width - hotLength)) { Dock = DockStyle.Right; } else if (parentPoint.Y >= (parentSize.Height - hotLength)) { Dock = DockStyle.Bottom; } else { Dock = DockStyle.None; //this.Location = new Point(Cursor.Position.X - nonclientClickLocation.X,Cursor.Position.Y - nonclientClickLocation.Y); } ResizeForm(); } else { this.inSizing = false; } break; case (WM_SYSCOMMAND): if (m.WParam.ToInt32() == SC_MOVE) { this.Size = defaultSize; } break; /*case(WM_NCMOUSEMOVE): * Point pt = new Point( (int)m.LParam ); * if (this.Capture) * WriteToStatusbar(pt.ToString()); * break; * case(WM_MOVING): * if (this.Capture) * this.Size = formSizeBeforeDock; * break; * case(WM_NCLMOUSEDOWN): * Point mouseLocation = new Point( (int)m.LParam ); * Point formLocation = this.Location; * nonclientClickLocation = new Point(mouseLocation.X - formLocation.X, mouseLocation.Y - formLocation.Y); * break;*/ default: Console.WriteLine(m.ToString()); break; } ; base.WndProc(ref m); }
/// <summary> /// 執行登入動作 /// </summary> /// <returns>登入成功回傳True,否則回傳False</returns> public bool RunLogin() { if (CheckField()) { string UserID; string HashPwd; string encryptFormat;//加密格式設定 string RoleName = ""; encryptFormat = "SHA1"; UserID = txtUserID.Text; HashPwd = My.MyMethod.HashEncryption(encryptFormat, txtPwd.Text); SIS.DBClass.DBClsLogin DbLogin = new SIS.DBClass.DBClsLogin(); SIS.DBClass.DBClsWinAPEvents WAE = new SIS.DBClass.DBClsWinAPEvents(); bool VerifyResult = false; try { VerifyResult = DbLogin.VerifyPWD(UserID, HashPwd); if (VerifyResult == false) { My.ErrorType errType = new My.ErrorType(My.MainErrorType.LoginError); errType.loginError = new My.LoginError(); errType.loginError.AccountOrPasswordError = true; throw new My.MyExceptionHandler(errType); } } catch (My.MyExceptionHandler ex) { MessageBox.Show(ex.Message, "MyExceptionHandler"); return(false); } if (VerifyResult) { //MessageBox.Show("驗證成功"); //將登入結果寫入事件資料庫中 WAE.AddEventData(UserID, "資訊", "登入", "身分驗證成功"); RoleName = DbLogin.RoleIdToRoleName(UserID); My.MyGlobal.GlobalUserID = UserID; My.MyGlobal.GlobalPassword = txtPwd.Text; My.MyGlobal.GlobalHashPassword = HashPwd; My.MyGlobal.GlobalRoleName = RoleName; //執行登錄檔處理 if (RegistryProcess(UserID, RoleName)) { //執行使用者授權動作 if (AuthorityProcess(UserID, RoleName)) { return(true); } else { return(false); } } else { MessageBox.Show("登錄檔作業失敗!!", "Registry作業", MessageBoxButtons.OK, MessageBoxIcon.Warning); return(false); } } else { //MessageBox.Show("驗證失敗"); My.MyGlobal.GlobalLoginErrorCounter += 1; if (My.MyGlobal.GlobalLoginErrorCounter >= 3) { MessageBox.Show("[帳號]和[密碼]輸入錯誤超過三次!!,系統將強制關閉", "登入失敗", MessageBoxButtons.OK, MessageBoxIcon.Warning); My.MyGlobal.GlobalSystemShutdown = true; MdiParent.Close(); this.Close(); } //將登入失敗的結果寫入事件資料庫中 WAE.AddEventData(UserID, "警告", "登入", "身分驗證失敗"); MessageBox.Show("[帳號]和[密碼]錯誤!!", "登入失敗", MessageBoxButtons.OK, MessageBoxIcon.Warning); return(false); } } else { return(false); } }