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; } }
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; } }
public static Branch RetrieveBranchByID(long?branchID) { try { return(BranchDL.RetrieveBranchByID(branchID)); } catch (Exception ex) { throw ex; } }
public static bool Update(Branch branch) { try { return(BranchDL.Update(branch)); } catch (Exception ex) { throw ex; } }
public static bool Save(Branch branch, out string message) { try { if (BranchDL.BranchExists(branch)) { message = string.Format("Branch with name: {0} or code: {1} exists already", branch.Name, branch.Code); return(false); } else { message = string.Empty; return(BranchDL.Save(branch)); } } catch (Exception ex) { throw ex; } }