private void btnAdd_Click(object sender, EventArgs e)
 {
     ServiceNoteEdit svcNoteEdit = new ServiceNoteEdit();
     svcNoteEdit.EditCompletedHandler += FormServiceNoteEdit_Completed;
     svcNoteEdit.ShowDialog();
 }
        private void btnEdit_Click(object sender, EventArgs e)
        {
            if (txtId.Text == string.Empty)
            {
                MessageBox.Show("You don't choose a service note to " + btnEdit.Text + "!", "Infomations", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                ServiceNote svcn = new ServiceNote()
                {
                    Id = txtId.Text.Trim(),
                    Date = dateTimePickerDate.Text,
                    Conntractid = (cmbContractId.SelectedValue == null) ? "" : cmbContractId.SelectedValue.ToString(),
                    Total = decimal.Parse(txtTotalMoney.Text.Trim() == "" ? "0" : txtTotalMoney.Text.Trim())
                };

                ServiceNoteEdit serviceNoteEdit = new ServiceNoteEdit(svcn, (cmbRoomName.SelectedValue == null) ? "" : cmbRoomName.SelectedValue.ToString(), btnEdit.Text=="Edit"?true:false);
                if(btnEdit.Text=="Edit")
                    serviceNoteEdit.EditCompletedHandler += FormServiceNoteEdit_Completed;
                serviceNoteEdit.ShowDialog();
            }
        }
Пример #3
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            if (txtId.Text == string.Empty)
            {
                MessageBox.Show("You don't choose a service note to edit!", "Infomations", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                ServiceNote svcn = new ServiceNote()
                {
                    Id = txtId.Text,
                    Date = dateTimePickerDate.Text,
                    Conntractid=cmbContractId.SelectedText,
                    RoomName = cmbRoomName.SelectedText,
                    Total = decimal.Parse(txtTotalMoney.Text.Trim())
                };

                ServiceNoteEdit serviceNoteEdit = new ServiceNoteEdit(svcn);
                serviceNoteEdit.EditCompletedHandler += FormServiceNoteEdit_Completed;
                serviceNoteEdit.ShowDialog();
            }
        }