Ejemplo n.º 1
0
 private void butLuu_Click(object sender, System.EventArgs e)
 {
     if (!kiemtra())
     {
         return;
     }
     if (i_id == 0)
     {
         try
         {
             i_id = int.Parse(ttb.get_data("select max(id) from " + user + "." + table).Tables[0].Rows[0][0].ToString()) + 1;
         }
         catch { i_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(m.user + ".d_duockp" + frmMain.link, "id=" + i_id));
     }
     if (matutruc.SelectedIndex != -1)
     {
         i_matutruc = int.Parse(matutruc.SelectedValue.ToString());
     }
     else
     {
         i_matutruc = 0;
     }
     if (!d.upd_duockp(i_id, ma.Text, ten.Text, s_nhomkho, int.Parse(stt.Value.ToString()), (makp.SelectedIndex == -1)?"":makp.SelectedValue.ToString(), s_makho, i_matutruc, nguoilinh.Text, computer.SelectedValue.ToString(), 0))
     {
         MessageBox.Show("Không cập nhật thông tin " + this.Text.Trim() + " !", ttb.Msg);
         return;
     }
     load_grid(chkAll.Checked);
     ena_object(false);
 }