예제 #1
0
 /* ************ Parameret *********** */
 public string GetParameretValue(string paramName)
 {
     using (registry = new RegistryModel())
     {
         return(registry.parameters.FirstOrDefault(y => y.ParameterName == paramName).ParameterValue);
     }
 }
예제 #2
0
 public void RemovePartner(int partnerId)
 {
     using (registry = new RegistryModel())
     {
         registry.partners.Remove(registry.partners.SingleOrDefault(x => x.ID == partnerId));
         registry.SaveChanges();
     }
 }
예제 #3
0
 public void RemoveUser(int userId)
 {
     using (registry = new RegistryModel())
     {
         var removeType = registry.users.Remove(registry.users.FirstOrDefault(p => p.ID == userId));
         registry.SaveChanges();
     }
 }
예제 #4
0
 /* ************ Switch *********** */
 public void RemoveSwitchRecord(int partnerId, int contactId)
 {
     using (registry = new RegistryModel())
     {
         registry._switch.Remove(registry._switch.FirstOrDefault(x => x.PartnerId == partnerId && x.ContactId == contactId));
         registry.SaveChanges();
     }
 }
예제 #5
0
 public void RemovePartnerType(int typeId)
 {
     using (registry = new RegistryModel())
     {
         var removeType = registry.partnertype.Remove(registry.partnertype.FirstOrDefault(p => p.ID == typeId));
         registry.SaveChanges();
     }
 }
예제 #6
0
 public void AddContact(ContactDbModel contact)
 {
     using (registry = new RegistryModel())
     {
         registry.contacts.Add(contact);
         registry.SaveChanges();
     }
 }
예제 #7
0
 /* ************ Contacts *********** */
 public void RemoveContact(int contactId)
 {
     using (registry = new RegistryModel())
     {
         registry.contacts.Remove(registry.contacts.SingleOrDefault(x => x.ID == contactId));
         registry.SaveChanges();
     }
 }
예제 #8
0
        /* ************ Partners *********** */
        //public int SumPartnersFromOwner(int ownerId)
        //{
        //    return GetPartner().Count(x => x.OwnerId == ownerId);
        //}

        public void AddPartner(PartnerDbModel partner)
        {
            using (registry = new RegistryModel())
            {
                registry.partners.Add(partner);
                registry.SaveChanges();
            }
        }
예제 #9
0
 public void UpdateUserName(int userId, string userName)
 {
     using (registry = new RegistryModel())
     {
         var updateUser = registry.users.FirstOrDefault(p => p.ID == userId);
         updateUser.Name = userName;
         registry.SaveChanges();
     }
 }
예제 #10
0
 public void UpdatePassword(int userId, string userPass)
 {
     using (registry = new RegistryModel())
     {
         var updateUser = registry.users.FirstOrDefault(p => p.ID == userId);
         updateUser.Password = userPass;
         registry.SaveChanges();
     }
 }
예제 #11
0
 public void UpdatePartnerType(int updateId, string updateName)
 {
     using (registry = new RegistryModel())
     {
         var updateType = registry.partnertype.FirstOrDefault(p => p.ID == updateId);
         updateType.Name = updateName;
         registry.SaveChanges();
     }
 }
예제 #12
0
 /* ************ PartnerType *********** */
 public void AddPartnerType(string typeName)
 {
     using (registry = new RegistryModel())
     {
         registry.partnertype.Add(new PartnerTypeDbModel {
             Name = typeName
         });
         registry.SaveChanges();
     }
 }
예제 #13
0
 public void AddRecordSwitch(int partnerId, int contactId)
 {
     using (registry = new RegistryModel())
     {
         registry._switch.Add(new SwitchDbModel {
             PartnerId = partnerId, ContactId = contactId
         });
         registry.SaveChanges();
     }
 }
예제 #14
0
 /* ************ Users *********** */
 public void AddUser(string userName, string userPassword)
 {
     using (registry = new RegistryModel())
     {
         registry.users.Add(new UserDbModel {
             Name = userName, Password = userPassword, Status = false
         });
         registry.SaveChanges();
     }
 }
예제 #15
0
 public void UpdateContact(int contactId, string contactName, string contactPhone, string contactEmail, int contactStatus)
 {
     using (registry = new RegistryModel())
     {
         var updateContact = registry.contacts.FirstOrDefault(x => x.ID == contactId);
         updateContact.Name   = contactName;
         updateContact.Phone  = contactPhone;
         updateContact.Email  = contactEmail;
         updateContact.Status = contactStatus;
         registry.SaveChanges();
     }
 }
예제 #16
0
 public void UpdatePartner(PartnerDbModel chosenPartner)
 {
     using (registry = new RegistryModel())
     {
         var updatePartner = registry.partners.FirstOrDefault(x => x.ID == chosenPartner.ID);
         updatePartner.Name     = chosenPartner.Name;
         updatePartner.CountyId = chosenPartner.CountyId;
         updatePartner.OwnerId  = chosenPartner.OwnerId;
         updatePartner.TypeId   = chosenPartner.TypeId;
         updatePartner.ZipCode  = chosenPartner.ZipCode;
         updatePartner.City     = chosenPartner.City;
         updatePartner.Address  = chosenPartner.Address;
         registry.SaveChanges();
     }
 }
예제 #17
0
 public IEnumerable <UserDbModel> GetUser()
 {
     registry = new RegistryModel();
     return(registry.users.OrderBy(x => x.Name));
 }
예제 #18
0
 public IEnumerable <SwitchDbModel> GetSwitch()
 {
     registry = new RegistryModel();
     return(registry._switch);
 }
예제 #19
0
 public IEnumerable <ContactDbModel> GetContact()
 {
     registry = new RegistryModel();
     return(registry.contacts.OrderBy(x => x.Name));
 }
예제 #20
0
 public IEnumerable <PartnerDbModel> GetPartner()
 {
     registry = new RegistryModel();
     return(registry.partners.OrderBy(x => x.Name));
 }
예제 #21
0
        /*  ****************  Get Database Table   ******************  */

        public IEnumerable <CountyDbModel> GetCounty()
        {
            registry = new RegistryModel();
            return(registry.county);
        }