Esempio n. 1
0
        private void btnSaveOldTractorDetail_Click(object sender, RoutedEventArgs e)
        {
            if (cmbCustomerName.Text != string.Empty && cmbTractorMake.Text != string.Empty && cmbTractorModel.Text != string.Empty && txtPurchaseCost.Text != string.Empty && txtSellingCost.Text != string.Empty && txtYear.Text != string.Empty)
            {
                OLD_TRACTOR oldTractorObj = new OLD_TRACTOR();
                
                oldTractorObj.CUSTOMER_NAME = cmbCustomerName.Text;
                oldTractorObj.TRACTOR_MAKE = cmbTractorMake.Text;
                oldTractorObj.TRACTOR_MODEL = cmbTractorModel.Text;
                if (chkRcBookRecieved.IsChecked == true)
                {
                    oldTractorObj.TRACTOR_RCBOOK_NO = txtRcBookNo.Text;
                }
                oldTractorObj.TRACTOR_REGISTRATION_NO = txtRegisterNo.Text;
                oldTractorObj.TRACTOR_YEAR = int.Parse(txtYear.Text);

                oldTractorObj.PURCHASE_COST = decimal.Parse(txtPurchaseCost.Text);
                oldTractorObj.SELLING_COST = decimal.Parse(txtSellingCost.Text);

                if (chkExchanged.IsChecked == true)
                {
                    cmbTractorModel.ItemsSource = data.GetAllTractorModels(Convert.ToInt32(cmbTractorMake.SelectedValue)); // We need to hard code this to SONALICA.
                    oldTractorObj.TRACTOR_EXCHANGE_MODELID = (int)cmbExchangeTractorMakeForExchange.SelectedValue;
                }
                data.Insert<OLD_TRACTOR>(oldTractorObj);
                MessageBox.Show("Old Tractor Details Added Sucessfully");

                Common.ClearAllControls<TextBox>(oldTractor, 1);
                Common.ClearAllControls<ComboBox>(oldTractor);

                BindOldTractors();

                
            }
            else
            {
                MessageBox.Show("Please enter the mandatory fields");
            }
        }
 partial void DeleteOLD_TRACTOR(OLD_TRACTOR instance);
 partial void InsertOLD_TRACTOR(OLD_TRACTOR instance);
 partial void UpdateOLD_TRACTOR(OLD_TRACTOR instance);
		private void detach_OLD_TRACTORs(OLD_TRACTOR entity)
		{
			this.SendPropertyChanging();
			entity.TRACTOR_MODEL1 = null;
		}