Exemplo n.º 1
0
        public WasteFactor Edit(WasteFactor factor)
        {
            factor.ModifiedOn = DateTime.Now;
            WasteFactor dbfactor = Single(factor.ID);

            // get the database columns which need to be updated
            var databaseMembers =
                db.Mapping.MappingSource.GetModel(typeof(BizzyQuoteDataContext)).GetMetaType(typeof(WasteFactor)).DataMembers
                    .Where(d => d.IsAssociation == false && d.IsDbGenerated == false && d.IsPersistent == true);

            // reflect to get instances of the entity preoprties
            var editProperties =
                from p in dbfactor.GetType().GetProperties()
                join m in databaseMembers on p.Name equals m.Name
                select p;

            // copy the values
            PropertyInfo[] editProps = editProperties.ToArray();
            foreach (PropertyInfo propertyInfo in editProps)
            {
                propertyInfo.SetValue(dbfactor, propertyInfo.GetValue(factor, null), null);
            }

            db.SubmitChanges();
            return dbfactor;
        }
Exemplo n.º 2
0
        public WasteFactor Create(WasteFactor factor)
        {
            factor.CreatedOn = DateTime.Now;
            factor.ModifiedOn = DateTime.Now;

            db.WasteFactors.InsertOnSubmit(factor);
            db.SubmitChanges();
            return factor;
        }
Exemplo n.º 3
0
 partial void DeleteWasteFactor(WasteFactor instance);
Exemplo n.º 4
0
 partial void UpdateWasteFactor(WasteFactor instance);
Exemplo n.º 5
0
 partial void InsertWasteFactor(WasteFactor instance);
Exemplo n.º 6
0
		private void detach_WasteFactors(WasteFactor entity)
		{
			this.SendPropertyChanging();
			entity.ProductLine = null;
		}
Exemplo n.º 7
0
		private void attach_WasteFactors(WasteFactor entity)
		{
			this.SendPropertyChanging();
			entity.Product = this;
		}
Exemplo n.º 8
0
		private void detach_WasteFactors(WasteFactor entity)
		{
			this.SendPropertyChanging();
			entity.Company = null;
		}