Пример #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_update(int ID)
 {
     property                              = property.Select(ID);
     property.property_id                  = Convert.ToInt32(Update_property_id_txt.Text);
     property.approx_mrkt_value            = Convert.ToDecimal(Update_approx_mrkt_value_txt.Text);
     property.address_id                   = Convert.ToInt32(Update_address_id_txt.Text);
     property.case_id                      = Convert.ToInt32(Update_case_id_txt.Text);
     property.client_id                    = Convert.ToInt32(Update_client_id_txt.Text);
     property.Homeowners_Insurance_Payment = Convert.ToDecimal(Update_Homeowners_Insurance_Payment_txt.Text);
     property.monthly_property_payment     = Convert.ToDecimal(Update_monthly_property_payment_txt.Text);
     property.mortg_comp                   = Update_mortg_comp_txt.Text;
     property.Property_Tax_Payment         = Convert.ToDecimal(Update_Property_Tax_Payment_txt.Text);
     property.own_prop                     = Update_own_prop_txt.Text;
     property.rent_prop                    = Update_rent_prop_txt.Text;
     property.date_purchased               = Convert.ToInt32(Update_date_purchased_txt.Text);
     property.Update(property);
     Insert_property_GridView.DataBind();
     Update_property_GridView.DataBind();
     Delete_property_GridView.DataBind();
     return(property);
 }
 public property property_update(int ID)
 {
     property = property.Select(ID);
     property.property_id = Convert.ToInt32(Update_property_id_txt.Text);
     property.approx_mrkt_value = Convert.ToDecimal(Update_approx_mrkt_value_txt.Text);
     property.address_id = Convert.ToInt32(Update_address_id_txt.Text);
     property.case_id = Convert.ToInt32(Update_case_id_txt.Text);
     property.client_id = Convert.ToInt32(Update_client_id_txt.Text);
     property.Homeowners_Insurance_Payment = Convert.ToDecimal(Update_Homeowners_Insurance_Payment_txt.Text);
     property.monthly_property_payment = Convert.ToDecimal(Update_monthly_property_payment_txt.Text);
     property.mortg_comp = Update_mortg_comp_txt.Text;
     property.Property_Tax_Payment = Convert.ToDecimal(Update_Property_Tax_Payment_txt.Text);
     property.own_prop = Update_own_prop_txt.Text;
     property.rent_prop = Update_rent_prop_txt.Text;
     property.date_purchased = Convert.ToInt32(Update_date_purchased_txt.Text);
     property.Update(property);
     Insert_property_GridView.DataBind();
     Update_property_GridView.DataBind();
     Delete_property_GridView.DataBind();
     return property;
 }