public void Insert(StoreOperative storeOperative)
 {
     try
     {
         if (storeOperative.Id == Guid.Empty)
         {
             storeOperative.Id = Guid.NewGuid();
         }
         this.Table.Add(storeOperative);
         this.SubmitChanges();
     }
     catch
     {
         throw;
     }
 }
        private void btnRegister_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                var errorMessage = string.Empty;
                if (ValidateForm(out errorMessage))
                {
                    //رخداد خطا
                    throw new Exception(errorMessage);
                }

                var operative = Business.GetOperativeBusiness().GetById(cmbOperative.SelectedValue.ToGUID());


                var            storeOperativeBusiness = Business.GetStoreOperativeBusiness();
                StoreOperative storeOperative;

                if (storeDetailId.HasValue)
                {
                    storeOperative = storeOperativeBusiness.GetByStoreOrderDetailId(storeDetailId.Value, operative.Id);
                }
                else
                {
                    storeOperative = storeOperativeBusiness.GetByStoreOrderId(storeDetailId.Value, operative.Id);
                }

                if (storeOperative == null)
                {
                    storeOperative = new StoreOperative();
                }

                storeOperative.IdOperative   = operative.Id;
                storeOperative.IdStoreOrder  = storeOrderId;
                storeOperative.IdStoreDetail = storeDetailId;
                storeOperative.SPrice        = txtPrice.Text.ToDecimal();

                storeOperativeBusiness.Save(storeOperative);
            }
            catch
            {
                throw;
            }
        }
 public void Save(StoreOperative storeOperative)
 {
     try
     {
         if (storeOperative.Id == Guid.Empty)
         {
             storeOperative.Id = Guid.NewGuid();
             this.Insert(storeOperative);
         }
         else
         {
             this.SubmitChanges();
         }
     }
     catch
     {
         throw;
     }
 }