public static void AddObject(TimeTable entity)
 {
     MoneyPacificDataContext mpdb = new MoneyPacificDataContext();
     mpdb.TimeTables.InsertOnSubmit(entity);
     mpdb.SubmitChanges();
     mpdb.Connection.Close();
 }
 public static bool AddNew(Collection entity)
 {
     MoneyPacificDataContext mpdb = new MoneyPacificDataContext();
     mpdb.Collections.InsertOnSubmit(entity);
     mpdb.SubmitChanges();
     return true;
 }
 public static bool AddNew(PartPacificCode entity)
 {
     MoneyPacificDataContext mpdb = new MoneyPacificDataContext();
     mpdb.PartPacificCodes.InsertOnSubmit(entity);
     mpdb.SubmitChanges();
     mpdb.Connection.Close();
     return true;
 }
 public static bool Update(PartPacificCode entity)
 {
     MoneyPacificDataContext mpdb = new MoneyPacificDataContext();
     PartPacificCode existPPC = mpdb.PartPacificCodes
         .Where(p => p.Id.Equals(entity.Id))
         .Single<PartPacificCode>();
     existPPC.CopyFrom(entity);
     mpdb.SubmitChanges();
     mpdb.Connection.Close();
     return true;
 }
        public static bool Update(Guid managerId, int timeItemId, bool enabled)
        {
            MoneyPacificDataContext mpdb = new MoneyPacificDataContext();
            
            TimeTable existItem = mpdb.TimeTables
                .Where(t => (t.TimeItemId == timeItemId && t.ManagerId == managerId))
                .SingleOrDefault();
            existItem.Enabled = enabled;
            mpdb.SubmitChanges();

            mpdb.Connection.Close();
            return true;
        }
Esempio n. 6
0
        public static bool Update(User entity)
        {
            MoneyPacificDataContext mpdb = new MoneyPacificDataContext();
            
            User existUser = mpdb.Users
                .Where(p => p.Id.Equals(entity.Id))
                .Single<User>();
            existUser.CopyFrom(entity);
            mpdb.SubmitChanges();

            mpdb.Connection.Close();
            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 Update(StoreManager entity)
        {
            //throw new Exception("chua lam!...");
            MoneyPacificDataContext mpdb = new MoneyPacificDataContext();
            StoreManager existSM = mpdb.StoreManagers
                .Where(s => s.UserId.Equals(entity.UserId))
                .Single<StoreManager>();

            existSM.Address = entity.Address;
            existSM.Address2 = entity.Address2;
            existSM.AreaId = entity.AreaId;
            existSM.Country = entity.Country;
            existSM.EmailBill = entity.EmailBill;
            existSM.IdShop = entity.IdShop;
            existSM.IsLocked = entity.IsLocked;
            existSM.LastCollectDate = entity.LastCollectDate;
            existSM.LegalStructure = entity.LegalStructure;
            existSM.ManagerPhone = entity.ManagerPhone;
            existSM.NameOfCompany = entity.NameOfCompany;
            existSM.NameOfStore = entity.NameOfStore;
            existSM.NumberOfShop = entity.NumberOfShop;
            existSM.Phone = entity.Phone;
            existSM.Phone2 = entity.Phone2;
            existSM.Product = entity.Product;
            existSM.ShopSize = entity.ShopSize;
            existSM.StatusId = entity.StatusId;
            existSM.StoreInternetAccessId = entity.StoreInternetAccessId;
            existSM.UserId = entity.UserId;
            existSM.VATNumber = entity.VATNumber;
            existSM.Website = entity.Website;
            existSM.Zip = entity.Zip;

            mpdb.SubmitChanges();          

            mpdb.Connection.Close();
            return true;
        }
Esempio n. 10
0
        public static bool UnLock(Guid storeUserId)
        {
            MoneyPacificDataContext mpdb = new MoneyPacificDataContext();
            StoreUser exitStore = mpdb.StoreUsers
                .Where(l => l.UserId == storeUserId)
                .Single<StoreUser>();

            /// UNLOCK
            exitStore.Enable = true;
            ///

            mpdb.SubmitChanges();
            mpdb.Connection.Close();
            return true;

        }
Esempio n. 11
0
        public static void SetStatus(Guid customerUserId, string status)
        {
            MoneyPacificDataContext mpdb = new MoneyPacificDataContext();

            // Customer existCustomer = CustomerDAO.getCustomer(customerId); // LAY từ mpdb khác sẽ ko có tác dụng nếu có xử lý
            Customer existCustomer = mpdb.Customers
                .Where(c => c.UserId.Equals(customerUserId))
                .Single<Customer>();

            string oldStatus = CustomerStateDAO.GetObject((int)existCustomer.StatusId).Code;

            // VD: set Status = x32, x33...
            if (status[0] == 'x')
                status = oldStatus[0] + status.Substring(1, status.Length - 1);

            existCustomer.StatusId = CustomerStateDAO.GetObject(status).Id;
            mpdb.SubmitChanges();

            mpdb.Connection.Close();

        }