Exemple #1
0
 private void btnOk_Click(object sender, EventArgs e)
 {
     try
     {
         if (ObjBSupplier == null)
         {
             ObjBSupplier = new BSupplier();
         }
         if (ObjESupplier == null)
         {
             ObjESupplier = new ESupplier();
         }
         int IValue = 0;
         if (gvSupplier.FocusedRowHandle >= 0 &&
             int.TryParse(Convert.ToString(gvSupplier.GetFocusedRowCellValue("SupplierID")), out IValue))
         {
             ObjESupplier.SupplierID = IValue;
             ObjESupplier            = ObjBSupplier.CheckSupplierArticle(ObjESupplier);
             if (!string.IsNullOrEmpty(ObjESupplier.strArticleExists))
             {
                 var _result = XtraMessageBox.Show("Der Artikel gehört nicht zum ausgewählten Lieferant, wollen Sie ihn dennoch hinzufügen?", "Bestätigen..?", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                 if (Convert.ToString(_result).ToLower() == "ok")
                 {
                     ObjBSupplier.SaveArticleFromProposal(ObjESupplier);
                 }
                 else
                 {
                     return;
                 }
             }
             if (!string.IsNullOrEmpty(ObjESupplier.strSupplierExists))
             {
                 var _result = XtraMessageBox.Show("Für diesen Lieferanten existiert bereits ein Preisangebot. Wollen Sie ein weiteres Preisangebot hinzufügen?", "Bestätigen..?", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                 if (Convert.ToString(_result).ToLower() != "ok")
                 {
                     return;
                 }
             }
             _IsSave = true;
             this.Close();
         }
         else
         {
             throw new Exception("Bitte wählen Sie den Lieferanten, der hinzugefügt werden soll");
         }
     }
     catch (Exception ex)
     {
         Utility.ShowError(ex);
     }
 }