コード例 #1
0
        public void insertRecord(Author_Ex a )
        {
            NpgsqlCMD = new NpgsqlCommand();
            NpgsqlCMD.CommandText = @"Insert into author_experiments (AUTHOR_ID, EX_ID, AUTHOR_RANK)
                                   VALUES (:authorID,  :exID, :rank)";

            NpgsqlCMD.Parameters.Add(new NpgsqlParameter("authorID", NpgsqlDbType.Integer));
            NpgsqlCMD.Parameters.Add(new NpgsqlParameter("exID", NpgsqlDbType.Integer));
            NpgsqlCMD.Parameters.Add(new NpgsqlParameter("rank", NpgsqlDbType.Integer));
            NpgsqlCMD.Parameters[0].Value = a.Author_ID;
            NpgsqlCMD.Parameters[1].Value = a.EX_ID;
            NpgsqlCMD.Parameters[2].Value = a.Rank;

            if(GlobalVariables.GlobalConnection.insertData(NpgsqlCMD))
                MessageBox.Show("Author has been added to this experiment.", "Author Added", MessageBoxButtons.OK, MessageBoxIcon.Information);
            else
                MessageBox.Show("Access has not been added to this experiment.", "Author Not Added", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }
コード例 #2
0
        public DataSet getRecord(Author_Ex a)
        {
            NpgsqlCMD = new NpgsqlCommand();
            NpgsqlCMD.CommandText = "Select * from author_experiments Where EX_ID = :exID and AUTHOR_ID = :authID";
            NpgsqlCMD.Parameters.Add(new NpgsqlParameter("exID", NpgsqlDbType.Integer));
            NpgsqlCMD.Parameters.Add(new NpgsqlParameter("authID", NpgsqlDbType.Integer));
            NpgsqlCMD.Parameters[0].Value = a.EX_ID;
            NpgsqlCMD.Parameters[1].Value = a.Author_ID;

            DataSet ds = new DataSet();
            ds = GlobalVariables.GlobalConnection.readData(NpgsqlCMD);
            if (ds != null)
            {
                return ds;
            }
            else
                return null;
        }
コード例 #3
0
        public void updateRecord(Author_Ex a)
        {
            NpgsqlCMD = new NpgsqlCommand();
            NpgsqlCMD.CommandText = @"Update author_experiments
                                 Set AUTHOR_ID = :authID,
                                 EX_ID  = :exID
                                 AUTHOR_RANK  = :rank";

            NpgsqlCMD.Parameters.Add(new NpgsqlParameter("authID", NpgsqlDbType.Integer));
            NpgsqlCMD.Parameters.Add(new NpgsqlParameter("exID", NpgsqlDbType.Integer));
            NpgsqlCMD.Parameters.Add(new NpgsqlParameter("rank", NpgsqlDbType.Integer));
            NpgsqlCMD.Parameters[0].Value = a.Author_ID;
            NpgsqlCMD.Parameters[1].Value = a.EX_ID;
            NpgsqlCMD.Parameters[2].Value = a.Rank;

            if(GlobalVariables.GlobalConnection.updateData(NpgsqlCMD))
                MessageBox.Show("Author has been updated for this experiment.", "Author Updated", MessageBoxButtons.OK, MessageBoxIcon.Information);
            else
                MessageBox.Show("Access has not been updated for this experiment.", "Author Not Updated", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }
コード例 #4
0
        public void deleteRecord(Author_Ex A)
        {
            NpgsqlCMD = new NpgsqlCommand();

            DialogResult mResult = MessageBox.Show("Are you sure you wish to permantely delete this record?", "Delete Record Warning!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
            if (mResult == DialogResult.Yes)
            {
                NpgsqlCMD.CommandText = "Delete from author_experiments where AUTHOR_ID = :authID and  EX_ID = :exID";
                NpgsqlCMD.Parameters.Add(new NpgsqlParameter("authID", NpgsqlDbType.Integer));
                NpgsqlCMD.Parameters.Add(new NpgsqlParameter("exID", NpgsqlDbType.Integer));
                NpgsqlCMD.Parameters[0].Value = A.Author_ID;
                NpgsqlCMD.Parameters[1].Value = A.EX_ID;

                if(GlobalVariables.GlobalConnection.deleteData(NpgsqlCMD))
                    MessageBox.Show("Author has been deleted from experiment.", "Author Deleted", MessageBoxButtons.OK, MessageBoxIcon.Information);
                else
                    MessageBox.Show("Access has not been deleted from experiment .", "Author Not Deleted", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
                MessageBox.Show("Delete process has been cancelled.", "Delete Cancelled", MessageBoxButtons.OK, MessageBoxIcon.Information);

        }
コード例 #5
0
        private void btnAddExp_Click(object sender, EventArgs e)
        {
            Author_Ex rec = new Author_Ex();
            rec.Author_ID = Convert.ToInt32(cbLName.SelectedValue.ToString());
            rec.EX_ID = intExID;
            rec.Rank = 99;

            _authorsEX.insertRecord(rec);
            bHasChanged = true;
        }