/// <summary>
 /// Kiểm tra tồn tại 
 /// </summary>        
 public static bool IsExist(int amountBuy)
 {
     MoneyPacificDataContext mpdb = new MoneyPacificDataContext();
     bool result = mpdb.Categories.Any(c => c.Value == amountBuy && c.Active == true);
     mpdb.Connection.Close();
     return result;
 }
 //
 public static bool IsExist(string phoneNumber)
 {
     MoneyPacificDataContext mpdb = new MoneyPacificDataContext();
     bool result = mpdb.Customers.Any(c => c.PhoneNumber.Trim() == phoneNumber.Trim());
     mpdb.Connection.Close();
     return result;
 }
 public static bool AddNew(Collection entity)
 {
     MoneyPacificDataContext mpdb = new MoneyPacificDataContext();
     mpdb.Collections.InsertOnSubmit(entity);
     mpdb.SubmitChanges();
     return true;
 }
 public static bool AddNew(StoreUser entity)
 {
     MoneyPacificDataContext mpdb = new MoneyPacificDataContext();
     DataAccessLayer.GetConnection.StoreUsers.InsertOnSubmit(entity);
     DataAccessLayer.GetConnection.SubmitChanges();
     return true;
 }
 public static void AddObject(TimeTable entity)
 {
     MoneyPacificDataContext mpdb = new MoneyPacificDataContext();
     mpdb.TimeTables.InsertOnSubmit(entity);
     mpdb.SubmitChanges();
     mpdb.Connection.Close();
 }
 public static List<PartPacificCode> GetList()
 {
     MoneyPacificDataContext mpdb = new MoneyPacificDataContext();
     List<PartPacificCode> lstResult = mpdb.PartPacificCodes.ToList<PartPacificCode>();
     mpdb.Connection.Close();
     return lstResult;            
 }
 public static List<StoreManager> GetList()
 {
     MoneyPacificDataContext mpdb = new MoneyPacificDataContext();
     List<StoreManager> result = mpdb.StoreManagers.ToList<StoreManager>();
     mpdb.Connection.Close();
     return result;
 }
 public static StoreUser GetObject(string phoneNumber)
 {
     MoneyPacificDataContext mpdb = new MoneyPacificDataContext();
     return DataAccessLayer.GetConnection.StoreUsers
         .Where(s => s.Phone.Trim().Equals(phoneNumber.Trim()))
         .Single<StoreUser>();
 }
        public static bool Update(Agent entity)
        {
            MoneyPacificDataContext mpdb = new MoneyPacificDataContext();

            Agent existAgent = DataAccessLayer.GetConnection.Agents
                .Where(p => p.UserId.Equals(entity.UserId))
                .SingleOrDefault();

            existAgent.Address          = entity.Address;
            //existAgent.Block            = entity.Block;
            //existAgent.CreateDate       = entity.CreateDate;
            //existAgent.Email            = entity.Email;
            //existAgent.FirstName        = entity.FirstName;
            //existAgent.LastName         = entity.LastName;
            //existAgent.LastVisitDate    = entity.LastVisitDate;
            //existAgent.Password         = entity.Password;
            existAgent.Phone            = entity.Phone;
            existAgent.StatusId         = entity.StatusId;
            //existAgent.Username         = entity.Username;

            DataAccessLayer.GetConnection.SubmitChanges();
            
            mpdb.Connection.Close();
            return true;
        }
 public static StoreUser[] GetArray(Guid managerUserId)
 {
     MoneyPacificDataContext mpdb = new MoneyPacificDataContext();
     StoreUser[] result = mpdb.StoreUsers
         .Where(s => s.ManagerId.Equals(managerUserId)).ToArray<StoreUser>();
     mpdb.Connection.Close();
     return result;
 }
 public static bool IsExist(string collectNumber)
 {
     MoneyPacificDataContext mpdb = new MoneyPacificDataContext();
     bool result = mpdb.Collections
         .Where(p => p.CollectNumber.Trim() == collectNumber.Trim())
         .Any();
     return result;
 }
 public static CollectionState GetObject(int id)
 {
     MoneyPacificDataContext mpdb = new MoneyPacificDataContext();
     CollectionState existState = mpdb.CollectionStates
         .Where(c => c.Id == id)
         .SingleOrDefault();
     return existState;
 }
 public static bool AddNew(PartPacificCode entity)
 {
     MoneyPacificDataContext mpdb = new MoneyPacificDataContext();
     mpdb.PartPacificCodes.InsertOnSubmit(entity);
     mpdb.SubmitChanges();
     mpdb.Connection.Close();
     return true;
 }
 public static StoreManager GetObject(string phoneNumber)
 {
     MoneyPacificDataContext mpdb = new MoneyPacificDataContext();
     StoreManager obj = mpdb.StoreManagers
         .Where(s => s.ManagerPhone.Trim().Equals(phoneNumber.Trim()))
         .Single<StoreManager>();
     mpdb.Connection.Close();
     return obj;
 }
 public static TimeItem GetObject(string day, int hour)
 {
     MoneyPacificDataContext mpdb = new MoneyPacificDataContext();
     TimeItem result = mpdb.TimeItems
         .Where(t => (t.Day == day && t.Hour == hour))
         .SingleOrDefault();
     mpdb.Connection.Close();
     return result;
 }
 public static PartPacificCode GetObject(Guid id)
 {
     MoneyPacificDataContext mpdb = new MoneyPacificDataContext();
     PartPacificCode result = mpdb.PartPacificCodes
         .Where(p => p.Id.Equals(id))
         .Single<PartPacificCode>();
     mpdb.Connection.Close();
     return result;
 }
 public static List<StoreUser> GetList(Guid managerId)
 {
     MoneyPacificDataContext mpdb = new MoneyPacificDataContext();
     List<StoreUser> lstResult = mpdb.StoreUsers
         .Where(s => s.ManagerId == managerId)
         .ToList<StoreUser>();
     mpdb.Connection.Close();
     return lstResult;
 }
 public static StoreUserState GetObject(int id)
 {
     MoneyPacificDataContext mpdb = new MoneyPacificDataContext();
     StoreUserState result = mpdb.StoreUserStates
         .Where(s => s.Id.Equals(id))
         .Single<StoreUserState>();
     mpdb.Connection.Close();
     return result;
 }
 public static List<Collection> GetList(int statusId)
 {
     MoneyPacificDataContext mpdb = new MoneyPacificDataContext();
     List<Collection> lstResult = mpdb.Collections
         .Where(p => (p.StatusId == statusId))
         .ToList<Collection>();
     mpdb.Connection.Close();
     return lstResult;
 }
 public static Collection GetObject(string collectNumber)
 {
     MoneyPacificDataContext mpdp = new MoneyPacificDataContext();
     Collection existCollection = mpdp.Collections
         .Where(c => c.CollectNumber.Trim() == collectNumber.Trim())
         .SingleOrDefault<Collection>();
     mpdp.Connection.Close();
     return existCollection;
 }
 public static StoreUser GetObject(Guid userId)
 {
     MoneyPacificDataContext mpdb = new MoneyPacificDataContext();
     StoreUser existStore = mpdb.StoreUsers
         .Where(s => s.UserId.Equals(userId))
         .Single<StoreUser>();
     mpdb.Connection.Close();
     return existStore;
 }
Beispiel #22
0
 public static User GetObject(Guid userId)
 {
     MoneyPacificDataContext mpdb = new MoneyPacificDataContext();
     User existUser = mpdb.Users
         .Where(c => c.Id.Equals(userId))
         .Single<User>();
     mpdb.Connection.Close();
     return existUser;
 }
 public static CustomerState GetObject(int id)
 {
     MoneyPacificDataContext mpdb = new MoneyPacificDataContext();
     CustomerState obj = mpdb.CustomerStates
         .Where(c => c.Id == id)
         .Single<CustomerState>();
     mpdb.Connection.Close();
     return obj;
 }
 public static Customer GetObject(string phoneNumber)
 {
     MoneyPacificDataContext mpdb = new MoneyPacificDataContext();
     Customer existCustomer = mpdb.Customers
         .Where(c => c.PhoneNumber.Trim().Equals(phoneNumber.Trim()))
         .Single<Customer>();
     mpdb.Connection.Close();
     return existCustomer;
 }
 public static TimeTable GetObject(int timeItemId, Guid managerId)
 {
     MoneyPacificDataContext mpdb = new MoneyPacificDataContext();
     TimeTable result = mpdb.TimeTables
         .Where(t => (t.TimeItemId == timeItemId && t.ManagerId == managerId))
         .SingleOrDefault();
     mpdb.Connection.Close();
     return result;                    
 }
Beispiel #26
0
 public static Area GetObject(int id)
 {
     MoneyPacificDataContext mpdb = new MoneyPacificDataContext();
     Area result = mpdb.Areas
         .Where(a => a.Id.Equals(id))
         .Single<Area>();
     mpdb.Connection.Close();
     return result;
 }
 public static StoreManager GetObject(Guid userId)
 {
     MoneyPacificDataContext mpdb = new MoneyPacificDataContext();
     StoreManager obj= mpdb.StoreManagers
         .Where(s => s.UserId == userId)
         .Single<StoreManager>();
     mpdb.Connection.Close();
     return obj;
 }
 public static CustomerState GetObject(string code)
 {
     MoneyPacificDataContext mpdb = new MoneyPacificDataContext();
     CustomerState obj = mpdb.CustomerStates
         .Where(c => c.Code.Trim().Equals(code.Trim()))
         .Single<CustomerState>();
     mpdb.Connection.Close();
     return obj;
 }
 public static AgentState GetObject(int id) 
 {
     MoneyPacificDataContext mpdb = new MoneyPacificDataContext();
     AgentState existAgentState = mpdb.AgentStates
         .Where(a => a.Id == id)
         .Single<AgentState>();
     mpdb.Connection.Close();
     return existAgentState;
 }
 public static Customer GetObject(Guid customerUserId)
 {
     MoneyPacificDataContext mpdb = new MoneyPacificDataContext();
     Customer existCustomer = mpdb.Customers
         .Where(c => c.UserId.Equals(customerUserId))
         .Single<Customer>();
     mpdb.Connection.Close();
     return existCustomer;
 }