Esempio n. 1
0
    public IEnumerable <CashValueUI> GetCashValuesByPolicy([FromUri] PoliciesFilter filter)
    {
        ProfileCommon profile = APIhelper.GetProfileCommon(Request);
        web_Company   wc      = DB.GetCompanyByID(profile.CompanyID);

        return(CashValueUI.GetCashValuesByPolicy(profile, wc, filter));
    }
 public HomeController(ILogger <HomeController> logger, APIhelper ApiHelper, Adhelper Adhelper)
 {
     _logger               = logger;
     _ApiHelper            = ApiHelper;
     ViewBag.UserConfirmed = false;
     _Adhelper             = Adhelper;
 }
Esempio n. 3
0
    public IEnumerable <PremiumListUI> GetPremiumsByCompanyUI([FromUri] string id)
    {
        ProfileCommon profile   = APIhelper.GetProfileCommon(Request);
        int           companyId = DB.GetBorrowerClientCompanyId(profile, id);

        return(PremiumListUI.GetPremiumsByCompanyUI(companyId, profile, id));
    }
Esempio n. 4
0
    public IHttpActionResult GetDownload(string id)
    {
        IHttpActionResult result  = null;
        ProfileCommon     profile = APIhelper.GetProfileCommon(Request);

        if (!string.IsNullOrEmpty(id))
        {
            web_Document doc = GetWebDocument(id);

            if (doc != null)
            {
                string file = Path.Combine(Util.GetAppSettings("DocRoot") + doc.Path);

                var fileinfo = new FileInfo(file);
                try
                {
                    if (!fileinfo.Exists)
                    {
                        throw new FileNotFoundException(fileinfo.Name);
                    }

                    result = new FileActionResult(file);
                }
                catch (Exception ex)
                {
                    result = ResponseMessage(Request.CreateErrorResponse(HttpStatusCode.NotFound, "File not found"));
                }
            }
        }

        return(result);
    }
Esempio n. 5
0
    public DocumentUI GetDocument([FromUri] DocumentsFilter filter)
    {
        ProfileCommon profile   = APIhelper.GetProfileCommon(Request);
        int           companyId = DB.GetBorrowerClientCompanyId(profile, filter.BorrowerId);

        return(DocumentUI.GetDocument(companyId, filter.DocumentId));
    }
Esempio n. 6
0
    private IEnumerable <DocumentUI> GetDocumentsByCompany(DocumentsFilter filter)
    {
        ProfileCommon profile = APIhelper.GetProfileCommon(Request);
        web_Company   wc      = DB.GetCompanyByID(profile.CompanyID);

        return(DocumentUI.GetDocumentsByCompanyUI(profile,
                                                  wc,
                                                  filter.BorrowerId,
                                                  filter.FileType));
    }
Esempio n. 7
0
    public IEnumerable <string> GetDocumentConfigs(int id)
    {
        ProfileCommon profile = APIhelper.GetProfileCommon(Request);

        if (Security.IsAdmin(profile) || Security.IsSuperAdmin(profile))
        {
            return(DB.GetDocumentConfigsByCompanyId(id));
        }
        else
        {
            return(new List <string>());
        }
    }
Esempio n. 8
0
    public HttpResponseMessage Download(string documentID)
    {
        Log.LogSubType subType = Log.LogSubType.DocumentIDInvalid;
        ProfileCommon  profile = APIhelper.GetProfileCommon(Request);
        bool           error   = true;

        if (!string.IsNullOrEmpty(documentID))
        {
            web_Document doc = GetWebDocument(documentID);

            if (doc != null)
            {
                string file = Path.Combine(Util.GetAppSettings("DocRoot") + doc.Path);

                if (File.Exists(file))

                {
                    var response = new HttpResponseMessage(HttpStatusCode.OK);
                    var stream   = new FileStream(file, FileMode.Open);
                    var fileInfo = new FileInfo(file);
                    response.Content = new StreamContent(stream);
                    response.Content.Headers.ContentLength      = stream.Length;
                    response.Content.Headers.ContentType        = new MediaTypeHeaderValue(Util.GetMimeTypeFromExtension(fileInfo.Extension));
                    response.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment")
                    {
                        FileName = fileInfo.Name
                    };

                    return(response);
                }
                else
                {
                    subType = Log.LogSubType.DocumentNotFound;
                    Log.WriteLog(Log.LogType.Exception, User.Identity.Name, subType, documentID, file, null);
                }
            }
            else
            {
                subType = Log.LogSubType.DocumentRecordMissing;
                Log.WriteLog(Log.LogType.Exception, profile.UserName, subType, documentID, null, null);
            }
        }

        if (error)
        {
            Log.WriteLog(Log.LogType.Exception, profile.UserName, subType, documentID, null, null);
        }

        return(new HttpResponseMessage(HttpStatusCode.OK));
    }
Esempio n. 9
0
    private web_Document GetWebDocument(string id)
    {
        web_Document  doc     = null;
        ProfileCommon profile = APIhelper.GetProfileCommon(Request);

        using (PolicyDataSourceDataContext db = new PolicyDataSourceDataContext())
        {
            db.ObjectTrackingEnabled = false;
            doc = (from d in db.web_Documents
                   where d.DocumentID == id &&
                   (d.CompanyID == profile.CompanyID)
                   select d).FirstOrDefault();
        }

        return(doc);
    }
Esempio n. 10
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            DispatcherHelper.UIDispatcher = Dispatcher;
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;

            var uch = new UpdateCheckHelper();

            uch.UpdateCheck();

            if (Settings.Initialize())
            {
                APIhelper.BuildBaseUrl();
            }

            var mw = new MainWindow();

            mw.Show();
        }
Esempio n. 11
0
        public async void Initialize()
        {
            if (Settings.Initialize() == false)
            {
                var cw = new ConfigWindow();
                cw.Topmost = true;
                cw.ShowDialog();

                APIhelper.BuildBaseUrl();
            }

            _model = new Model();
            _sw    = new Stopwatch();

            var modelListener = new PropertyChangedEventListener(_model);

            modelListener.RegisterHandler(ModelUpdateHandler);
            CompositeDisposable.Add(modelListener);

            _timer = new Timer {
                Interval = 100
            };
            _timer.Elapsed += (sender, e) => Timer_Tick();
            _timer.Start();

            PlayState = State.Stopped;

            Volume       = Settings.Volume;
            VolumeString = Convert.ToInt32(Volume * 100) + " %";

            CurrentRepeatState = (RepeatState)Settings.RepeatState;

            LibraryListHeaderImage  = null;
            LibraryListHeaderTitle  = null;
            LibraryListHeaderArtist = null;

            await Task.Run(() => _model.GetIndex());
        }
 /// <summary>
 /// Controller for Users. takes APIhelper, SessioinHelper and Adhelper as DependencyInjection
 /// </summary>
 /// <param name="APIhelper">Communicates with API</param>
 /// <param name="SessionHelper">Deserialises users from session to correct subtype</param>
 /// <param name="Adhelper">Helps to show ads</param>
 public UsersController(APIhelper APIhelper, SessionHelper SessionHelper, Adhelper Adhelper)
 {
     _APIhelper     = APIhelper;
     _SessionHelper = SessionHelper;
     _Adhelper      = Adhelper;
 }
Esempio n. 13
0
    public IEnumerable <PremiumListUI> GetByPolicyUI([FromUri] PoliciesFilter filter)
    {
        ProfileCommon profile = APIhelper.GetProfileCommon(Request);

        return(PremiumListUI.GetPremiumsByPolicyUI(profile, filter));
    }
 /// <summary>
 /// Constructor for AdvertisementController
 /// The parameters are dependency injections
 /// </summary>
 public TournamentController(APIhelper aPIhelper, SessionHelper SessionHelper, Adhelper Adhelper)
 {
     _APIhelper     = aPIhelper;
     _SessionHelper = SessionHelper;
     _Adhelper      = Adhelper;
 }
 /// <summary>
 /// Constructor for AdvertisementController
 /// The parameters are dependency injections
 /// </summary>
 public AdvertisementController(APIhelper aPIhelper, SessionHelper SessionHelper, Adhelper Adhelper)
 {
     _APIhelper     = aPIhelper;
     _SessionHelper = SessionHelper;
     _Adhelper      = Adhelper;
 }