Ejemplo n.º 1
0
 private void btnNEWER_Click(object sender, EventArgs e)
 {
     if (objSelectedReport != null && objSelectedReport.er_id > 0)
     {
         DialogResult dr = MessageBox.Show("Delete event??", "Confirm delete report", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
         if (dr == DialogResult.Yes)
         {
             // Update DB
             objSelectedReport.delete();
             // Reload Event list
             loadLinkedReport(objSelectedEvent.ee_id);
             btnNEWER.Text    = "NEW";
             btnUPDATEER.Text = "INSERT";
         }
     }
     else
     {
         if (btnNEWER.Text == "NEW")
         {
             btnNEWER.Text      = "CREATE LINK";
             btnUPDATEER.Text   = "INSERT";
             txt_er_uuid.Text   = "";
             txt_er_name.Text   = "";
             txt_er_sts.Checked = true;
             // Reload Event list
         }
         else
         {
             // create new report, and link to event
             objSelectedReport = new Eqpreport();
             objSelectedReport.er_reportname = txt_er_name.Text;
             objSelectedReport.er_uuid       = txt_er_uuid.Text;
             objSelectedReport.sts           = txt_er_sts.Checked == true ? 1 : 0;
             // Update DB
             objSelectedReport.insert();
             // link to event
             string query = "insert into linkevent2report values('" + objSelectedEvent.ee_id + "','" + objSelectedReport.er_id + "','1','1')";
             objSelectedReport.query(query);
             // create new report, and link to event
             btnNEWER.Text    = "NEW";
             btnUPDATEER.Text = "INSERT";
             // Reload report list
             loadLinkedReport(objSelectedEvent.ee_id);
             // reload combo list
             loadCbListreport();
             //
         }
     }
 }
Ejemplo n.º 2
0
        private void btnUPDATEER_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(txt_er_uuid.Text))
            {
                MessageBox.Show("Report ID empty", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txt_er_uuid.Focus();
                return;
            }
            if (string.IsNullOrWhiteSpace(txt_er_name.Text))
            {
                MessageBox.Show("Report name empty", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txt_er_name.Focus();
                return;
            }

            if (objSelectedReport != null && objSelectedReport.er_id > 0)
            {
                objSelectedReport.er_reportname = txt_er_name.Text;
                objSelectedReport.er_uuid       = txt_er_uuid.Text;
                objSelectedReport.sts           = txt_er_sts.Checked == true ? 1 : 0;
                // Update DB
                objSelectedReport.update();
                // Reload Event list
                loadLinkedReport(objSelectedEvent.ee_id);
            }
            else
            {
                objSelectedReport = new Eqpreport();
                objSelectedReport.er_reportname = txt_er_name.Text;
                objSelectedReport.er_uuid       = txt_er_uuid.Text;
                objSelectedReport.sts           = txt_ee_sts.Checked == true ? 1 : 0;
                // Update DB
                objSelectedReport.insert();
                // Reload report list
                loadLinkedReport(objSelectedEvent.ee_id);
                // reload combo list
                loadCbListreport();
                //
            }
            //
            //
        }