Ejemplo n.º 1
0
        private void btnSearchDateRange_Click(object sender, EventArgs e)
        {
            DateTime startDate = dtpStartDateRange.Value;
            DateTime endDate   = dtpEndDateRange.Value;
            //Get all assignments in date range
            List <AssignmentTableModel> Assignments = GlobalConfig.Connection.DateRangeSearch_SortBy(startDate, endDate);
            frmMultiSelect DisplayForm = new frmMultiSelect();

            DisplayForm.AssignmentData = Assignments;
            DisplayForm.Show();
            DisplayForm.BringToFront();
            this.Close();
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            switch (GV.MODE)
            {
            case Mode.New:
                break;

            case Mode.Edit:
                break;

            case Mode.Undo:
                break;

            case Mode.CustomerSearch:
                break;

            case Mode.CustomerSearchMDI:
                break;

            case Mode.AddCustomer:
                break;

            case Mode.EditCustomer:
                break;

            case Mode.DeleteCustomer:
                break;

            case Mode.AddCustomerLocation:
                GlobalConfig.Connection.CustomerLocations_Get
                    ("", "Insert", 0, txtSiteName.Text, cboMSO.Text, txtAddress.Text, cboCity.Text, cboState.Text, cboCountry.Text, txtPostalCode.Text, cboRegion.Text, 0);
                GV.MODE         = Mode.EditCustomerLocation;
                btnSave.Visible = true;
                break;

            case Mode.EditCustomerLocation:
                btnSave.Visible = true;
                LocationModel location = new LocationModel();
                int           lid      = 0;
                int.TryParse(txtLocID.Text, out lid);
                location.ID         = lid;
                location.SiteName   = txtSiteName.Text;
                location.Address    = txtAddress.Text;
                location.City       = cboCity.Text;
                location.State      = cboState.Text;
                location.Country    = cboCountry.Text;
                location.PostalCode = txtPostalCode.Text;
                location.Region     = cboRegion.Text;
                GlobalConfig.Connection.CustomerLocations_Get
                    ("", "Update", lid, txtSiteName.Text, _location.MSO, txtAddress.Text, cboCity.Text, cboState.Text, cboCountry.Text, txtPostalCode.Text, cboRegion.Text, _location.ContactID);
                break;

            case Mode.DeleteCustomerLocation:
                GV.MODE = Mode.DeleteCustomerLocation;
//added search for deleting LD
                List <SearchTermModel> searchTermsDel = collectSearchTerms();
                string clauseDel = WhereClauseGenerator.MakeWhereClause(searchTermsDel);
                Locations = GlobalConfig.Connection.CustomerLocations_Get(clauseDel, "Select", 0, "", "", "", "", "", "", "", "", 0);
                frmMultiSelect locationFormDel = new frmMultiSelect();
                locationFormDel.LocationData = Locations;
                locationFormDel.Show();
                locationFormDel.BringToFront();

                break;

            case Mode.LocationSearch:
                break;

            case Mode.LocationSearchMDI:
                List <SearchTermModel> searchTerms = collectSearchTerms();
                string clause = WhereClauseGenerator.MakeWhereClause(searchTerms);
                Locations = GlobalConfig.Connection.CustomerLocations_Get(clause, "Select", 0, "", "", "", "", "", "", "", "", 0);
                frmMultiSelect locationForm = new frmMultiSelect();
                locationForm.LocationData = Locations;
                locationForm.Show();
                locationForm.BringToFront();
                break;

            case Mode.None:
                break;

            default:
                break;
            }
        }