/// <summary>
 /// Create a new ProductInformation object.
 /// </summary>
 /// <param name="autoInc">Initial value of the AutoInc property.</param>
 /// <param name="productName">Initial value of the ProductName property.</param>
 /// <param name="rate">Initial value of the Rate property.</param>
 public static ProductInformation CreateProductInformation(global::System.Int64 autoInc, global::System.String productName, global::System.Decimal rate)
 {
     ProductInformation productInformation = new ProductInformation();
     productInformation.AutoInc = autoInc;
     productInformation.ProductName = productName;
     productInformation.Rate = rate;
     return productInformation;
 }
 /// <summary>
 /// Update or Insert Product information
 /// </summary>
 /// <param name="obj"></param>
 private void updateProductClick(object obj)
 {
     this.NewProductUpdate.IsEnabled = false;
     Mouse.OverrideCursor = Cursors.Wait;
     try
     {
         this.NewProductName.GetBindingExpression(TextBox.TextProperty);
         this.getValidationError(this.NewProductName);
         using (DueManagementEntity dmDatabase = new DueManagementEntity())
         {
             ModelProductInfo selectedProductInfo = obj as ModelProductInfo;
             var productExist = dmDatabase.ProductInformations.FirstOrDefault(x => x.AutoInc == selectedProductInfo.ID);
             if (productExist != null)
             {
                 Mouse.OverrideCursor = null;
                 if (MessageBox.Show(CommandData.ERROR_MESSAGE[0], CommandData.SOFTWARE_NAME, MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
                 {
                     Mouse.OverrideCursor = Cursors.Wait;
                     productExist.ProductName = selectedProductInfo.ProductName;
                     productExist.Rate = selectedProductInfo.Rate;
                     dmDatabase.SaveChanges();
                     Mouse.OverrideCursor = null;
                     MessageBox.Show(CommandData.ERROR_MESSAGE[1], CommandData.SOFTWARE_NAME, MessageBoxButton.OK, MessageBoxImage.Information);
                 }
                 else
                 {
                     return;
                 }
             }
             else
             {
                 ProductInformation newProductInfo = new ProductInformation
                                                         {
                                                             AutoInc = default(long),
                                                             ProductName = selectedProductInfo.ProductName,
                                                             Rate = selectedProductInfo.Rate
                                                         };
                 dmDatabase.ProductInformations.AddObject(newProductInfo);
                 dmDatabase.SaveChanges();
                 selectedProductInfo.ID = newProductInfo.AutoInc;
                 Mouse.OverrideCursor = null;
                 MessageBox.Show(CommandData.ERROR_MESSAGE[2], CommandData.SOFTWARE_NAME, MessageBoxButton.OK, MessageBoxImage.Information);
             }
         }
     }
     catch (NullReferenceException)
     {
         Mouse.OverrideCursor = null;
         MessageBox.Show(CommandData.ERROR_MESSAGE[5], CommandData.SOFTWARE_NAME, MessageBoxButton.OK, MessageBoxImage.Stop);
     }
     catch (Exception errorMessagess)
     {
         Mouse.OverrideCursor = null;
         MessageBox.Show(errorMessagess.Message, CommandData.SOFTWARE_NAME, MessageBoxButton.OK, MessageBoxImage.Error);
     }
     finally
     {
         Mouse.OverrideCursor = null;
     }
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the ProductInformations EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToProductInformations(ProductInformation productInformation)
 {
     base.AddObject("ProductInformations", productInformation);
 }