public void DeleteData(Discount_Type data) { if (data != null) { de.Discount_Type.DeleteObject(data); } }
public Discount(Discount_Type discount_type, float percent_Off, Int64 amount_Off, Int64 amount_Limit, float unit_Off, string unit_Type) { this.Discount_type = discount_type; this.Percent_Off = percent_Off; this.Amount_Off = amount_Off; this.AmountLimit = amount_Limit; this.Unit_Off = unit_Off; this.Unit_Type = unit_Type; }
public Discount_Set(int ID, Discount_Type Type, List <Menu_Item_Type> Items_Needed, Ingredient_Type?Item_Type, int Percentage = 0, bool Top = false) { this.ID = ID; this.Type = Type; this.Items_Needed = Items_Needed; this.Item_Type = Item_Type; this.Percentage = Percentage; this.Top = Top; }
public Discount_Type NewData() { // 获取最后ID int lastId; Discount_Type lastData = de.ExecuteStoreQuery <Discount_Type>(@"SELECT * FROM Discount_Type ORDER BY Discount_TypeId*1 DESC LIMIT 1").FirstOrDefault(); //Theater theater = de.Theater.FirstOrDefault(); if (lastData != null) { lastId = lastData.Discount_TypeId; } else { lastId = 0; } int newId = lastId + 1; Discount_Type data = new Discount_Type(); data.Discount_TypeId = newId; // data.TheaterId = theater.TheaterId; // 更新数据基础值 data.Created = DateTime.Now; data.Updated = data.Created; data.ActiveFlag = true; //data.Discount_TypeId = 1; //data.DiscountId = 2; de.Discount_Type.AddObject(data); de.SaveChanges(); return(data); }