Пример #1
0
        private void butctthem_Click(object sender, EventArgs e)
        {
            if (l_muc == 0)
            {
                return;
            }
            frmChonchidinh_ct f = new frmChonchidinh_ct(m);

            f.ShowDialog();
            if (f.dt.Rows.Count > 0)
            {
                int stt = 1;
                if (dt4.Rows.Count > 0)
                {
                    stt = int.Parse(dt4.Rows[dt4.Rows.Count - 1]["stt"].ToString()) + 1;
                }
                DataRow r1;
                foreach (DataRow r in f.dt.Rows)
                {
                    r1 = m.getrowbyid(dtgia, "id=" + long.Parse(r["mavp"].ToString()));
                    if (r1 != null)
                    {
                        m.upd_ct_mucct(l_muc, long.Parse(r["mavp"].ToString()), stt++, decimal.Parse(r["dongia"].ToString()), decimal.Parse(r["vattu"].ToString()), r1["ghichu"].ToString());
                    }
                }
                load_mucct();
            }
        }
Пример #2
0
        private void butPs_Click(object sender, EventArgs e)
        {
            if (mabn.Text == "" || hoten.Text == "")
            {
                return;
            }
            frmChonchidinh_ct f = new frmChonchidinh_ct(m);

            f.ShowDialog();
            if (f.dt.Rows.Count > 0)
            {
                int stt = 1;
                if (ds.Tables[0].Rows.Count > 0)
                {
                    stt = int.Parse(ds.Tables[0].Rows[ds.Tables[0].Rows.Count - 1]["stt"].ToString()) + 1;
                }
                DataRow r1;
                foreach (DataRow r in f.dt.Rows)
                {
                    r1            = ds.Tables[0].NewRow();
                    r1["id"]      = l_id;
                    r1["stt"]     = stt++;
                    r1["mavp"]    = decimal.Parse(r["mavp"].ToString());
                    r1["ten"]     = r["ten"].ToString();
                    r1["dongia"]  = (i_loai == 0)?decimal.Parse(r["dongia"].ToString()): decimal.Parse(r["vattu"].ToString());
                    r1["ngoaihd"] = 0;
                    r1["lamthem"] = "";
                    r1["ketqua"]  = "";
                    r1["ghichu"]  = "";
                    ds.Tables[0].Rows.Add(r1);
                }
            }
        }