Esempio 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;
        }
Esempio n. 2
0
        public WasteFactor Create(WasteFactor factor)
        {
            factor.CreatedOn = DateTime.Now;
            factor.ModifiedOn = DateTime.Now;

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