Esempio n. 1
0
        private void f_caplai_mabd(int i_nhom)
        {
            string user = m.user;

            LibDuoc.AccessData d   = new LibDuoc.AccessData();
            string             sql = "update " + user + ".d_dmbd set ma='000000' where nhom=" + i_nhom;// +" and ma='BAN001'";

            d.execute_data(sql);
            sql = "select id, ma, ten from " + user + ".d_dmbd where nhom=" + i_nhom + " order by ten, id ";//+" and ma='000000'
            DataSet lds  = m.get_data(sql);
            string  s_ma = "";
            int     i1   = lds.Tables[0].Rows.Count;
            int     i2   = 0;

            foreach (DataRow r in lds.Tables[0].Rows)
            {
                s_ma = d.getMabd("d_dmbd", r["ten"].ToString(), i_nhom);
                sql  = "update " + user + ".d_dmbd set ma='" + s_ma + "' where id=" + r["id"].ToString();
                d.execute_data(sql);
                i2        += 1;
                lblma.Text = s_ma;
                lblma.Refresh();
                lblten.Text = r["ten"].ToString() + " - " + i2.ToString() + "/" + i1.ToString();
                lblten.Refresh();
            }
        }
Esempio n. 2
0
 private void butHuy_Click(object sender, System.EventArgs e)
 {
     //if (dt.Rows.Count==1)
     //{
     //    MessageBox.Show("Không cho phép hủy ?",ttb.Msg);
     //    return;
     //}
     try
     {
         if (ttb.get_data("select * from " + user + ".ttb_dmkho where nhom=" + decimal.Parse(dataGrid1[dataGrid1.CurrentCell.RowNumber, 3].ToString())).Tables[0].Rows.Count != 0)
         {
             MessageBox.Show("Nội dung đang sử dụng không cho phép hủy !", ttb.Msg);
             return;
         }
     }
     catch {}
     if (MessageBox.Show("Đồng ý hủy thông tin này !", ttb.Msg, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         l_id = decimal.Parse(dataGrid1[dataGrid1.CurrentCell.RowNumber, 3].ToString());
         ttb.upd_eve_tables(itable, i_userid, "del");
         ttb.upd_eve_upd_del(itable, i_userid, "del", ttb.fields(user + ".ttb_dmnhomkho", "id=" + l_id));
         //ttb.execute_data("delete from "+user+".ttb_dmnhomkho where id="+l_id);
         ttb.execute_data("delete from " + user + ".ttb_dmnhomkho where id=-2");
         try
         {
             d.execute_data("delete from " + d.user + ".d_dmnhomkho where id=-2");
         }
         catch { }
         load_grid();
     }
 }
Esempio n. 3
0
 private void butHuy_Click(object sender, System.EventArgs e)
 {
     if (b_admin == false)
     {
         MessageBox.Show(lan.Change_language_MessageText("Bạn chưa được quyền hủy danh mục này, liên hệ với người quản trị."));
         return;
     }
     if (l_id <= 0)
     {
         return;
     }
     if (MessageBox.Show(lan.Change_language_MessageText("Đồng ý hủy?"), lan.Change_language_MessageText("Thông báo"), MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
     {
         sql = "delete from " + m.user + ".bhyt_maubaocao where id=" + l_id;
         m.execute_data(sql);
         loadgrid(s_maloai);
         dataGrid1.Refresh();
     }
     ena_object(false);
 }
Esempio n. 4
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();
            }
        }
Esempio n. 5
0
 private void butTao_Click(object sender, EventArgs e)
 {
     m.execute_data("create table " + user + ".anhxa(ma_medisoft numeric(7) ,ma_benhvien numeric(7),loai varchar(50),constraint pk_anhxa primary key(ma_medisoft,ma_benhvien,loai))");
     m.execute_data("alter table " + user + ".anhxa modify (ma_benhvien numeric(7),ma_medisoft numeric(7))");
     dtdm = m.get_data("select * from " + user + ".anhxa where loai='" + cboSolieu.Tag.ToString() + "'").Tables[0];
 }