示例#1
0
 public void DeleteArchive(string id)
 {
     using (var archrepo = new ArchiveServiceRepresentativeRepository())
     {
         ArchiveServiceRepresentative arch = archrepo.GetById(id);
         if (arch != null)
         {
             archrepo.Delete(arch);
         }
     }
 }
示例#2
0
 public ArchiveServiceRepresentativeView GetArchServRep(string id)
 {
     using (var sreprepo = new ArchiveServiceRepresentativeRepository())
     {
         ArchiveServiceRepresentative sr = sreprepo.GetById(id);
         var srep = new ArchiveServiceRepresentativeView();
         if (sr != null)
         {
             srep.ServiceRepIdNo = sr.ServiceRepIdNo;
             srep.IDNumber       = sr.IDNumber;
             srep.Fullname       = sr.Fullname;
             srep.Email          = sr.Email;
             srep.ContactNo      = sr.ContactNo;
         }
         return(srep);
     }
 }
示例#3
0
        public void Restore(string id)
        {
            var ArchiveRep = new ServiceRepresentativeRepository();
            var ar         = new ArchiveServiceRepresentativeRepository();

            ArchiveServiceRepresentative arch = ar.GetById(id);

            if (arch != null)
            {
                var mm = new ServiceRepresentative()
                {
                    ServiceRepIdNo = arch.ServiceRepIdNo,
                    IDNumber       = arch.IDNumber,
                    Fullname       = arch.Fullname,
                    Email          = arch.Email,
                    ContactNo      = arch.ContactNo
                };

                var newuser = new ApplicationUser()
                {
                    Id           = mm.IDNumber,
                    UserName     = mm.IDNumber,
                    FullName     = mm.Fullname,
                    Email        = mm.Email,
                    PasswordHash = UserManager.PasswordHasher.HashPassword(genePassword(mm.IDNumber))
                };

                var result = UserManager.CreateAsync(
                    newuser, genePassword(mm.IDNumber));

                ar.Delete(arch);
                ArchiveRep.Insert(mm);

                rb.AddUserToRole(newuser.Id, "Service Representative");
            }
        }