public static bool AddNew(Collection entity) { MoneyPacificDataContext mpdb = new MoneyPacificDataContext(); mpdb.Collections.InsertOnSubmit(entity); mpdb.SubmitChanges(); return true; }
public static bool Update(Collection entity, Guid agentId) { MoneyPacificDataContext mpdb = new MoneyPacificDataContext(); Collection existCollection = mpdb.Collections .Where(c => c.Id == entity.Id) .Single<Collection>(); existCollection.CollectNumber = entity.CollectNumber; existCollection.AgentId = agentId; existCollection.CreateDate = entity.CreateDate; existCollection.ExpireDate = entity.ExpireDate; mpdb.SubmitChanges(); mpdb.Connection.Close(); return true; }
public static bool Update(Collection entity) { /// Update như cách này chưa tối ưu MoneyPacificDataContext mpdb = new MoneyPacificDataContext(); Collection existCollection = mpdb.Collections .Where(c => c.Id == entity.Id) .Single<Collection>(); existCollection.CollectNumber = entity.CollectNumber; existCollection.AgentId = entity.AgentId; existCollection.CreateDate = entity.CreateDate; existCollection.ExpireDate = entity.ExpireDate; existCollection.CollectDate = entity.CollectDate; existCollection.Amount = entity.Amount; existCollection.StatusId = entity.StatusId; mpdb.SubmitChanges(); mpdb.Connection.Close(); return true; }
//public static bool AddNew(Collection entity) //{ // throw new Exception("chua lam!..."); //} //public static bool Update(Collection entity) //{ // throw new Exception("chua lam!..."); //} public static bool Remove(Collection entity) { throw new Exception("chua lam!..."); }
private void detach_Collections(Collection entity) { this.SendPropertyChanging(); entity.Agent = null; }
private void attach_Collections(Collection entity) { this.SendPropertyChanging(); entity.Agent = this; }
private void detach_Collections(Collection entity) { this.SendPropertyChanging(); entity.StoreManager = null; }
partial void DeleteCollection(Collection instance);
partial void UpdateCollection(Collection instance);
partial void InsertCollection(Collection instance);