示例#1
0
    public string GetSystemConfig(string key)
    {
        UserInfo user = WebHelper.GetUserInfo();
        string   ret  = ConstantsHelper.GetHelper(user.SiteCode, user.BUCode).GetSystemConfig(key);

        return(ret);
    }
示例#2
0
        public IHttpActionResult GetEditData(Guid?id = null)
        {
            if (!id.HasValue)
            {
                var licenseeFilterSelections = _adminQueries.GetLicenseeFilterSelections();

                return(Ok(new
                {
                    Model = (EditBrandIpRegulationData)null,
                    Licensees = _brands.GetLicensees()
                                .Where(l => l.Brands.Any() && licenseeFilterSelections.Contains(l.Id))
                                .OrderBy(l => l.Name)
                                .Select(l => new { l.Id, l.Name }),
                    BlockingTypes = ConstantsHelper.GetConstantsDictionary <IpRegulationConstants.BlockingTypes>()
                }));
            }

            var ipRegulation = _service.GetIpRegulation(id.Value);
            var model        = Mapper.Map <Core.Common.Data.Admin.EditBrandIpRegulationData>(ipRegulation);

            return(Ok(new
            {
                Model = model,
                Licensees = _brands.GetLicensees()
                            .OrderBy(l => l.Name)
                            .Select(l => new { l.Id, l.Name }),
                BlockingTypes = ConstantsHelper.GetConstantsDictionary <IpRegulationConstants.BlockingTypes>()
            }));
        }
示例#3
0
        public string GetSecurityData()
        {
            var adminQueries = DependencyResolver.Current.GetService <IAdminQueries>();
            var authQueries  = DependencyResolver.Current.GetService <IAuthQueries>();
            var admin        = adminQueries.GetAdminById(CurrentUser.Id);

            var viewModel = new SecurityViewModel
            {
                UserName   = CurrentUser.UserName,
                Operations = authQueries.GetPermissions().Select(p => new PermissionViewModel
                {
                    Id     = p.Id,
                    Name   = p.Name,
                    Module = p.Module
                }),
                UserPermissions = authQueries.GetActorPermissions(admin.Id).Select(p => p.Id),
                Licensees       = admin.Licensees.Select(l => l.Id),
                Permissions     = ConstantsHelper.GetConstantsDictionary <Permissions>(),
                Categories      = ConstantsHelper.GetConstantsDictionary <Modules>(),
                IsSingleBrand   = admin.AllowedBrands.Count == 1,
                IsSuperAdmin    = admin.Role.Id == RoleIds.SuperAdminId
            };

            return(SerializeJson(viewModel));
        }
示例#4
0
    public string GetTplDownloadUrl()
    {
        UserInfo userInfo = WebHelper.GetUserInfo();
        SystemBO _bal     = BLLFactory.GetBal <SystemBO>(WebHelper.GetUserInfo());
        IList <SysMidsvcConfig> svcList = _bal.GetMidsvcList();

        if (svcList.Count() > 0)
        {
            return(svcList[0].MidSvcUrl + "/DownloadPrintTpl.ashx");
        }

        return(ConstantsHelper.GetHelper(userInfo.SiteCode, userInfo.BUCode).GetSystemConfig("LABEL_TPL_DL_URL"));
    }
示例#5
0
        /// <summary>
        /// Upades book's amount.
        /// </summary>
        private void UpdateBookAmount(BookModel bookModel)
        {
            bookModel.Amount--;
            HttpResponseMessage httpResponseMessage = ConstantsHelper.Post(bookModel, booksApiUrl + "/PutBook", httpClient);

            Journals.Clear();
            Books.Clear();
            PopulateCollections();
            if (bookModel.Amount <= 0)
            {
                var bookToRemove = Books.FirstOrDefault(b => b.Amount == 0);
                Books.Remove(bookToRemove);
            }
        }
示例#6
0
        /// <summary>
        /// Updates journal's amount.
        /// </summary>
        private void UpdateJournalAmount(JournalModel journalModel)
        {
            journalModel.Amount--;
            HttpResponseMessage httpResponseMessage = ConstantsHelper.Post(journalModel, booksApiUrl + "/PutJournal", httpClient);

            Journals.Clear();
            Books.Clear();
            PopulateCollections();

            if (journalModel.Amount <= 0)
            {
                var journalToRemove = Journals.FirstOrDefault(j => j.Amount == 0);
                Journals.Remove(journalToRemove);
            }
        }
示例#7
0
        public IHttpActionResult GetEditData(Guid?id = null)
        {
            EditAdminIpRegulationData data = null;

            if (id.HasValue)
            {
                var ipRegulation = _service.GetIpRegulation(id.Value);
                data = Mapper.Map <EditAdminIpRegulationData>(ipRegulation);
            }

            return(Ok(new
            {
                Model = data,
                Licensees = _brands.GetLicensees().Select(l => new { l.Id, l.Name }),
                BlockingTypes = ConstantsHelper.GetConstantsDictionary <IpRegulationConstants.BlockingTypes>()
            }));
        }
示例#8
0
        /// <summary>
        /// Posts new book to the server.
        /// </summary>
        public void AddBook()
        {
            AbstractBookModel   abstractBook = null;
            HttpResponseMessage httpResponse = null;

            if (IsJournal)
            {
                abstractBook = GetJournal();
                if (abstractBook != null)
                {
                    httpResponse = ConstantsHelper.Post(abstractBook, booksApiUrl + "/PostJournal", httpClient);
                    var addedBook = httpResponse.Content.ReadAsAsync <JournalModel>().Result;
                    Journals.Add(addedBook);
                }
            }
            else if (IsBook)
            {
                abstractBook = GetBook();
                if (abstractBook != null)
                {
                    httpResponse = ConstantsHelper.Post(abstractBook, booksApiUrl + "/PostBooks", httpClient);
                    var addedBook = httpResponse.Content.ReadAsAsync <BookModel>().Result;
                    Books.Add(addedBook);
                }
            }
            else
            {
                Message = "Book or journal must be choose";
            }


            if (httpResponse != null)
            {
                if (httpResponse.IsSuccessStatusCode)
                {
                    Message = $"{abstractBook.Name} has been added successfully";
                }

                else
                {
                    Message = "There was an error! check the fields to see if anything is missing";
                }
            }
        }
示例#9
0
        static void Main()
        {
            // Setup Application Constants


            Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException);
            Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);

            // Setup JIRA integration
            //

            DevExpress.UserSkins.OfficeSkins.Register();
            DevExpress.UserSkins.BonusSkins.Register();
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(true);
            // Configure the connection string helper
            ConnectionHelper.Configure(RegKey, PrevConnectionStringKey);
            if (Control.ModifierKeys == Keys.Shift)
            {
                Application.Run(new ConnectionChoices());
                Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException);
                //Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
            }

            MyGeneration.dOOdads.BusinessEntity.RegistryConnectionString = ConnectionHelper.CurrentConnection.ToString();
            ConnectionManager.ConnectionString = ConnectionHelper.CurrentConnection.ToString();
            LookupKernel = new LookupKernel(new WarehouseContext(ConnectionManager.ConnectionString), new DefaultBindingManager());

            HCMIS.Logging.LogManager.ConnectionString = HCMIS.Security.Settings.ConnectionString = ConnectionHelper.CurrentConnection.ToString();

            StockoutIndexBuilder.Settings.ConnectionString = ConnectionHelper.CurrentConnection.ToString();
            HCMIS.Modules.Requisition.CacheSetting.LoadConfigurationForCaching();
            ConstantsHelper.LoadAllConstants();

            Application.Run(new LoginForm());
        }
示例#10
0
 public static void UpdatePluginConstants()
 {
     ConstantsHelper.UpdatePluginConstants();
 }
示例#11
0
        public void ConstantsHelper_InvalidItem()
        {
            var _result = ConstantsHelper.IsValid(typeof(StandardEntryClassCodeConstant), "BadValue");

            Assert.Equal(false, _result);
        }
示例#12
0
        public void ConstantsHelper_ValidItem()
        {
            var _result = ConstantsHelper.IsValid(typeof(StandardEntryClassCodeConstant), "CCD");

            Assert.Equal(true, _result);
        }