Example #1
0
        private void butLuu_Click(object sender, EventArgs e)
        {
            if (cboNhomkho.Visible && cboNhomkho.Enabled)
            {
                if (cboNhomkho.Items.Count == 0)
                {
                    MessageBox.Show(lan.Change_language_MessageText("Nhóm kho chưa được khai trong chương trình dược"));
                    return;
                }
                if (cboNhomkho.SelectedIndex == -1)
                {
                    MessageBox.Show(lan.Change_language_MessageText("Vui lòng chọn nhóm kho trang thiết bị"));
                    cboNhomkho.Focus();
                    SendKeys.Send("{F4}");
                    return;
                }
                m.upd_thongso((int)LibDuoc.AccessData.id_thongso.ID_NhomKhoTTB, cboNhomkho.SelectedValue.ToString());
                nhomkhoTTB         = int.Parse(cboNhomkho.SelectedValue.ToString());
                cboNhomkho.Enabled = false;
            }
            string strMamedisoft = lstNhomMedisoft.SelectedValue.ToString();

            m.execute_data("delete from " + user + ".anhxa where ma_medisoft=" + strMamedisoft + " and loai='" + cboSolieu.Tag.ToString() + "'");
            string strMabenhvien = "";

            for (int i = 0; i < chkNhomBV.Items.Count; i++)
            {
                if (chkNhomBV.GetItemChecked(i))
                {
                    strMabenhvien = dtbenhvien.Rows[i]["id"].ToString();
                    m.upd_anhxa(int.Parse(strMamedisoft), int.Parse(strMabenhvien), cboSolieu.Tag.ToString());
                }
            }
            dtdm = m.get_data("select * from " + user + ".anhxa where loai='" + cboSolieu.Tag.ToString() + "'").Tables[0];
        }
Example #2
0
        private void frmAbout_KeyDown(object sender, KeyEventArgs e)
        {
            string user = d.user, xxx = user + mmyy;

            if (e.KeyCode == Keys.F7)
            {
                string  sql = "select a.* from " + xxx + ".d_tutrucct a," + user + ".d_dmkho b," + xxx + ".d_theodoi t where a.makho=b.id and a.tondau<0 and a.stt=t.id and b.nhom=" + i_nhom + " order by a.makp,a.makho,t.manguon,a.mabd,a.stt";
                decimal sl  = 0;
                foreach (DataRow r in d.get_data(sql).Tables[0].Rows)
                {
                    sl   = decimal.Parse(r["tondau"].ToString());
                    sql  = "select a.* from " + xxx + ".d_tutrucct a," + xxx + ".d_theodoi t where a.stt=t.id and a.mabd=" + decimal.Parse(r["mabd"].ToString()) + " and a.makp=" + decimal.Parse(r["makp"].ToString());
                    sql += " and a.makho=" + decimal.Parse(r["makho"].ToString()) + " and t.manguon=" + decimal.Parse(r["manguon"].ToString());
                    sql += " and a.tondau>=" + Math.Abs(sl) + " and a.tondau+a.slnhap-a.slxuat>=" + Math.Abs(sl);
                    sql += " order by a.makp,a.makho,t.manguon,a.mabd,a.stt";
                    foreach (DataRow r1 in d.get_data(sql).Tables[0].Rows)
                    {
                        sql  = "update " + xxx + ".d_tutrucct set tondau=tondau+" + sl + " where mabd=" + decimal.Parse(r["mabd"].ToString());
                        sql += " and makp=" + decimal.Parse(r["makp"].ToString()) + " and stt=" + decimal.Parse(r1["stt"].ToString());
                        d.execute_data(sql);
                        sql  = "update " + xxx + ".d_tutrucct set tondau=0 where mabd=" + decimal.Parse(r["mabd"].ToString());
                        sql += " and makp=" + decimal.Parse(r["makp"].ToString()) + " and stt=" + decimal.Parse(r["stt"].ToString());
                        d.execute_data(sql);
                        break;
                    }
                }
                MessageBox.Show(lan.Change_language_MessageText("Đã kiểm tra lại tồn đầu tủ trực !"), d.Msg);
            }
            else if (e.KeyCode == Keys.F8)
            {
                kiemtra_nhap();
            }
            else if (e.KeyCode == Keys.F12)
            {
                if (!d.bMahoamatkhau)
                {
                    foreach (DataRow r in m.get_data("select * from " + user + ".d_dlogin").Tables[0].Rows)
                    {
                        try
                        {
                            d.execute_data("update " + user + ".d_dlogin set password_='" + m.encode(r["password_"].ToString()) + "' where id=" + decimal.Parse(r["id"].ToString()));
                        }
                        catch { }
                    }
                    d.upd_thongso(i_nhom, -13, "", "1");
                    MessageBox.Show(lan.Change_language_MessageText("Đã mã hóa mật khẩu !"), LibMedi.AccessData.Msg);
                }
                else
                {
                    MessageBox.Show(lan.Change_language_MessageText("Mật khẩu đã mã hóa !"), LibMedi.AccessData.Msg);
                }
            }
            else if (e.KeyCode == Keys.F11)
            {
                if (d.bMahoamatkhau)
                {
                    foreach (DataRow r in m.get_data("select * from " + user + ".d_dlogin").Tables[0].Rows)
                    {
                        try
                        {
                            d.execute_data("update " + user + ".d_dlogin set password_='" + m.decode(r["password_"].ToString()) + "' where id=" + decimal.Parse(r["id"].ToString()));
                        }
                        catch { }
                    }
                    d.execute_data("delete from " + user + ".d_thongso where id=-13");
                    MessageBox.Show(lan.Change_language_MessageText("Đã giải hóa mật khẩu !"), LibMedi.AccessData.Msg);
                }
                else
                {
                    MessageBox.Show(lan.Change_language_MessageText("Mật khẩu chưa mã hóa !"), LibMedi.AccessData.Msg);
                }
            }
            else if (e.KeyCode == Keys.L && e.Control && e.Alt && e.Shift)
            {
                frmRight_BV f = new frmRight_BV(d, tree, i_nhom);
                f.Show();
            }
        }