Exemplo n.º 1
0
 private void btnUp_Click(object sender, EventArgs e)
 {
     try
     {
         string cmd;
         if (!dtAdj.Checked)
         {
             cmd = "INSERT INTO public.m_plan_updated(plan_id, plan_name, date_update, stt_id,"
                   + " date_adjusted, content, result_update, cmt)"
                   + "VALUES('" + pid + "','" + pname + "','" + DateTime.Now.ToString() + "','"
                   + numStt.Value.ToString() + "','" + dtAdj.Value.ToString() + "','"
                   + txtContent.Text + "','" + check + "','" + txtCmt.Text + "')";
         }
         else
         {
             cmd = "INSERT INTO public.m_plan_updated(plan_id, plan_name, date_update, stt_id,"
                   + " content, result_update, cmt)"
                   + "VALUES('" + pid + "','" + pname + "','" + DateTime.Now.ToString() + "','"
                   + numStt.Value.ToString() + "','" + txtContent.Text + "','"
                   + check + "','" + txtCmt.Text + "')";
         }
         sql.sqlExecuteNonQ(cmd);
         MessageBox.Show("Đã cập nhật!!");
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Exemplo n.º 2
0
        private void btnCre_Click(object sender, EventArgs e)
        {
            string cmd;

            try
            {
                if (txtPname.Text != "" && txtModel.Text != "")
                {
                    cmd = "insert into public.m_plan_created(plan_name, model, pic_id, date_create, date_original)"
                          + " values('" + txtPname.Text + "','" + txtModel.Text + "','" + txtPIC.Text + "','"
                          + dtCre.Text + "','" + dtOri.Text + "')";
                    sql.sqlExecuteNonQ(cmd);
                    MessageBox.Show("Đã tạo plan thành công!!!");
                }
                else
                {
                    MessageBox.Show("Tên và model không thể để trống!");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }