Beispiel #1
0
        public void Register()
        {
            Application.Current.Use(new HtmlFromJsonProvider());
            Application.Current.Use(new PartialToStandaloneHtmlProvider());

            // Workspace home page (landing page from launchpad) dashboard alias

            Handle.GET("/", () =>
            {
                return(Self.GET("/MM0"));
            });

            Handle.GET("/MM0", () =>
            {
                MasterPage master = GetMasterPageFromSession();
                return(master);
            });

            Handle.GET("/MM0/AboutPage", () =>
            {
                MasterPage master  = GetMasterPageFromSession();
                master.CurrentPage = Self.GET("/MM0/partials/AboutPage");
                return(master);
            });

            // Client Login yapmis olmali.
            Handle.GET("/MM0/PPs", () =>
            {
                MasterPage master = GetMasterPageFromSession();
                if (master.Token != "")
                {
                    var cc = Db.SQL <CC>("select r from CC r where r.Token = ?", master.Token).FirstOrDefault();
                    if (cc == null)
                    {
                        var cu = Db.SQL <CU>("select r from CU r where r.Token = ?", master.Token).FirstOrDefault();
                        if (cu != null)
                        {
                            cc = cu.CC;
                        }
                    }
                    if (cc != null)
                    {
                        return(WrapPage <PPsPage>($"/MM0/partials/PPs/{cc.Id}"));
                    }
                }
                return(master);
            });

            // Client Login yapmis olmali.
            Handle.GET("/MM0/PPs/{?}", (string CCId) =>
            {
                MasterPage master = GetMasterPageFromSession();
                //if (master.Token == "")
                //    return "Not SignIn yet!";

                return(WrapPage <PPsPage>($"/MM0/partials/PPs/{CCId}"));
            });

            Handle.GET("/MM0/CUs/{?}", (string CCId) =>
            {
                MasterPage master = GetMasterPageFromSession();
                if (master.CUId == 0)
                {
                    return(WrapPage <CUsPage>($"/MM0/partials/CUs/{CCId}"));
                }
                return(null);
            });
            Handle.GET("/MM0/CUPs/{?}", (string CUId) =>
            {
                MasterPage master = GetMasterPageFromSession();
                if (master.CUId == 0)
                {
                    return(WrapPage <CUPsPage>($"/MM0/partials/CUPs/{CUId}"));
                }
                return(null);
            });

            Handle.GET("/MM0/TTs/{?}", (long PPId) => WrapPage <TTsPage>($"/MM0/partials/TTs/{PPId}"));

            Handle.GET("/MM0/HHs/{?}", (long PPId) => WrapPage <HHsPage>($"/MM0/partials/HHs/{PPId}"));

            Handle.GET("/MM0/HHsCumBky/{?}", (long HHId) => WrapPage <HHsPage>($"/MM0/partials/HHsCumBky/{HHId}"));

            Handle.GET("/MM0/FFs/{?}", (long PPId) => WrapPage <FFsPage>($"/MM0/partials/FFs/{PPId}"));

            Handle.GET("/MM0/FFsRpr?{?}", (string queryString) =>
            {
                return(WrapPage <FFsRpr>($"/MM0/partials/FFsRpr?{queryString}"));
            });

            Handle.GET("/MM0/confirmemail/{?}", (string token) =>
            {
                MasterPage master = GetMasterPageFromSession();
                var eMailPwd      = Hlp.DecodeQueryString(token);

                int iof      = eMailPwd.IndexOf("/");
                string eMail = eMailPwd.Substring(0, iof);
                string pwd   = eMailPwd.Substring(iof + 1);
                master.Token = "";

                CC cc = Db.SQL <CC>("select r from CC r where r.Email = ? and r.Pwd = ?", eMail, pwd).FirstOrDefault();
                if (cc != null)
                {
                    Db.Transact(() =>
                    {
                        cc.IsConfirmed = true;
                        cc.CnfTS       = DateTime.Now;
                    });

                    master.Token = cc.Token;    // MasterPage.html de dolu geldigi icin AutoSignIn i bu token ile yapar
                }
                return(master);
            });

            Handle.GET("/MM0/HHsXlsx/{?}", (long PPId) =>
            {
                return(HHsXlsx(PPId));
            });

            Handle.GET("/MM0/FFsXlsx?{?}", (string queryString) =>
            {
                string decodedQuery = HttpUtility.UrlDecode(queryString);
                NameValueCollection queryCollection = HttpUtility.ParseQueryString(decodedQuery);
                string ppid    = queryCollection.Get("ppid");
                string hhid    = queryCollection["hhid"];
                string ttid    = queryCollection["ttid"];
                string BasTrhX = queryCollection["bastrhx"];
                string BitTrhX = queryCollection["bittrhx"];

                long PPId = ppid == null ? 0 : long.Parse(ppid);
                long HHId = hhid == null ? 0 : long.Parse(hhid);
                long TTId = ttid == null ? 0 : long.Parse(ttid);
                BasTrhX   = BasTrhX ?? "";
                BitTrhX   = BitTrhX ?? "";

                return(FFsXlsx(PPId, HHId, TTId, BasTrhX, BitTrhX));
            });

            Handle.GET("/MM0/HHsCumBkyXlsx/{?}", (long HHId) =>
            {
                return(HHsCumBkyXlsx(HHId));
            });

            Handle.GET("/MM0/TTsXlsx/{?}", (long PPId) =>
            {
                return(TTsXlsx(PPId));
            });
        }