Beispiel #1
0
 private void SaveBtn_Click(object sender, RoutedEventArgs e)
 {
     if (!CheckValidity())
     {
         return;
     }
     if (DataManagement.CreateContractorRequest(CurrentReq) != null)
     {
         Tendering t = new Tendering()
         {
             ContractorRequestId = CurrentReq.ContractorRequestId,
         };
         t.TenderingTitle = TitleTxt.Text;
         t.Location       = LocationTxt.Text;
         t.IsNotice       = true;
         t.MinScore       = CurrentTendering.MinScore;
         try
         {
             CurrentTendering = DataManagement.CreateTendering(t);
             ErrorHandler.NotifyUser(ErrorHandler.ErrorMessages["SuccessfulSave"]);
             SaveBtn.IsEnabled = false;
         }
         catch (Exception ex)
         {
             ErrorHandler.NotifyUser(ErrorHandler.ErrorMessages["FailedSave"]);
         }
     }
     else
     {
         ErrorHandler.NotifyUser(ErrorHandler.ErrorMessages["FailedSave"]);
     }
 }
        private void SaveBtn_Click(object sender, RoutedEventArgs e)
        {
            if (YearCom.Text == "" && PriceListCheck.IsChecked == true)
            {
                label12.Foreground = new SolidColorBrush(Colors.Red);
            }
            else
            {
                label12.Foreground = new SolidColorBrush(Colors.Black);
            }
            if (ReqNomTxt.Text == "")
            {
                label5.Foreground = new SolidColorBrush(Colors.Red);
            }
            else
            {
                label5.Foreground = new SolidColorBrush(Colors.Black);
            }
            if (ChoosingConsultantRadio.IsChecked == false && choosingCntrctrRadio.IsChecked == false)
            {
                label25.Foreground = new SolidColorBrush(Colors.Red);
            }
            else
            {
                label25.Foreground = new SolidColorBrush(Colors.Black);
            }
            if (RequestUnitCom.SelectedIndex == -1)
            {
                label16.Foreground = new SolidColorBrush(Colors.Red);
            }
            else
            {
                label16.Foreground = new SolidColorBrush(Colors.Black);
            }
            if (TitleTxt.Text == "")
            {
                label3.Foreground = new SolidColorBrush(Colors.Red);
            }
            else
            {
                label3.Foreground = new SolidColorBrush(Colors.Black);
            }
            if (LocationTxt.Text == "")
            {
                label4.Foreground = new SolidColorBrush(Colors.Red);
            }
            else
            {
                label4.Foreground = new SolidColorBrush(Colors.Black);
            }
            if (TenderEstimateTxt.Text == "")
            {
                label9.Foreground = new SolidColorBrush(Colors.Red);
            }
            else
            {
                label9.Foreground = new SolidColorBrush(Colors.Black);
            }
            if (NeededFieldCom.SelectedIndex == -1)
            {
                label13.Foreground = new SolidColorBrush(Colors.Red);
            }
            else
            {
                label13.Foreground = new SolidColorBrush(Colors.Black);
            }
            if (SuperVisionCom.SelectedIndex == -1)
            {
                label8.Foreground = new SolidColorBrush(Colors.Red);
            }
            else
            {
                label8.Foreground = new SolidColorBrush(Colors.Black);
            }
            if (NeededRankCom.SelectedIndex == -1)
            {
                label14.Foreground = new SolidColorBrush(Colors.Red);
            }
            else
            {
                label14.Foreground = new SolidColorBrush(Colors.Black);
            }
            if (TenderTypeCom.SelectedIndex == -1)
            {
                label17.Foreground = new SolidColorBrush(Colors.Red);
            }
            else
            {
                label17.Foreground = new SolidColorBrush(Colors.Black);
            }
            if (TenderCodeCom.SelectedIndex == -1)
            {
                label7.Foreground = new SolidColorBrush(Colors.Red);
            }
            else
            {
                label7.Foreground = new SolidColorBrush(Colors.Black);
            }
            if (ReqDateDP.SelectedDate == null)
            {
                label6.Foreground = new SolidColorBrush(Colors.Red);
            }
            else
            {
                label6.Foreground = new SolidColorBrush(Colors.Black);
            }
            if ((YearCom.Text == "" && PriceListCheck.IsChecked == true) || RequestUnitCom.SelectedIndex == -1 || ChoosingConsultantRadio.IsChecked == false && choosingCntrctrRadio.IsChecked == false || ReqNomTxt.Text == "" || TitleTxt.Text == "" || LocationTxt.Text == "" || TenderEstimateTxt.Text == "" || NeededFieldCom.SelectedIndex == -1 || SuperVisionCom.SelectedIndex == -1 || NeededRankCom.SelectedIndex == -1 || TenderTypeCom.SelectedIndex == -1 || TenderCodeCom.SelectedIndex == -1 || ReqDateDP.SelectedDate == null)
            {
                ErrorHandler.NotifyUser("برخی از اطلاعات ضروری وارد نشده است");
                return;
            }

            if (DataManagement.CreateContractorRequest(CurrentReq) != null)
            {
                Tendering t = new Tendering()
                {
                    ContractorRequestId = CurrentReq.ContractorRequestId,
                };
                t.StageId        = (int)Stages.Request;
                t.TenderingType  = TenderTypeCom.Text;
                t.TenderingTitle = TitleTxt.Text;
                t.Location       = LocationTxt.Text;
                try
                {
                    CurrentTendering = DataManagement.CreateTendering(t);
                    DataManagement.UpdateContractorShortList(CurrentTendering, contractors);
                    ErrorHandler.NotifyUser(ErrorHandler.ErrorMessages["SuccessfulSave"]);
                    SaveBtn.IsEnabled = false;
                }
                catch (Exception ex)
                {
                    ErrorHandler.NotifyUser(ErrorHandler.ErrorMessages["FailedSave"]);
                }
            }
            else
            {
                ErrorHandler.NotifyUser(ErrorHandler.ErrorMessages["FailedSave"]);
            }
        }