示例#1
0
        private void metroGridListEvent_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            // LIST REPORT
            int index = e.RowIndex;

            if (!(index < 0))
            {
                DataGridViewRow row = metroGridLinkedEvent.Rows[index];
                objSelectedEvent   = new Eqpevent(row);
                txt_ee_uuid.Text   = objSelectedEvent.ee_uuid;
                txt_ee_name.Text   = objSelectedEvent.ee_eventname;
                txt_ee_sts.Checked = objSelectedEvent.sts == 1;
                //
                loadLinkedReport(objSelectedEvent.ee_id);
                btnDELETEEE.Text = "DELETE";
                btnUPDATEEE.Text = "UPDATE";
                //
            }
            else
            {
                metroGridLinkedReport.DataSource = null;
                btnDELETEEE.Text = "NEW";
                btnUPDATEEE.Text = "INSERT";
            }
        }
示例#2
0
 private void loadEvent()
 {
     metroGridLinkedEvent.DataSource = Eqpevent.loadDt("select * from eqpevent where sts<>3");
     metroGridLinkedEvent.Columns["ee_id"].Visible  = false;
     metroGridLinkedEvent.Columns["eqp_id"].Visible = false;
     metroGridLinkedEvent.AutoResizeColumns();
     metroGridLinkedReport.DataSource   = null;
     metroGridlinkedVariable.DataSource = null;
 }
示例#3
0
        public static List <Eqpevent> load(string query)
        {
            List <Eqpevent> list = new List <Eqpevent>();
            MySqlDataReader rd   = null;

            try
            {
                MySqlConnection conn = Main.getConnection();
                if (conn == null)
                {
                    return(list);
                }
                if (query == null || query.Length == 0)
                {
                    query = "select * from eqpevent";
                }
                Log.Info("Query: " + query);
                MySqlCommand cmd = new MySqlCommand(query, conn);

                rd = cmd.ExecuteReader();

                while (rd.Read())
                {
                    Eqpevent obj = new Eqpevent();
                    obj.ee_id        = Convert.ToInt32(rd["ee_id"].ToString()); // Primary
                    obj.eqp_id       = Convert.ToInt32(rd["eqp_id"].ToString());
                    obj.ee_uuid      = rd["ee_uuid"].ToString();
                    obj.ee_eventname = rd["ee_eventname"].ToString();
                    obj.typ          = Convert.ToInt32(rd["typ"].ToString());
                    obj.sts          = Convert.ToInt32(rd["sts"].ToString());
                    list.Add(obj);
                }
                rd.Close();
            }
            catch (MySqlException e)
            {
                Log.Error("Error: " + e.Message);
            }
            finally
            {
                if (rd != null)
                {
                    rd.Close();
                }
            }
            return(list);
        }
示例#4
0
        public static Eqpevent loadUUID(string uuid)
        {
            MySqlDataReader rd = null;

            try
            {
                MySqlConnection conn = Main.getConnection();
                if (conn == null)
                {
                    return(null);
                }
                string query = "select * from eqpevent where ee_uuid='" + uuid + "'";
                Log.Info("Query: " + query);
                MySqlCommand cmd = new MySqlCommand(query, conn);

                rd = cmd.ExecuteReader();
                Eqpevent obj = new Eqpevent();

                while (rd.Read())
                {
                    obj.ee_id        = Convert.ToInt32(rd["ee_id"].ToString()); // Primary
                    obj.eqp_id       = Convert.ToInt32(rd["eqp_id"].ToString());
                    obj.ee_uuid      = rd["ee_uuid"].ToString();
                    obj.ee_eventname = rd["ee_eventname"].ToString();
                    obj.typ          = Convert.ToInt32(rd["typ"].ToString());
                    obj.sts          = Convert.ToInt32(rd["sts"].ToString());
                    break;
                }
                rd.Close();

                return(obj);
            }
            catch (MySqlException e)
            {
                Log.Error("Query: " + e.Message);
            }
            finally
            {
                if (rd != null)
                {
                    rd.Close();
                }
            }

            return(null);
        }
示例#5
0
        private void metroGridLinkedEvent_Click(object sender, EventArgs e)
        {
            // LIST REPORT
            if (metroGridLinkedEvent.SelectedRows.Count > 0)
            {
                DataGridViewRow row = metroGridLinkedEvent.SelectedRows[0];
                objSelectedEvent   = new Eqpevent(row);
                txt_ee_uuid.Text   = objSelectedEvent.ee_uuid;
                txt_ee_name.Text   = objSelectedEvent.ee_eventname;
                txt_ee_sts.Checked = objSelectedEvent.sts == 1;
                //
                loadLinkedReport(objSelectedEvent.ee_id);
                btnDELETEEE.Text = "DELETE";
                btnUPDATEEE.Text = "UPDATE";
                //
            }
            else
            {
                metroGridLinkedReport.DataSource = null;
                btnDELETEEE.Text = "NEW";
                btnUPDATEEE.Text = "INSERT";
            }

            /*
             * // LIST LINKED VARIABLE
             * if (metroGridLinkedEvent.SelectedRows.Count > 0)
             * {
             *  DataGridViewRow row = metroGridLinkedEvent.SelectedRows[0];
             *  objSelectedReport = new Eqpreport(row);
             *  //
             *  //
             *  txt_er_uuid.Text = objSelectedReport.er_uuid;
             *  txt_er_name.Text = objSelectedReport.er_reportname;
             *  txt_er_sts.Checked = objSelectedReport.sts == 1;
             *  //
             *  loadLinkedVariable(objSelectedReport.er_id);
             *  //
             *  btnNEWER.Text = "DELETE";
             *  btnUPDATEER.Text = "UPDATE";
             * }
             * else
             * {
             *  metroGridlinkedVariable.DataSource = null;
             * }
             */
        }
示例#6
0
        private void btnUPDATEEE_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(txt_ee_uuid.Text))
            {
                MessageBox.Show("Event ID empty", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txt_ee_uuid.Focus();
                return;
            }
            if (string.IsNullOrWhiteSpace(txt_ee_name.Text))
            {
                MessageBox.Show("Event Name empty", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txt_ee_name.Focus();
                return;
            }

            if (objSelectedEvent != null && objSelectedEvent.ee_id > 0)
            {
                objSelectedEvent.ee_eventname = txt_ee_name.Text;
                objSelectedEvent.ee_uuid      = txt_ee_uuid.Text;
                objSelectedEvent.sts          = txt_ee_sts.Checked == true ? 1 : 0;
                // Update DB
                objSelectedEvent.update();
                // Reload Event list
                loadEvent();
            }
            else
            {
                objSelectedEvent = new Eqpevent();
                objSelectedEvent.ee_eventname = txt_ee_name.Text;
                objSelectedEvent.ee_uuid      = txt_ee_uuid.Text;
                objSelectedEvent.sts          = txt_ee_sts.Checked == true ? 1 : 0;
                // Update DB
                objSelectedEvent.insert();
                // Reload Event list
                loadEvent();
            }
        }