Пример #1
0
 public static bool AddNew(Collection entity)
 {
     MoneyPacificDataContext mpdb = new MoneyPacificDataContext();
     mpdb.Collections.InsertOnSubmit(entity);
     mpdb.SubmitChanges();
     return true;
 }
Пример #2
0
        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;
        }
Пример #3
0
        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;
        }
Пример #4
0
        //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);