// GET: BOS/Tools public HttpResponseMessage GetFiles(string eid) { string _parseId = null; bool parseStatus = Cryptography.AES.TryDecrypt(eid, out _parseId); int? _id = _parseId.ToIntNullable(); if (_id.HasValue) { MayFlower db = new MayFlower(); var _reg = db.EventMasters.FirstOrDefault(x => x.EventID == _id); var eventProperties = _reg.GetType().GetProperties(); var pushObj = new ExpandoObject() as IDictionary <string, Object>; foreach (var item in eventProperties) { if (item.PropertyType.Name == "String") { string _columnValue = (string)item.GetValue(_reg); if (!string.IsNullOrWhiteSpace(_columnValue) && _columnValue.StartsWith("~/")) { string _uriString = Url.Link("DefaultApi", new { controller = "Home" }); var uriBuilder = new UriBuilder(_uriString); uriBuilder.Path = _columnValue.Replace("~/", ""); string _outputUrl = uriBuilder.ToString(); // push image url into expando object pushObj.Add(item.Name, _outputUrl); string phsyPath = HttpContext.Current.Server.MapPath(_columnValue); } } } if (pushObj.Count > 0) { var chkFile = pushObj.Select(x => { UriBuilder uriBuilder = new UriBuilder(x.Value.ToString()); string serverPath = HttpContext.Current.Server.MapPath(uriBuilder.Path); var _innerObj = new ExpandoObject() as IDictionary <string, Object>; _innerObj.Add("ColumnName", x.Key); _innerObj.Add("Url", x.Value); _innerObj.Add("Valid", File.Exists(serverPath)); return(_innerObj); }); return(Request.CreateResponse(HttpStatusCode.OK, chkFile)); } } var message = string.Format("Bad request!"); HttpError err = new HttpError(message); return(Request.CreateResponse(HttpStatusCode.BadRequest, err)); }
public ActionResult DeleteFrequentFlyer(int id) { var modelCaller = new ModelInitialize(db); var model = modelCaller.EditFlyerDetail().FirstOrDefault(x => x.TravellerID == id); MayFlower checkDb = new MayFlower(); foreach (var group in checkDb.TravellerGroups.Where(x => x.IsActive == true)) { if (group.TravellerID == model.TravellerID) { ModelState.AddModelError("Error", "This frequent traveller " + model.FullName + " added in Traveller Group!"); TempData["ModelStateDeleteError"] = ModelState; return(RedirectToAction("FrequentFlyer", "Tools", ModelState)); //throw new Exception("This frequent traveller added in traveller group!"); } } model.IsActive = false; SqlCommand command = new SqlCommand(); MemberServiceController.EditFrequentFlyer(id, CurrentUserID, model, command); command.Transaction.Commit(); if (model == null) { return(HttpNotFound()); } return(RedirectToAction("FrequentFlyer", "Tools")); }
public override void OnActionExecuting(ActionExecutingContext filterContext) { MayFlower db = new MayFlower(); //var requestID = filterContext.RequestContext.RouteData.Values["id"]; int userID = Convert.ToInt32(filterContext.HttpContext.User.Identity.Name); var user = db.Users.AsEnumerable().FirstOrDefault(x => x.UserID == userID); if (!string.IsNullOrEmpty(ActionParameterName)) { } if (IsFilterOrganization) { // Based on QueryString //if (user.OrganizationID != Convert.ToInt32(requestID)) var model = (Organization)filterContext.ActionParameters[ActionParameterName]; if (user.OrganizationID != model.OrganizationID) { filterContext.Result = new RedirectToRouteResult(new RouteValueDictionary(new { controller = "Error", action = "AccessDenied" })); } } else { // Based on QueryString //if (user.UserID != Convert.ToInt32(requestID)) var model = (User)filterContext.ActionParameters[ActionParameterName]; if (user.UserID != model.UserID) { filterContext.Result = new RedirectToRouteResult(new RouteValueDictionary(new { controller = "Error", action = "AccessDenied" })); } } }
public SimpleMembershipInitializer() { Database.SetInitializer <MayFlower>(null); try { using (var context = new MayFlower()) { if (!context.Database.Exists()) { // Create the SimpleMembership database without Entity Framework migration schema ((IObjectContextAdapter)context).ObjectContext.CreateDatabase(); } } //Dev //WebSecurity.InitializeDatabaseConnection("CorpBooking", "Agent", "AgentId", "Email", autoCreateTables: true); //Local dev //WebSecurity.InitializeDatabaseConnection("CorpBookingLocal", "Agent", "AgentId", "Email", autoCreateTables: true); //Local dev (User Table) WebSecurity.InitializeDatabaseConnection("MayFlowerEntities", "Users", "UserID", "Email", autoCreateTables: true); } catch (Exception ex) { throw new InvalidOperationException("The ASP.NET Simple Membership database could not be initialized. For more information, please see http://go.microsoft.com/fwlink/?LinkId=256588", ex); } }
public BookingList(MayFlower _dbContext, SqlCommand _sqlCommand) { CommandInitInside = _sqlCommand == null; MayFlowerDB = _dbContext ?? new MayFlower(); MaySqlCommand = _sqlCommand ?? new SqlCommand(); }
public ItemCheck(int superPNRID, MayFlower _dbContext, bool chkStatusPending, bool chkFlight, bool chkHotel, bool chkAddOnBook) { DBContext = _dbContext ?? new MayFlower(); SuperPNR = DBContext.SuperPNRs.FirstOrDefault(x => x.SuperPNRID == superPNRID); if (chkFlight) { CheckFlight(); } if (chkHotel) { CheckHotel(); } if (chkAddOnBook) { CheckInsurance(); CheckEventProducts(); } if (chkStatusPending) { UpdatePendingPaymentStatus(); } }
/// <summary> /// Fetch airport name from database by AirportCode. /// </summary> /// <param name="AirportCode">Airport code stored in database.</param> /// <returns>Airport Name</returns> public static string GetAirportName(string AirportCode) { using (MayFlower db = new MayFlower()) { var airport = db.Stations.FirstOrDefault(x => x.StationCode == AirportCode); return(airport != null ? airport.DisplayName : "Airport Not Exist"); } }
/// <summary> /// Fetch Country name from database by CountryCode. /// </summary> /// <param name="CountryCode">Country code stored in database.</param> /// <returns>Country Name</returns> public static string GetCountryName(string CountryCode) { using (MayFlower db = new MayFlower()) { var model = db.Countries.FirstOrDefault(x => x.CountryCode == CountryCode); return(model != null ? model.Country1 : "Country Not Exist"); } }
/// <summary> /// Fetch Airline name from database by AirlineCode. /// </summary> /// <param name="AirlineCode">Airline code stored in database.</param> /// <returns>Airline Name</returns> public static string GetAirlineName(string AirlineCode) { using (MayFlower db = new MayFlower()) { var airline = db.Airlines.FirstOrDefault(x => x.AirlineCode == AirlineCode); return(airline != null ? airline.Airline1 : "Airline Not Exist"); } }
public static Task <RequeryStatus.Requery> CheckPaymentPAIDAsync(PaymentOrder record, int superPNRId, string superPNRNo, MayFlower dbContext) { return(Task.Factory.StartNew(() => { return CheckPaymentPAID(record, superPNRId, superPNRNo, dbContext); })); }
public LoginClass(User __user, MayFlower dbContext = null) { SetupDBConnection(dbContext); User _inUser = null; UserData = _UserData(__user.Email, "", out _inUser, false, __user); User = _inUser; }
public LoginClass(string email, string password, MayFlower dbContext = null, bool isAgentLogin = false) { SetupDBConnection(dbContext); User _inUser = null; UserData = _UserData(email, password, out _inUser, false); User = _inUser; }
/// <summary> /// B2B use only. /// </summary> public LoginClass(string userLoginID, string password, bool b2b, MayFlower dbContext = null) { SetupDBConnection(dbContext); User _inUser = null; UserData = _UserData(userLoginID, password, out _inUser, true); User = _inUser; }
public static IQueryable <PaymentOrder> GetPaymentsPEND(MayFlower db, bool ignoreRequeryTime = false) { db = db ?? new MayFlower(); return(db.PaymentOrders.Where(x => x.PaymentStatusCode == "PEND" && x.RequeryStatusCode != "ERR" && (ignoreRequeryTime || DateTime.Now >= System.Data.Entity.DbFunctions.AddSeconds(x.CreatedDate, _parseSecond)) ).Distinct()); }
public static IQueryable <User> GetCurrentOrganizationUsersByRoleName(string RoleName) { MayFlower db = new MayFlower(); var item = from a in db.Users from role in a.UsersInRoles where a.OrganizationID == GetCurrentOrganizationId && role.Role.RoleName == RoleName && a.IsActive == true select a; return(item); }
public JavaScriptResult AirportCompleteList() { // From DB using (MayFlower dbContext = new MayFlower()) { var script = @"var completeAirport = "; script += JsonConvert.SerializeObject(dbContext.Stations.Where(x => x.CountryCode != "NA" && x.IsActive).Select(x => x.DisplayName)); return(JavaScript(script)); } }
public override void OnActionExecuting(ActionExecutingContext filterContext) { // Create new instance everytime call MayFlower db = new MayFlower(); #region /* * Assembly asm = Assembly.GetAssembly(typeof(Mayflower.MvcApplication)); * * List<string> excludeItem = new List<string> { "Item1", "Item2" }; * CurrentRole.GetRolesForUser(CurrentUser.Id.ToString()); * * var controlleractionlist = asm.GetTypes() * .Where(type => typeof(System.Web.Mvc.Controller).IsAssignableFrom(type)) * .SelectMany(type => type.GetMethods(BindingFlags.Instance | BindingFlags.DeclaredOnly | BindingFlags.Public)) * .Where(m => !m.GetCustomAttributes(typeof(System.Runtime.CompilerServices.CompilerGeneratedAttribute), true).Any()) * .Select(x => new { Controller = x.DeclaringType.Name, Action = x.Name, ReturnType = x.ReturnType.Name }) * .Where(x => !x.Controller.ToLower().Contains("person") && !x.Controller.ToLower().Contains("agent") && !x.Controller.ToLower().Contains("account") * //&& !x.Action.ToLower().Contains("Register") && !x.Action.ToLower().Contains("log") * && !x.Action.ToLower().Contains("mail")) * .OrderBy(x => x.Controller).ThenBy(x => x.Action) * .GroupBy(x => new { x.Controller, x.Action }) * .Select(x => new { GroupController = x.Key.Controller, GroupAction = x.Key.Action }) * .Where(x => x.GroupController == controllerName) * .ToList(); */ #endregion if (filterContext.HttpContext.User.Identity.IsAuthenticated) { GetRolesForUser(); } else { roleName = new string[] {}; } var controllerName = filterContext.ActionDescriptor.ControllerDescriptor.ControllerType.Name; var actionName = filterContext.ActionDescriptor.ActionName; var rolePolicy = db.RolePolicies.Where(x => roleName.Contains(x.Role.RoleName)).Select(x => x.ControllerID); var ControllerActionList = db.SMC_ControllerList.Where(r => rolePolicy.Contains(r.ControllerID) || r.IsAllowAnonymous == true) .Where(x => x.ControllerName == controllerName && x.ActionName == actionName) .ToList(); if (ControllerActionList.Count <= 0) { filterContext.Result = new RedirectToRouteResult(new RouteValueDictionary(new { controller = "Error", action = "AccessDenied" })); } //Log("OnActionExecuting", filterContext.RouteData); }
public static IQueryable <PaymentOrder> GetOrdersRHI(MayFlower db, bool ignoreRequeryTime = false, bool ignoreRequeryStatus = false) { db = db ?? new MayFlower(); var recordRHI = db.SuperPNROrders.Where(x => x.BookingStatusCode == "RHI" && (ignoreRequeryStatus || x.PaymentOrders.Count(p => p.RequeryStatusCode == "ERR" || p.RequeryStatusCode == "MAN") == 0) && x.CreatedDate >= new DateTime(2017, 12, 05) && // requery new item (ignoreRequeryTime || DateTime.Now >= System.Data.Entity.DbFunctions.AddSeconds(x.CreatedDate, _parseSecond)) ); return(recordRHI.SelectMany(x => x.PaymentOrders).Distinct()); }
public IQueryable <DeleteTravellerGroupModel> DeleteAll(int userId) { MayFlower db = new MayFlower(); var model = db.GroupNames.Select(m => new DeleteTravellerGroupModel { GroupID = m.GroupID, GroupName = m.GroupName1, TravallerGroup = db.TravellerGroups.Where(s => s.GroupID == m.GroupID && s.CreatedByID == userId).ToList() }); return(model); }
public async Task CheckoutReserveRoomHB() { MayFlower db = new MayFlower(); List <Enumeration.BatchBookResultType> bookResultTask = new List <Enumeration.BatchBookResultType>(); try { int bookingid = 1126; BookingQuery.HotelBeds hotelbeds = new BookingQuery.HotelBeds(); var result = await hotelbeds.CheckoutReserveRoom(bookingid, "PPA", "http://localhost:52197", db); } catch (Exception ex) { throw ex; } }
public async Task CheckoutReserveRoomJAC() { MayFlower db = new MayFlower(); List <Enumeration.BatchBookResultType> bookResultTask = new List <Enumeration.BatchBookResultType>(); try { int bookingid = 1127; BookingQuery.JacTravel jactravel = new BookingQuery.JacTravel(); var result = await jactravel.CheckoutReserveRoom(bookingid, "PPA", "http://localhost:52197", db); } catch (Exception ex) { throw ex; } }
public async Task CheckoutReserveRoomTP() { MayFlower db = new MayFlower(); List <Enumeration.BatchBookResultType> bookResultTask = new List <Enumeration.BatchBookResultType>(); try { int bookingid = 1110; //booking id without payment BookingQuery.Tourplan tourplan = new BookingQuery.Tourplan(); var result = await tourplan.CheckoutReserveRoom(bookingid, "PPA", "http://localhost:52197", db); } catch (Exception ex) { throw ex; } }
public static IQueryable <TravellerGroupInsert> GetAllByID(int userId) { MayFlower db = new MayFlower(); var model = db.GroupNames .Where(x => x.IsActive) .Select(x => new TravellerGroupInsert { GroupID = x.GroupID, GroupName = x.GroupName1, CreatedByID = x.CreatedByID, TravellerList = db.TravellerGroups.Where(s => s.GroupID == x.GroupID && s.TravellerList.IsActive && s.IsActive) .Select(s => s.TravellerList).ToList() }); return(model); }
private MarkupInfo GetMarkup(ProductCarRental.SearchCriteria model) { MayFlower db = new MayFlower(); var markup = db.MarkupCarRentals.FirstOrDefault(x => x.IsActive && x.BookingDateFrom <= DateTime.Now && x.BookingDateTo >= DateTime.Now && x.TravelDateFrom <= model.PickupDateTime && x.TravelDateTo >= model.ReturnDateTime); MarkupInfo markupDtl = new MarkupInfo(); if (markup != null) { markupDtl = new MarkupInfo() { MarkupID = markup.MarkupCarRentalID, DiscountOrMarkup = markup.DiscountOrMarkup, MarkupPricingTypeCode = markup.MarkupPricingTypeCode }; } return(markupDtl); }
/// <summary> /// Get airline image /// </summary> /// <param name="airlineCode">Airline Code. If is multi airline, pass "multiple"</param> /// <returns></returns> public static string GetAirlineImagePath(string airlineCode) { string multiAirline = "~/Images/AirlineLogo/multi_airline.jpg"; using (MayFlower db = new MayFlower()) { var airline = db.Airlines.FirstOrDefault(x => x.AirlineCode == airlineCode); if (airline != null) { return(airline.ImagePath ?? multiAirline); } else { return(multiAirline); } } }
// GET: BOS/Tools public HttpResponseMessage GetTempAgentRegisterDocument(string aid) { MayFlower db = new MayFlower(); string _parseId = null; bool parseStatus = Cryptography.AES.TryDecrypt(aid, out _parseId); int? _id = _parseId.ToIntNullable(); if (_id.HasValue) { var _tempDocList = db.Temp_RegistrationAgentSupportDocument .Where(x => x.RegistrationAgentID == _id && x.DocumentPath != null); var _res = _tempDocList.AsEnumerable().Select(x => { var pushObj = new ExpandoObject() as IDictionary <string, Object>; string filePath = x.DocumentPath.Trim(); string phsyPath = HttpContext.Current.Server.MapPath(filePath); bool chkFile = File.Exists(phsyPath); string _uriString = Url.Link("DefaultApi", new { controller = "Home" }); var uriBuilder = new UriBuilder(_uriString); uriBuilder.Path = filePath.Replace("~/", ""); string _outputUrl = uriBuilder.ToString(); pushObj.Add("SupportDocumentID", x.SupportDocumentID); pushObj.Add("Url", _outputUrl); pushObj.Add("Valid", chkFile); return(pushObj); }); if (_res.Count() > 0) { return(Request.CreateResponse(_res)); } } var message = string.Format("File not found!"); HttpError err = new HttpError(message); return(Request.CreateResponse(HttpStatusCode.NotFound, err)); }
public static IQueryable <FrequentFlyerViewModel> GetBookAll() { MayFlower db = new MayFlower(); var FlyerModel = from ff in db.TravellerLists from user in db.Users where user.UserID == ff.CreatedByID select new FrequentFlyerViewModel { FullName = ff.FirstName + "/" + ff.FamilyName, UserID = ff.CreatedByID, IsShared = ff.IsShared, TravellerID = ff.TravellerID, IsActive = ff.IsActive, OrganizationID = user.OrganizationID, }; return(FlyerModel.AsQueryable()); }
public IQueryable <FrequentFlyerEditModel> EditFlyerDetail() { MayFlower db = new MayFlower(); var model = from gf in db.TravellerLists select new FrequentFlyerEditModel { TravellerID = gf.TravellerID, TitleCode = gf.TitleCode, FirstName = gf.FirstName, FamilyName = gf.FamilyName, DOB = gf.DOB, Nationality = gf.Nationality, Passport = gf.Passport, PassportExpiryDate = gf.PassportExpiryDate, PassportIssuePlace = gf.PassportIssuePlace, IsShared = gf.IsShared ?? false, }; return(model); }
public IQueryable <TravellerGroupEditModel> EditTraveller(int userId) { MayFlower db = new MayFlower(); var travellerModel = db.GroupNames .Where(x => x.IsActive) .Select(x => new TravellerGroupEditModel { GroupID = x.GroupID, GroupName = x.GroupName1, CreatedByID = x.CreatedByID, TravellerList = db.TravellerGroups.Where(s => s.GroupID == x.GroupID && s.TravellerList.IsActive && s.IsActive) .Select(s => s.TravellerList).ToList(), FullTravellerList = db.TravellerLists.Where(s => s.CreatedByID == userId && s.IsActive).ToList() }); return(travellerModel); }
public static RequeryStatus.Requery CheckPaymentPAID(PaymentOrder record, int superPNRId, string superPNRNo , MayFlower dbContext) { if (record.SuperPNROrder.PaymentOrders.Count == 1 && !record.SuperPNROrder.SuperPNR.Bookings.Any(x => x.BookingStatusCode == "TKI" || x.BookingStatusCode == "CON" || x.BookingStatusCode == "QPL") && !record.SuperPNROrder.SuperPNR.BookingHotels.Any(x => x.BookingStatusCode == "TKI" || x.BookingStatusCode == "CON" || x.BookingStatusCode == "QPL") && !record.SuperPNROrder.SuperPNR.EventBookings.Any(x => x.BookingStatusCode == "TKI" || x.BookingStatusCode == "CON" || x.BookingStatusCode == "QPL") && !record.SuperPNROrder.SuperPNR.BookingInsurances.Any(x => x.BookingStatusCode == "TKI" || x.BookingStatusCode == "CON" || x.BookingStatusCode == "QPL") && !record.SuperPNROrder.SuperPNR.CarRentalBookings.Any(x => x.BookingStatusCode == "TKI" || x.BookingStatusCode == "CON" || x.BookingStatusCode == "QPL") && !record.SuperPNROrder.SuperPNR.TourPackageBookings.Any(x => x.BookingStatusCode == "TKI" || x.BookingStatusCode == "CON" || x.BookingStatusCode == "QPL")) { record.PaymentStatusCode = "FAIL"; // Use edmx to remove hold credit used. var _tempCreditHold = dbContext.Temp_UserCashCreditRedeem.FirstOrDefault(x => x.OrderID == record.OrderID); if (_tempCreditHold != null) { System.Data.SqlClient.SqlCommand command = new System.Data.SqlClient.SqlCommand(); new PaymentServiceController() .TempCashCreditRedeemDelete(record.OrderID, record.CreatedByID, record.CurrencyCode, record.PaymentAmount, command); command?.Transaction?.Commit(); } record.SuperPNROrder.BookingStatusCode = "EXP"; return(new RequeryStatus.Requery { SuperPNRID = superPNRId, SuperPNRNo = superPNRNo, OrderID = record.OrderID, Amount = record.PaymentAmount, Status = false, }); } return(null); }