Exemplo n.º 1
0
 public List <Officer> ListAll_Officer()
 {
     using (var context = new MockERKSDb())
     {
         return(context.Officers.ToList());
     }
 }
Exemplo n.º 2
0
 public List <File_Type> File_TypeList()
 {
     using (var context = new MockERKSDb())
     {
         return(context.File_Type.ToList());
     }
 }
Exemplo n.º 3
0
 public List <FileReport> GetFileReport(String currUser_Name)
 {
     System.Diagnostics.Debug.WriteLine("xx" + currUser_Name);
     using (MockERKSDb context = new MockERKSDb())
     {
         var results = from f in context.Site_File
                       where f.Organization.User_Name.Trim().Equals(currUser_Name.Trim(), StringComparison.InvariantCultureIgnoreCase)
                       select new FileReport
         {
             fileID               = f.File_ID,
             typeDescription      = f.File_Type.Type_Description,
             categoryName         = f.Category.Category_Name,
             operationName        = f.Operation.Operation_Name,
             operationID          = f.Operation.Operation_ID,
             location             = f.Organization.Site_Address.Location,
             address              = f.Organization.Site_Address.Address,
             merdianNumber        = f.Organization.Site_Address.LLD_ATS.Meridian_Number,
             rangeNumber          = f.Organization.Site_Address.LLD_ATS.Range_Number,
             townshipNumber       = f.Organization.Site_Address.LLD_ATS.Township_Number,
             sectionNumber        = f.Organization.Site_Address.LLD_ATS.Section_Number,
             quarterSectionNumber = f.Organization.Site_Address.LLD_ATS.Quarter_Section_Number,
             lsd         = f.Organization.Site_Address.LLD_ATS.LSD,
             planNumber  = f.LLD_PBL.Plan_Number,
             blockNumber = f.LLD_PBL.Block_Number,
             lotNumber   = f.LLD_PBL.Lot_Number,
             linc        = f.SPIN_II.LINC_Number,
             fileStatus  = f.File_Status
         };
         return(results.ToList());
     }
 }
Exemplo n.º 4
0
 public List <Site_File> LookUpAllFiles()
 {
     using (var context = new MockERKSDb())
     {
         return(context.Site_File.ToList());
     }
 }
Exemplo n.º 5
0
 public Manager getManagerByID(int ID)
 {
     using (var context = new MockERKSDb())
     {
         return(context.Managers.Find(ID));
     }
 }
Exemplo n.º 6
0
 public Organization getOrganization(int ID)
 {
     using (var context = new MockERKSDb())
     {
         return(context.Organizations.Find(ID));
     }
 }
Exemplo n.º 7
0
 public Officer Officer_Get(int Officer_ID)
 {
     using (var context = new MockERKSDb())
     {
         return(context.Officers.Find(Officer_ID));
     }
 }
Exemplo n.º 8
0
 public List <Organization_Description> DescriptionList()
 {
     using (var context = new MockERKSDb())
     {
         return(context.Organization_Description.ToList());
     }
 }
Exemplo n.º 9
0
 public void addOrganizationInfoFromForm()
 {
     using (var context = new MockERKSDb())
     {
         //Add items to the list. Or a possible LINQ Query.
     }
 }
Exemplo n.º 10
0
 public List <Organization> ListAll_Organizations()
 {
     using (var context = new MockERKSDb())
     {
         return(context.Organizations.ToList());
     }
 }
Exemplo n.º 11
0
//TODO Create and Delete An Client File Function For the Admin.
        #region GetClientByID

        public Organization Client_Get(int organizationId)
        {
            using (var context = new MockERKSDb())
            {
                return(context.Organizations.Find(organizationId));
            }
        }
Exemplo n.º 12
0
        public List <UserProfile> ListAllUsers()
        {
            var rm     = new RoleManager();
            var result = from person in Users.ToList()
                         select new UserProfile()
            {
                UserId          = person.Id,
                UserName        = person.UserName,
                Email           = person.Email,
                EmailConfirmed  = person.EmailConfirmed,
                Officer_ID      = person.Officer_ID,
                Organization_ID = person.Organization_ID,
                RoleMemberships = person.Roles.Select(r => rm.FindById(r.RoleId).Name)
            };

            using (var context = new MockERKSDb())
            {
                foreach (var person in result)
                {
                    if (person.Organization_ID.HasValue)
                    {
                        person.First_Name = context.Managers.Find(person.Officer_ID).First_Name;
                        person.Last_Name  = context.Managers.Find(person.Officer_ID).Last_Name;
                    }

                    else if (person.Officer_ID.HasValue)
                    {
                        person.First_Name = context.Officers.Find(person.Officer_ID).First_Name;
                        person.Last_Name  = context.Officers.Find(person.Officer_ID).Last_Name;
                    }
                }
            }

            return(result.ToList());
        }
Exemplo n.º 13
0
 /* Author: Wenyu Zhang*/
 public void createLocation(Site_Address address)
 {
     using (var context = new MockERKSDb())
     {
         context.Site_Address.Add(address);
         context.SaveChanges();
     }
 }
Exemplo n.º 14
0
 /* Author: Wenyu Zhang*/
 public void createOperation(Operation oper)
 {
     using (var context = new MockERKSDb())
     {
         context.Operations.Add(oper);
         context.SaveChanges();
     }
 }
Exemplo n.º 15
0
 /* Author: Wenyu Zhang*/
 public void createLLD_PBL(LLD_PBL pbl)
 {
     using (var context = new MockERKSDb())
     {
         context.LLD_PBL.Add(pbl);
         context.SaveChanges();
     }
 }
Exemplo n.º 16
0
 /* Author: Wenyu Zhang*/
 public void createLLd_ATS(LLD_ATS ats)
 {
     using (var context = new MockERKSDb())
     {
         context.LLD_ATS.Add(ats);
         context.SaveChanges();
     }
 }
Exemplo n.º 17
0
 public void File_Add(Site_File item, int id)
 {
     using (var context = new MockERKSDb())
     {
         item.Organization_ID = id;
         context.Site_File.Add(item);
         context.SaveChanges();
     }
 }
Exemplo n.º 18
0
 public void Officer_Add(Officer item)
 {
     using (var context = new MockERKSDb())
     {
         //any business rules
         context.Officers.Add(item);
         context.SaveChanges();
     }
 }
Exemplo n.º 19
0
 /* Author: Wenyu Zhang*/
 public Organization getOrganzationById(int id)
 {
     using (var context = new MockERKSDb())
     {
         Organization results = (from x in context.Organizations
                                 where x.Organization_ID == id
                                 select x).FirstOrDefault();
         return(results);
     }
 }
Exemplo n.º 20
0
 public List <Site_File> Site_FileGetById(int fileId)
 {
     using (var context = new MockERKSDb())
     {
         var results = from x in context.Site_File
                       where x.File_ID == fileId
                       select x;
         return(results.ToList());
     }
 }
Exemplo n.º 21
0
 public int OrganizationId_get(string username)
 {
     using (var context = new MockERKSDb())
     {
         int id = (from x in context.Organizations
                   where x.User_Name == username
                   select x.Organization_ID).FirstOrDefault();
         return(id);
     }
 }
Exemplo n.º 22
0
        public List <Manager> LookupAdmins()
        {
            using (var context = new MockERKSDb())
            {
                var result = from admin in context.Managers
                             orderby admin.Last_Name
                             select admin;

                return(result.ToList());
            }
        }
Exemplo n.º 23
0
        //Author:Sayed

        public void AddStaff()
        {
            using (var context = new MockERKSDb())
            {
                var currentStaff = from x in context.Officers
                                   select new OfficerListPOCO
                {
                    Officer_ID = x.Officer_ID,
                    First_Name = x.First_Name,
                    Last_Name  = x.Last_Name
                };


                var UserOfficer = from x in Users.ToList()
                                  where x.Officer_ID.HasValue
                                  select new RegisteredOfficerPOCO
                {
                    UserName   = x.UserName,
                    Officer_ID = int.Parse(x.Officer_ID.ToString())
                };

                foreach (var officer in currentStaff)
                {
                    //does the employee NOT have a logon (no User record)
                    if (!UserOfficer.Any(us => us.Officer_ID == officer.Officer_ID))
                    {
                        var newUserName = officer.First_Name.Substring(0, 1) + officer.Last_Name;

                        //create a new User ApplicationUser instance
                        var userAccount = new ApplicationUser()
                        {
                            UserName       = newUserName,
                            Email          = string.Format(STR_EMAIL_FORMAT, newUserName),
                            EmailConfirmed = true
                        };
                        userAccount.Officer_ID = officer.Officer_ID;
                        //create the Users record
                        IdentityResult result = this.Create(userAccount, STR_DEFAULT_PASSWORD);

                        //result hold the return value of the creation attempt

                        if (!result.Succeeded)
                        {
                            newUserName          = VerifyNewUserName(newUserName);
                            userAccount.UserName = newUserName;
                            this.Create(userAccount, STR_DEFAULT_PASSWORD);
                        }

                        //create the staff role in UserRoles
                        this.AddToRole(userAccount.Id, SecurityRoles.Staff);
                    }
                }
            }
        }
Exemplo n.º 24
0
 public List <Site_File> LookupFileByOrganization(int orgID)
 {
     using (var context = new MockERKSDb())
     {
         //Simple LINQ Query for a list of file based on a matching Organization ID (or Client ID if they decide to change it).
         var results = from file in context.Site_File
                       where file.Organization.Organization_ID == orgID
                       select file;
         return(results.ToList());
     }
 }
Exemplo n.º 25
0
 /* Author: Wenyu Zhang*/
 public Operation findOperation(string name)
 {
     using (var context
                = new MockERKSDb())
     {
         Operation results = (from x in context.Operations
                              where x.Operation_Name == name
                              select x).FirstOrDefault();
         return(results);
     }
 }
Exemplo n.º 26
0
        public void Officer_Update(Officer item)
        {
            using (var context = new MockERKSDb())
            {
                context.Entry(item).State =
                    System.Data.Entity.EntityState.Modified;



                context.SaveChanges();
            }
        }
Exemplo n.º 27
0
        public void Client_Update(Organization item)
        {
            using (var context = new MockERKSDb())
            {
                context.Entry(item).State =
                    System.Data.Entity.EntityState.Modified;



                context.SaveChanges();
            }
        }
Exemplo n.º 28
0
 public List <ATSList> DropDownMeridian()
 {
     using (var context = new MockERKSDb())
     {
         var merdians = from meridian in context.LLD_ATS
                        select new ATSList
         {
             ATSID    = meridian.ATS_ID,
             meridian = meridian.Meridian_Number
         };
         return(merdians.ToList());
     }
 }
Exemplo n.º 29
0
 public List <LocationList> DropDownLocation()
 {
     using (var context = new MockERKSDb())
     {
         var locations = from location in context.Site_Address
                         select new LocationList
         {
             locationCode = location.Location_Code,
             location     = location.Location
         };
         return(locations.ToList());
     }
 }
Exemplo n.º 30
0
 public List <SecurityClassificationList> DropDownSecurityClassification()
 {
     using (var context = new MockERKSDb())
     {
         var securityClassifications = from securityClassification in context.Security_Classification
                                       select new SecurityClassificationList
         {
             securityClassificationID   = securityClassification.Security_Classification_ID,
             securityClassificationName = securityClassification.Security_Classification_Name
         };
         return(securityClassifications.ToList());
     }
 }