public override int GetHashCode()
 {
     unchecked
     {
         return(((AppGuid?.GetHashCode() ?? 0) * 397) ^ (Route?.GetHashCode() ?? 0));
     }
 }
        public ServiceResponse Save(AirPackageModel model)
        {
            try
            {
                using (var ts = new TransactionScope(TransactionScopeOption.Required))
                {
                    Air_Packages obj = new Air_Packages
                    {
                        PackageId = model.PackageId,
                        CountryId = model.CountryId,
                        ZoneId    = model.ZoneId,
                        //CityId = model.CityId,
                        PackageGroupId = model.PackageGroupId,
                        Name           = model.Name.Trim(),
                        PackageCode    = model.PackageCode,
                        URL            = model.URL.Trim(),
                        //Tags = model.Tags,
                        StartingPrice         = model.StartingPrice,
                        StartingPriceINR      = model.StartingINR,
                        StartingPriceUSD      = model.StartingUSD,
                        Overview              = model.Overview,
                        Itineary              = model.Itineary,
                        Destination           = model.Destination,
                        TermAndConditions     = model.TermAndConditions,
                        InclusiveAndExclusive = model.InclusiveAndExclusive,
                        Rate            = model.Rate,
                        ImageFolderName = AppGuid.NewGuid(Convert.ToChar("D")),
                        EffectiveFrom   = DateTime.UtcNow,
                        ExpireOn        = DateTime.UtcNow,
                        CreatedBy       = session.AppUserId,
                        CreatedDate     = currentDate,
                        IsPublish       = model.IsPublish,

                        Duration     = model.Duration,
                        Description  = model.PackageSummary,
                        IsB2CPackage = true,
                        //IsB2BPackage = model.IsB2BPackage,
                        //B2CMarkup = model.B2CMarkup,
                        //B2BMarkUp = model.B2BMarkUp,
                        isFeatured = false
                    };
                    _ent.AddToAir_Packages(obj);
                    _ent.SaveChanges();
                    ts.Complete();
                    _response = new ServiceResponse("Record successfully created!!", MessageType.Success, true, "Edit");
                    return(_response);
                }
            }
            catch (SqlException ex)
            {
                _response = new ServiceResponse(ServiceResponsesProvider.SqlExceptionMessage(ex), MessageType.SqlException, false);
            }
            catch (Exception ex)
            {
                _response = new ServiceResponse(ex.Message, MessageType.Exception, false, "Edit");
            }
            return(_response);
        }
Example #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="App"/> class.
        /// </summary>
        /// <param name="owner">The owner program.</param>
        /// <param name="plugin">The plugin.</param>
        /// <param name="assemblyName">The assembly containg the plugin code and resources.</param>
        public App(Application owner, IPluginClient plugin, string assemblyName)
        {
            Owner        = owner;
            Plugin       = plugin;
            AssemblyName = assemblyName;

            // Ensure only one instance is running at a time.
            Logger.Write(Category.Debug, "Checking uniqueness");

            try
            {
                AppGuid = Plugin.Guid;
                if (AppGuid == Guid.Empty)
                {
                    // In case the guid is provided by the project settings and not source code.
                    Contract.RequireNotNull(Assembly.GetEntryAssembly(), out Assembly EntryAssembly);
                    Contract.RequireNotNull(EntryAssembly.GetCustomAttribute <GuidAttribute>(), out GuidAttribute AppGuidAttribute);
                    AppGuid = Guid.Parse(AppGuidAttribute.Value);
                }

                string AppUniqueId = AppGuid.ToString("B").ToUpperInvariant();

                // Try to create a global named event with a unique name. If we can create it we are first, otherwise there is another instance.
                // In that case, we just abort.
                bool createdNew;
                InstanceEvent = new EventWaitHandle(false, EventResetMode.ManualReset, AppUniqueId, out createdNew);
                if (!createdNew)
                {
                    Logger.Write(Category.Warning, "Another instance is already running");
                    InstanceEvent.Close();
                    InstanceEvent = null;
                    Owner.Shutdown();
                    return;
                }
            }
            catch (Exception e)
            {
                Logger.Write(Category.Error, $"(from App) {e.Message}");

                Owner.Shutdown();
                return;
            }

            // This code is here mostly to make sure that the Taskbar static class is initialized ASAP.
            // The taskbar rectangle is never empty. And if it is, we have no purpose.
            if (TaskbarLocation.ScreenBounds.IsEmpty)
            {
                Owner.Shutdown();
            }
            else
            {
                Owner.Startup += OnStartup;

                // Make sure we stop only on a call to Shutdown. This is for plugins that have a main window, we don't want to exit when it's closed.
                Owner.ShutdownMode = ShutdownMode.OnExplicitShutdown;
            }
        }
Example #4
0
        public void AddPackage(AirPackageGroupModel _model)
        {
            Air_PackageGroups _obj = new Air_PackageGroups()
            {
                CountryId = _model.CountryId,
                ZoneId    = _model.ZoneId,
                //Cityid = _model.CityId,
                GroupName       = _model.GroupName,
                URL             = _model.URL,
                Destination     = _model.Destination,
                ImageFolderName = AppGuid.NewGuid(Convert.ToChar("D")),
                //IsB2BPackage = _model.IsB2BPackage,
                IsB2CPackage = true,
                CreatedBy    = session.AppUserId,
                CreatedDate  = currentDate,
                isFeatured   = false,
                isPublished  = true
            };

            _ent.AddToAir_PackageGroups(_obj);
            _ent.SaveChanges();
        }