Пример #1
0
 private void btnsave_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (error != 0 || (string.IsNullOrWhiteSpace(nametxt.Text)) || (string.IsNullOrWhiteSpace(phonetxt.Text)))
         {
             if (nametxt.Text == "")
             {
                 nametxt.Text = "";
             }
             if (phonetxt.Text == "")
             {
                 phonetxt.Text = "";
             }
         }
         else
         {
             P.PRPT_Name       = nametxt.Text;
             P.PRPT_State      = statetxt.Text;
             P.PRPT_Address    = addresstxt.Text;
             P.PRPT_Country    = countrytxt.Text;
             P.PRPT_GST        = gsttxt.Text;
             P.PRPT_Phone      = phonetxt.Text;
             P.PRPT_InsertDate = DateTime.Today;
             P.PRPT_UpdateDate = DateTime.Today;
             DataTable dt = P.NAME();
             string    a = "Save"; string b = Convert.ToString(btnsave.Content);
             if (dt.Rows.Count < 1)
             {
                 if (a == b)
                 {
                     P.Insert();
                     MessageBox.Show("Saved Successfully");
                     Clear();
                     this.NavigationService.Refresh();
                 }
             }
             else if (dt.Rows.Count == 1)
             {
                 P.Update();
                 MessageBox.Show("Updated Successfully");
                 Clear();
                 this.NavigationService.Refresh();
             }
         }
     }
     catch (SystemException)
     { }
 }
 public property property_insert()
 {
     property.approx_mrkt_value            = Convert.ToDecimal(Insert_approx_mrkt_value_txt.Text);
     property.address_id                   = Convert.ToInt32(Insert_address_id_txt.Text);
     property.case_id                      = Convert.ToInt32(Insert_case_id_txt.Text);
     property.client_id                    = Convert.ToInt32(Insert_client_id_txt.Text);
     property.Homeowners_Insurance_Payment = Convert.ToDecimal(Insert_Homeowners_Insurance_Payment_txt.Text);
     property.monthly_property_payment     = Convert.ToDecimal(Insert_monthly_property_payment_txt.Text);
     property.mortg_comp                   = Insert_mortg_comp_txt.Text;
     property.Property_Tax_Payment         = Convert.ToDecimal(Insert_Property_Tax_Payment_txt.Text);
     property.own_prop                     = Insert_own_prop_txt.Text;
     property.rent_prop                    = Insert_rent_prop_txt.Text;
     property.date_purchased               = Convert.ToInt32(Insert_date_purchased_txt.Text);
     property = property.Insert(property);
     Insert_property_GridView.DataBind();
     Update_property_GridView.DataBind();
     Delete_property_GridView.DataBind();
     return(property);
 }