示例#1
0
        private void btnAddTractor_Click(object sender, RoutedEventArgs e)
        {
            if (txtTractorModel.Text != string.Empty && txtShowRoomRate.Text != string.Empty && cmbSupplier.Text != string.Empty && txtTractorImagePath.Text != string.Empty)
            {
                TRACTOR_MODEL tractorModel = new TRACTOR_MODEL();
                tractorModel.TRACTOR_MODEL_NAME = txtTractorModel.Text;
                tractorModel.SUPPLIER_ID = Convert.ToInt32(cmbSupplier.SelectedValue);
                tractorModel.TRACTOR_SHOWROOMRATE = Convert.ToDecimal(txtShowRoomRate.Text);
                tractorModel.TRACTOR_IMAGE = File.ReadAllBytes(txtTractorImagePath.Text);
                tractorModel.TRACTOR_STATUS = Convert.ToInt32(cmbTractorStatus.SelectedValue);
                data.Insert<TRACTOR_MODEL>(tractorModel);
            }
            else
            {
                MessageBox.Show("Please fill all mandatory fields.");
                return;
            }

            MessageBoxResult result = MessageBox.Show("Verify If You have Choosen correct Supplier Becuase Supplier Information Will not be Edited in Future. You want to Proceed? ", "Warning", MessageBoxButton.YesNo, MessageBoxImage.Warning);

            if (result.Equals(MessageBoxResult.Yes))
            {
                MessageBox.Show("Tractor Added Succesfully");

                Common.ClearAllControls<TextBox>(addTractors, 1);
                Common.ClearAllControls<ComboBox>(addTractors);
                imgStackPanel.Children.Clear();
                BindTractor();
            }
        }
 partial void DeleteTRACTOR_MODEL(TRACTOR_MODEL instance);
 partial void UpdateTRACTOR_MODEL(TRACTOR_MODEL instance);
 partial void InsertTRACTOR_MODEL(TRACTOR_MODEL instance);
		private void detach_TRACTOR_MODELs(TRACTOR_MODEL entity)
		{
			this.SendPropertyChanging();
			entity.SUPPLIER = null;
		}
		private void attach_TRACTOR_MODELs(TRACTOR_MODEL entity)
		{
			this.SendPropertyChanging();
			entity.MASTER = this;
		}