Example #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            bool result;

            Objects.ObjectData data = new Objects.ObjectData()
            {
                ticketNumber = txtTicket.Text,
                activity     = cmbActivity.Text,
                objectName   = txtObject.Text,
                comments     = rtbComments.Text
            };
            if (newRecord)
            {
                // Insert
                data.id = 0;
                result  = objects.Insert(data);
            }
            else
            {
                // Update
                data.id = currentRecordId;
                result  = objects.Update(data);
            }
            if (Objects.LastMessage.Length > 75)
            {
                toolStripStatusLabel1.Text = Objects.LastMessage.Substring(0, 75);
            }
            else
            {
                toolStripStatusLabel1.Text = Objects.LastMessage;
            }
        }
Example #2
0
        private void dgvObjects_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex == -1)
            {
                return;
            }
            DataRowView rowView = (DataRowView)dgvObjects.Rows[e.RowIndex].DataBoundItem;

            if (rowView == null)
            {
                return;
            }
            Objects.ObjectData data = new Objects.ObjectData
            {
                id           = Convert.ToInt32(rowView.Row["ID"]),
                ticketNumber = rowView.Row["TicketNumber"].ToString(),
                objectName   = rowView.Row["ObjectName"].ToString(),
                activity     = rowView.Row["Activity"].ToString(),
                comments     = rowView.Row["Comments"].ToString()
            };

            newRecord = false;

            ShowUpdateTab(data);
        }
Example #3
0
        private void ShowUpdateTab(Objects.ObjectData data)
        {
            txtTicket.Text           = data.ticketNumber;
            txtObject.Text           = data.objectName;
            rtbComments.Text         = data.comments;
            cmbActivity.SelectedItem = data.activity;
            currentRecordId          = data.id;

            ShowUpdateTab();
        }
Example #4
0
        public ObjectForm(string ticketnr) : this()
        {
            ticketNumber = ticketnr;
            DataTable dt = objects.GetDataBasedOnTicketNumber(ticketnr);

            if (dt.Rows.Count > 0)
            {
                newRecord = false;
                // Display object details based on ticket number
                dgvObjects.DataSource = dt;
            }
            else
            {
                // New record. Show edit screen
                Objects.ObjectData data = new Objects.ObjectData()
                {
                    ticketNumber = ticketnr
                };
                newRecord = true;
                ShowUpdateTab(data);
            }
        }