public frmChonphieucstt(LibDuoc.AccessData acc, string _makp, string _makho) { InitializeComponent(); d = acc; s_makho = _makho; s_makp = _makp; }
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(); } }
private void dataGrid1_CurrentCellChanged(object sender, EventArgs e) { d = new LibDuoc.AccessData(); string mmyy = txtThang.Value.ToString().PadLeft(2, '0') + txtNam.Value.ToString().Substring(2); if (d.bMmyy(mmyy)) { string user = d.user; string d_user = user + mmyy; //string file = "d_dutrull"; string sql = ""; switch (dataGrid1[dataGrid1.CurrentRowIndex, 1].ToString()) { case "2": sql = "select distinct to_char(a.ngay,'dd/mm/yyyy') as ngay,b.ten as tenphieu from xxx.d_xuatsdll a," + user + ".d_loaiphieu b,xxx.d_bucstt c where a.id=c.id and a.phieu=b.id and a.idduyet in(select id from " + d_user + ".d_xtutrucll where idduyet in(select id from " + d_user + ".d_duyet where id =" + dataGrid1[dataGrid1.CurrentRowIndex, 0].ToString() + "))"; break; case "3": sql = "select distinct to_char(a.ngay,'dd/mm/yyyy') as ngay,b.ten as tenphieu from xxx.d_xuatsdll a," + user + ".d_loaiphieu b where a.phieu=b.id and a.idduyet in(select id from " + d_user + ".d_hoantrall where idduyet in(select id from " + d_user + ".d_duyet where id =" + dataGrid1[dataGrid1.CurrentRowIndex, 0].ToString() + "))"; break; case "4": sql = "select distinct to_char(a.ngay,'dd/mm/yyyy') as ngay,b.ten as tenphieu from xxx.d_xuatsdll a," + user + ".d_loaiphieu b where a.phieu=b.id and a.idduyet in(select id from " + d_user + ".d_haophill where idduyet in(select id from " + d_user + ".d_duyet where id =" + dataGrid1[dataGrid1.CurrentRowIndex, 0].ToString() + "))"; break; default: sql = "select distinct to_char(a.ngay,'dd/mm/yyyy') as ngay,b.ten as tenphieu from xxx.d_xuatsdll a," + user + ".d_loaiphieu b where a.phieu=b.id and a.idduyet in(select id from " + d_user + ".d_dutrull where idduyet in(select id from " + d_user + ".d_duyet where id =" + dataGrid1[dataGrid1.CurrentRowIndex, 0].ToString() + "))"; break; } ; dslinh = d.get_data_mmyy(sql, txtTungay.Text, txtDenngay.Text, true); dataGrid2.DataSource = dslinh.Tables[0]; } }
public frmDuyetdutrukho(LibDuoc.AccessData acc, int userid, string ngaydangnhap, int _id_chinhanh) { InitializeComponent(); d = acc; i_userid = userid; s_ngaydangnhap = ngaydangnhap; i_id_chinhanh = _id_chinhanh; }
public frmTTBkhoaphong(LibDuoc.AccessData acc, string tab, string title, int nhom, string mmyy) { InitializeComponent(); base.acc = acc; base.table_name = tab; base.Nhomkho = nhom; base.MMYY = mmyy; base.Text = title; base.init(); }
public frmDuyetdutru(LibDuoc.AccessData acc, int userid, int _id_chinhanh) { InitializeComponent(); d = acc; //format_soluong = d.format_soluong; user = d.user; i_userid = userid; i_id_chinhanh = _id_chinhanh; lan = new Language(); dtct = new DataTable("Table"); }
public frmdmmaubc(LibDuoc.AccessData acc, int loai, int tonghop, string maloai) { InitializeComponent(); // Language lan = new Language(); Bogotiengviet tv = new Bogotiengviet(); private System.Windows.Forms.TextBox textBox111 = new System.Windows.Forms.TextBox(); lan.Read_Language_to_Xml(this.Name.ToString(), this); lan.Changelanguage_to_English(this.Name.ToString(), this); m = acc; i_loai = loai; i_tonghop = tonghop; s_maloai = maloai; }
public frmCosottDuyet(LibDuoc.AccessData acc, int userid, string _makho, string _makhoa) { InitializeComponent(); d = acc; //format_soluong = d.format_soluong; user = d.user; i_userid = userid; lan = new Language(); dtct = new DataTable("Table"); s_makho = _makho; s_makp = _makhoa; }
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { try { LibDuoc.AccessData ac = new LibDuoc.AccessData(); backgroundWorker1.ReportProgress(0, "Bắt đầu xử lý...."); using (Npgsql.NpgsqlCommand cmm = new Npgsql.NpgsqlCommand("select * from medibv.d_menuitem where id = '000' and id_goc ='901'", new Npgsql.NpgsqlConnection(ac.ConStr))) { try { cmm.Connection.Open(); if (cmm.ExecuteReader().HasRows) { cmm.CommandText = "UPDATE medibv.d_menuitem SET id='23400', id_menu='23400' WHERE id = '000' and id_goc ='901'"; cmm.ExecuteNonQuery(); cmm.CommandText = "select id,userid,right_ from medibv.d_dlogin"; Npgsql.NpgsqlDataAdapter apd = new Npgsql.NpgsqlDataAdapter(cmm); DataTable ls_user = new DataTable(); apd.Fill(ls_user); Npgsql.NpgsqlTransaction T = cmm.Connection.BeginTransaction(); foreach (DataRow dtr in ls_user.Rows) { string right = dtr["right_"].ToString(); if (right.Contains("+000")) { right = right.Replace("+000", "+23400"); string upd = "UPDATE medibv.d_dlogin set right_='" + right + "' where id='" + dtr["id"].ToString() + "'"; cmm.CommandText = upd; cmm.ExecuteNonQuery(); } } T.Commit(); backgroundWorker1.ReportProgress(100, "Hoàn thành."); e.Result = true; } } catch { } finally { cmm.Connection.Close(); } } } catch { MessageBox.Show("Không kết nối được với cơ sở dữ liệu!. \nHãy thử copy tool và các file dll vào thư mục chứa chương trình Dược và chạy lại.", "Lỗi"); } }
private void butXem_Click(object sender, EventArgs e) { d = new LibDuoc.AccessData(); string mmyy = txtThang.Value.ToString().PadLeft(2, '0') + txtNam.Value.ToString().Substring(2); if (d.bMmyy(mmyy)) { string user = d.user; string xxx = user + mmyy; string exp = " where a.makp=" + cboKhoa.SelectedValue.ToString() + " and to_date(to_char(a.ngay,'dd/mm/yyyy'),'dd/mm/yyyy') between to_date('" + txtTungay.Text + "','dd/mm/yyyy') and to_date('" + txtDenngay.Text + "','dd/mm/yyyy') "; string sql = "select distinct a.id,to_char(a.ngay,'dd/mm/yyyy') as ngay,b.ten as loaiphieu,c.ten as tenphieu,"; sql += " case when a.done=0 then 'x' else '' end as chuachuyen,"; sql += " case when a.done=1 then 'x' else '' end as chuyen,"; sql += " case when a.done=2 then 'x' else '' end as duyet,a.loai,d.hoten "; sql += " from " + xxx + ".d_duyet a inner join " + xxx + ".d_dutrull a1 on a.id=a1.idduyet inner join " + user + ".d_dmphieu b on a.loai=b.id "; sql += " inner join " + user + ".d_loaiphieu c on a.phieu=c.id "; sql += " left join " + user + ".dlogin d on a.userid=d.id "; sql += exp; sql += " union all "; sql += "select distinct a.id,to_char(a.ngay,'dd/mm/yyyy') as ngay,b.ten as loaiphieu,c.ten as tenphieu,"; sql += " case when a.done=0 then 'x' else '' end as chuachuyen,"; sql += " case when a.done=1 then 'x' else '' end as chuyen,"; sql += " case when a.done=2 then 'x' else '' end as duyet,a.loai,d.hoten "; sql += " from " + xxx + ".d_duyet a inner join " + xxx + ".d_xtutrucll a1 on a.id=a1.idduyet inner join " + user + ".d_dmphieu b on a.loai=b.id "; sql += " inner join " + user + ".d_loaiphieu c on a.phieu=c.id "; sql += " left join " + user + ".dlogin d on a.userid=d.id "; sql += exp; sql += " union all "; sql += "select distinct a.id,to_char(a.ngay,'dd/mm/yyyy') as ngay,b.ten as loaiphieu,c.ten as tenphieu,"; sql += " case when a.done=0 then 'x' else '' end as chuachuyen,"; sql += " case when a.done=1 then 'x' else '' end as chuyen,"; sql += " case when a.done=2 then 'x' else '' end as duyet,a.loai,d.hoten "; sql += " from " + xxx + ".d_duyet a inner join " + xxx + ".d_hoantrall a1 on a.id=a1.idduyet inner join " + user + ".d_dmphieu b on a.loai=b.id "; sql += " inner join " + user + ".d_loaiphieu c on a.phieu=c.id "; sql += " left join " + user + ".dlogin d on a.userid=d.id "; sql += exp; sql += " union all "; sql += "select distinct a.id,to_char(a.ngay,'dd/mm/yyyy') as ngay,b.ten as loaiphieu,c.ten as tenphieu,"; sql += " case when a.done=0 then 'x' else '' end as chuachuyen,"; sql += " case when a.done=1 then 'x' else '' end as chuyen,"; sql += " case when a.done=2 then 'x' else '' end as duyet,a.loai,d.hoten "; sql += " from " + xxx + ".d_duyet a inner join " + xxx + ".d_haophill a1 on a.id=a1.idduyet inner join " + user + ".d_dmphieu b on a.loai=b.id "; sql += " inner join " + user + ".d_loaiphieu c on a.phieu=c.id "; sql += " left join " + user + ".dlogin d on a.userid=d.id "; sql += exp; dsdutru = d.get_data(sql); dataGrid1.DataSource = dsdutru.Tables[0]; } }
private void frmDanhsachdutru_Load(object sender, EventArgs e) { d = new LibDuoc.AccessData(); cboKhoa.DisplayMember = "TEN"; cboKhoa.ValueMember = "ID"; string sql = "select id,ten from " + d.user + ".d_duockp"; if (s_makp != "") { sql += " where makp in ('" + s_makp.Replace(",", "','") + "')"; } sql += " order by ten"; cboKhoa.DataSource = d.get_data(sql).Tables[0]; txtThang.Value = (decimal)DateTime.Now.Month; txtNam.Value = (decimal)DateTime.Now.Year; dsdutru = d.get_data("select 0 as id,'' as ngay,'' as loaiphieu,'' as tenphieu").Clone(); dslinh = d.get_data("select '' as ngay,'' as tenphieu").Clone(); AddGridTableStyle(); AddGridTableStyle2(); this.WindowState = FormWindowState.Maximized; }
private void mnuDuyetdonBHYT_Click(object sender, EventArgs e) { if (IsLoaded("frmDuyetbhyt")) { return; } int d_userid = int.Parse(m_userid) * -1; intsert_uservp_duoc(int.Parse(m_userid)); LibDuoc.AccessData d = new LibDuoc.AccessData(); DataTable dtdon = new DataTable(); int i_nhomkho = m_v.nhom_duoc; frmChonkho f = new frmChonkho(d, i_nhomkho, m_v.mmyy(m_v.ngayhienhanh_server.Substring(0, 10))); f.ShowDialog(); if (f.i_makho > 0) { frmDuyetbhyt f1 = new frmDuyetbhyt(d, i_nhomkho, f.i_makho.ToString(), "", f.s_ngay, d_userid, f.mmyy, true, 1, 3, true, "", true, 0); f1.MdiParent = this; f1.Show(); } }
private void mnuDuyetdonBanle_Click(object sender, EventArgs e) { if (IsLoaded("frmXuatban")) { return; } LibDuoc.AccessData d = new LibDuoc.AccessData(); intsert_uservp_duoc(int.Parse(m_userid)); int d_userid = int.Parse(m_userid) * -1; int i_loai = 7; int i_nhomkho = m_v.nhom_nhathuoc; string s_ngay = m_v.Ngaygio_hienhanh.Substring(0, 10), s_kho = d.get_dmkho(i_loai), s_loaint = ""; string s_mmyy = m_v.mmyy(s_ngay); frmChonkhoxb f = new frmChonkhoxb(d, i_nhomkho, s_kho, s_kho + ",", s_mmyy, s_ngay, "Quầy", true, s_loaint); f.ShowDialog(this); if (f.i_makho > 0) { frmDuyetdon f1 = new frmDuyetdon(d, i_nhomkho, s_kho, s_ngay, d_userid, s_mmyy, f.i_quaythu, s_kho, "", m_userid, "", ""); f1.MdiParent = this; f1.Show(); } }
public frmChonthongso(LibDuoc.AccessData acc) { InitializeComponent(); d = acc; }
public frmdmmaubc(LibDuoc.AccessData acc, string maloai) { InitializeComponent(); m = acc; s_maloai = maloai; }
public frmdmmaubc(LibDuoc.AccessData acc) { InitializeComponent(); m = acc; }