Exemple #1
0
        private void butLuu_Click(object sender, System.EventArgs e)
        {
            if (!kiemtra())
            {
                return;
            }

            if (l_id == 0)
            {
                try
                {
                    l_id = decimal.Parse(ttb.get_data("select max(id) from " + user + ".ttb_dmnhomkho").Tables[0].Rows[0][0].ToString()) + 1;
                }
                catch { l_id = 1; }
                ttb.upd_eve_tables(itable, i_userid, "ins");
            }
            else
            {
                ttb.upd_eve_tables(itable, i_userid, "upd");
                ttb.upd_eve_upd_del(itable, i_userid, "upd", ttb.fields(user + ".ttb_dmnhomkho", "id=" + l_id));
            }
            //if (!ttb.upd_dmnhomkho(l_id,ten.Text,int.Parse(nhomcc.SelectedValue.ToString()),int.Parse(stt.Value.ToString()),int.Parse(loai.SelectedValue.ToString())))

            //kho trang thiet bi mac dinh nhom kho = -2 ---Khuong 01/04/2011
            if (!ttb.upd_dmnhomkho(-2, ten.Text, int.Parse(nhomcc.SelectedValue.ToString()), int.Parse(stt.Value.ToString()), int.Parse(loai.SelectedValue.ToString())))
            {
                MessageBox.Show("Không cập nhật thông tin " + this.Text.Trim() + " !", ttb.Msg);
                return;
            }
            try
            {
                //stt_medi = int.Parse(d.get_data("select max(STT) from d_dmnhomkho ").Tables[0].Rows[0][0].ToString()) + 1;
                if (!d.upd_dmnhomkho(-2, ten.Text, int.Parse(nhomcc.SelectedValue.ToString()), stt_medi, int.Parse(loai.SelectedValue.ToString())))
                {
                    MessageBox.Show("Không cập nhật thông tin " + this.Text.Trim() + " !", ttb.Msg);
                    return;
                }
            }
            catch
            { }

            ttb.ins_thongso(Convert.ToInt16(l_id), 45);
            load_grid();
            ena_object(false);
        }