コード例 #1
0
        private void FrmInput_InputDataReady(object sender, InputDataReadyEventArgs e)
        {
            string searchTerm             = e.SearchString;
            List <LabRequestModel> models = GlobalConfig.Connection.SearchLabRequests(searchTerm.ToUpper());

            this.Show();
            switch (models.Count)
            {
            case 0:
                MessageBox.Show("No matching records found.");
                break;

            case 1:
                LabRequestModel model = models[0];;
                loadBoxes(model);
                cboMSO.Focus();
                displayAttachments();
                break;

            default:
                frmMultiSelect displayForm = new frmMultiSelect();

                displayForm.LabRequests = models;
                displayForm.Show();
                break;
            }
        }
コード例 #2
0
 private void loadBoxes(LabRequestModel model)
 {
     txtDescription.Text = model.Description;
     txtRemarks.Text     = model.Remarks;
     txtRequestID.Text   = model.LRID;
     dtpEnd.Value        = model.EndDate;
     dtpStart.Value      = model.StartDate;
     cboMSO.Text         = model.MSO;
     cboProduct.Text     = model.Product;
     txtID.Text          = model.ID.ToString();
 }
コード例 #3
0
        private LabRequestModel loadModel()
        {
            LabRequestModel model = new LabRequestModel();
            int             id    = 0;

            int.TryParse(txtID.Text, out id);
            model.ID          = id;
            model.Description = txtDescription.Text;
            model.EndDate     = dtpEnd.Value;
            model.LRID        = txtRequestID.Text;
            model.MSO         = cboMSO.Text;
            model.Product     = cboProduct.Text;
            model.Remarks     = txtRemarks.Text;
            model.StartDate   = dtpStart.Value;

            return(model);
        }
コード例 #4
0
        public void LabRequests_CRUD(LabRequestModel model, char action)
        {
            using (IDbConnection connection = new SqlConnection(GlobalConfig.ConnString(db)))
            {
                var p = new DynamicParameters();
                p.Add("@Action", action, DbType.String);
                p.Add("@ID", model.ID, DbType.Int32);
                p.Add("@LRID", model.LRID, DbType.String);
                p.Add("@MSO", model.MSO, DbType.String);
                p.Add("@Product", model.Product, DbType.String);
                p.Add("@StartDate", model.StartDate, DbType.DateTime);
                p.Add("@EndDate", model.EndDate, DbType.DateTime);
                p.Add("@Description", model.Description, DbType.String);
                p.Add("@Remarks", model.Remarks, DbType.String);

                connection.Execute("dbo.spLabRequest_CRUD", p,
                                   commandType: CommandType.StoredProcedure);
            }
        }
コード例 #5
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            LabRequestModel model = loadModel();

            switch (GV.MODE)
            {
            case Mode.LabRequestAdd:
                GlobalConfig.Connection.LabRequests_CRUD(model, 'C');
                MessageBox.Show(model.LRID + " saved.");
                break;

            case Mode.LabRequestEdit:
                GlobalConfig.Connection.LabRequests_CRUD(model, 'U');
                MessageBox.Show(model.LRID + " saved.");
                break;

            case Mode.LabRequestDelete:
                GlobalConfig.Connection.LabRequests_CRUD(model, 'D');
                break;

            default:
                break;
            }
        }
コード例 #6
0
        private void dgvResults_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            int           selectedRow = dgvResults.CurrentRow.Index;
            CustomerModel customer;

            switch (GV.MODE)
            {
            case Mode.New:
                break;

            case Mode.Edit:
            case Mode.DateRangeReport:
                AssignmentDisplayModel assignment = displayList[selectedRow];
                GV.ASSIGNMENTFORM.Assignment = retrieveList[selectedRow];
                GV.ASSIGNMENTFORM.BringToFront();
                break;

            case Mode.Undo:
                break;

            case Mode.CustomerSearch:
                customer = customerData[selectedRow];
                GV.ASSIGNMENTFORM.FillCustomerData(customer);
                GV.MODE = GV.PreviousMode;
                this.Close();
                break;

            case Mode.CustomerSearchMDI:
                customer = customerData[selectedRow];
                CallingForm.FillBoxes(customer);
                this.Close();
                break;

            // added this LD not sure....
            case Mode.DeleteCustomer:
                customer = customerData[selectedRow];
                CallingForm.FillBoxes(customer);
                this.Close();
                break;

            case Mode.LocationSearch:
                LocationModel location = locationData[selectedRow];
                GV.ASSIGNMENTFORM.FillLocationData(location);
                GV.MODE = GV.PreviousMode;
                this.Close();
                break;

            case Mode.SearchEscalation:
                ATEscalationsDisplayModel escalation = escalations[selectedRow];
                GV.ESCALATIONFORM.loadBoxes(escalation);
                GV.MODE = Mode.EditEscalation;
                break;

            case Mode.LabRequestEdit:
                LabRequestModel labRequest = labRequests[selectedRow];
                GV.LABREQUESTFORM.LabRequest = labRequest;
                break;

            case Mode.None:
                break;

            default:
                break;
            }
            //GV.MAINMENU.BringToFront();
            this.Close();
        }