示例#1
0
        public static List <Object> RetrieveBranches()
        {
            try
            {
                List <Object> returnedBranches = new List <object>();

                List <Branch> branches = BranchDL.RetrieveBranches();

                foreach (Branch branch in branches)
                {
                    Object branchObj = new
                    {
                        ID      = branch.ID,
                        Name    = branch.Name,
                        Code    = branch.Code,
                        Address = branch.Address
                    };

                    returnedBranches.Add(branchObj);
                }

                return(returnedBranches);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#2
0
        public static List <CardAccountRequestDTO> RetrieveCardAccountRequests()
        {
            try
            {
                string key = System.Configuration.ConfigurationManager.AppSettings.Get("ekey");

                var cars = CardAccountRequestDL.RetrieveCardAccountRequests();

                if (cars.Any())
                {
                    var branchList = BranchDL.RetrieveBranches();

                    var result = (from car in cars
                                  select new CardAccountRequestDTO
                    {
                        ID = car.ID,
                        LicenseID = car.LicenseID,
                        CardSerialNumber = !string.IsNullOrEmpty(car.CardSerialNumber) ? Crypter.Decrypt(key, car.CardSerialNumber) : string.Empty,
                        Lastname = car.Lastname,
                        FirstName = car.FirstName,
                        MiddleName = car.MiddleName,
                        NameOnCard = car.NameOnCard,
                        DateOfBirth = car.DateOfBirth,
                        MaritalStatus = car.MaritalStatus,
                        Sex = car.Sex,
                        Religion = car.Religion,
                        MothersMaidenName = car.MothersMaidenName,
                        Nationality = car.Nationality,
                        UtilityBill = car.UtilityBill,
                        IDNumber = car.IDNumber,
                        LocalGovernmentArea = car.LocalGovernmentArea,
                        BloodGroup = car.BloodGroup,
                        LicenseType = car.LicenseType,
                        IssueDate = car.IssueDate,
                        ValidTillDate = car.ValidTillDate,
                        FileNumber = car.FileNumber,
                        EmailAddress = car.EmailAddress,
                        PhoneNumber = car.PhoneNumber,
                        Address = car.Address,
                        PrintStatus = car.PrintStatus == 1 ? "Enrolled" : (car.PrintStatus == 2 ? "SentForPrinting" : "Printed"),
                        UserPrinting = car.UserPrinting,
                        DateEnroled = Convert.ToDateTime(car.DateEnroled),
                        DatePrinted = Convert.ToDateTime(car.DatePrinted),
                        Branch = branchList.Where(x => x.ID == car.BranchID).FirstOrDefault().Name
                    }).ToList();

                    return(result);
                }
                else
                {
                    return(new List <CardAccountRequestDTO>());
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }