private void btnUrediSifru_Click(object sender, EventArgs e) { if (!Class.Registracija.dopustenoKreiranjeNovihDokumenta) { return; } if (dgv.RowCount > 0) { string broj = dgv.CurrentRow.Cells["Broj ponude"].Value.ToString(); if (this.MdiParent != null) { var mdiForm = this.MdiParent; mdiForm.IsMdiContainer = true; var childForm = new frmPonude(); childForm.broj_ponude_edit = broj; childForm.MdiParent = mdiForm; childForm.Dock = DockStyle.Fill; childForm.Show(); } else { if (MainForm == null && MainForm2 != null) { MainForm2.broj_ponude_edit = broj; MainForm2.Show(); } else { MainForm.broj_ponude_edit = broj; MainForm.Show(); } this.Close(); } } else { MessageBox.Show("Niste odabrali niti jednu stavku.", "Greška"); } }
private void simpleButton登录_Click(object sender, EventArgs e) { ConnDB conn = new ConnDB(); string strsql, password; password = Common.MD5Encrypt(textEditPsw.Text.ToString().Trim()); strsql = "select password,dept2 from cost_user where cname = '" + textEditName.Text.ToString().Trim() + "'"; if (textEditName.Text.ToString().Trim() != "" && textEditPsw.Text.ToString().Trim() != "") { DataSet ds = conn.ReturnDataSet(strsql); if (ds.Tables[0].Rows.Count>0) { if (password == ds.Tables[0].Rows[0][0].ToString()) { //MainForm2.ShowMe(); cname = textEditName.Text.ToString().Trim(); dept2 = ds.Tables[0].Rows[0][1].ToString().Trim(); MainForm2 frm = new MainForm2(); frm.Show(); // MainForm2.CheckRight(); this.Visible = false; } else { MessageBox.Show("密码不正确!"); } } else { MessageBox.Show("用户名不存在!"); } } else { MessageBox.Show("用户名或密码不能为空!"); } conn.Close(); }