Beispiel #1
0
        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            if ((checkBoxColour.IsChecked ?? false) && radComboBoxColour.SelectedValue.ToString() == "0")
            {
                DialogParameters param = new DialogParameters();
                param.Header  = "Select Studio M revision(s)";
                param.Content = "Please select a person for Colour.";
                RadWindow.Alert(param);
                return;
            }
            else if ((checkBoxElectricals.IsChecked ?? false) && radComboBoxElectricals.SelectedValue.ToString() == "0")
            {
                DialogParameters param = new DialogParameters();
                param.Header  = "Select Studio M revision(s)";
                param.Content = "Please select a person for Electricals.";
                RadWindow.Alert(param);
                return;
            }
            if ((checkBoxLandscaping.IsChecked ?? false) && radComboBoxLandscaping.SelectedValue.ToString() == "0")
            {
                DialogParameters param = new DialogParameters();
                param.Header  = "Select Studio M revision(s)";
                param.Content = "Please select a person for Landscaping.";
                RadWindow.Alert(param);
                return;
            }
            else if ((checkBoxAppliances.IsChecked ?? false) && radComboBoxAppliances.SelectedValue.ToString() == "0")
            {
                DialogParameters param = new DialogParameters();
                param.Header  = "Select Studio M revision(s)";
                param.Content = "Please select a person for Appliances.";
                RadWindow.Alert(param);
                return;
            }
            if ((checkBoxCarpets.IsChecked ?? false) && radComboBoxCarpets.SelectedValue.ToString() == "0")
            {
                DialogParameters param = new DialogParameters();
                param.Header  = "Select Studio M revision(s)";
                param.Content = "Please select a person for Carpets.";
                RadWindow.Alert(param);
                return;
            }
            else if ((checkBoxTimberFloor.IsChecked ?? false) && radComboBoxTimberFloor.SelectedValue.ToString() == "0")
            {
                DialogParameters param = new DialogParameters();
                param.Header  = "Select Studio M revision(s)";
                param.Content = "Please select a person for TimberFloor.";
                RadWindow.Alert(param);
                return;
            }
            else
            {
                string revisionTypeIds   = string.Empty;
                string assignedToUserIds = string.Empty;

                if (checkBoxColour.IsChecked ?? false)
                {
                    revisionTypeIds   += ",7";
                    assignedToUserIds += "," + radComboBoxColour.SelectedValue.ToString();
                }
                if (checkBoxElectricals.IsChecked ?? false)
                {
                    revisionTypeIds   += ",8";
                    assignedToUserIds += "," + radComboBoxElectricals.SelectedValue.ToString();
                }
                if (checkBoxLandscaping.IsChecked ?? false)
                {
                    revisionTypeIds   += ",29";
                    assignedToUserIds += "," + radComboBoxLandscaping.SelectedValue.ToString();
                }
                if (checkBoxAppliances.IsChecked ?? false)
                {
                    revisionTypeIds   += ",28";
                    assignedToUserIds += "," + radComboBoxAppliances.SelectedValue.ToString();
                }
                if (checkBoxCarpets.IsChecked ?? false)
                {
                    revisionTypeIds   += ",12";
                    assignedToUserIds += "," + radComboBoxCarpets.SelectedValue.ToString();
                }
                if (checkBoxTimberFloor.IsChecked ?? false)
                {
                    revisionTypeIds   += ",22";
                    assignedToUserIds += "," + radComboBoxTimberFloor.SelectedValue.ToString();
                }

                if (!string.IsNullOrWhiteSpace(revisionTypeIds))
                {
                    BusyIndicator1.IsBusy      = true;
                    BusyIndicator1.BusyContent = "Creating Ready for Studio M Split Revisions...";
                    if ((App.Current as App).SelectedEstimateRevisionTypeID == 5)
                    {
                        // CSC - in progress select complete Ready for Studio M needs current one also to move Completed
                        revisionTypeIds   = "6" + revisionTypeIds;
                        assignedToUserIds = (App.Current as App).CurrentUserId.ToString() + assignedToUserIds;
                    }
                    else
                    {
                        // remove the initial comma ,
                        revisionTypeIds = revisionTypeIds.Substring(1);
                    }
                    _mrsClient.CreateSplitStudioMRevisionsCompleted += new EventHandler <System.ComponentModel.AsyncCompletedEventArgs>(mrsClient_CreateSplitStudioMRevisionsCompleted);
                    _mrsClient.CreateSplitStudioMRevisionsAsync(_estimateRevisionId, revisionTypeIds, assignedToUserIds, (App.Current as App).CurrentUserId);
                }
                else
                {
                    DialogParameters param = new DialogParameters();
                    param.Header  = "Select Studio M revision(s)";
                    param.Content = "Please assign one or more Studio M revision(s).";
                    RadWindow.Alert(param);
                    return;
                }
            }
        }