Beispiel #1
0
        private void butLuu_Click(object sender, System.EventArgs e)
        {
            if (!kiemtra())
            {
                return;
            }
            l_id = d.get_id_donthuoc_bacsy(mabs.Text, ma.Text);
            if (l_id == 0)
            {
                l_id = d.get_id_donthuoc_bacsy();
            }
            else
            {
                d.execute_data("delete from " + user + ".d_theodonct where id=" + l_id);
            }
            d.upd_theodonll(l_id, mabs.Text, ma.Text, ghichu.Text, 0, dt.Rows.Count, 1);
            foreach (DataRow r in dt.Rows)
            {
                d.upd_theodonct(l_id, int.Parse(r["mabd"].ToString()), decimal.Parse(r["soluong"].ToString()), r["cachdung"].ToString(), int.Parse(r["stt"].ToString()), 0);
            }
            ena_object(false);
            decimal id    = l_id;
            string  _mabs = mabs.Text;

            load_head();
            lmabs.SelectedValue = _mabs;
            load_maicd();
            lmaicd.SelectedValue = id.ToString();
            l_id = id;
            load_chitiet();
        }
Beispiel #2
0
        private void butLuu_Click(object sender, System.EventArgs e)
        {
            if (!kiemtra())
            {
                return;
            }
            if (l_id == 0)
            {
                l_id = decimal.Parse(d.i_Chinhanh_hientai.ToString() + d.get_id_donthuoc_bacsy().ToString());
            }
            else
            {
                d.execute_data("delete from " + user + ".d_theodonct where id=" + l_id);
            }
            d.upd_theodonll(l_id, "", "", mabs.Text, -1, dt.Rows.Count, 1);
            dt.AcceptChanges();
            foreach (DataRow r in dt.Rows)
            {
                DataRow r_dt = m.getrowbyid(dtdoituong, "doituong='" + r["doituong"] + "'");
                r["madoituong"] = r_dt["madoituong"].ToString();
                d.upd_theodonct(l_id, int.Parse(r["mabd"].ToString()), decimal.Parse(r["soluong"].ToString()), r["cachdung"].ToString(), int.Parse(r["stt"].ToString()), int.Parse(r["madoituong"].ToString()));
            }
            ena_object(false);
            decimal id = l_id;

            load_head();
            lmabs.SelectedValue = id;
            l_id = id;
            load_chitiet();
        }