Exemplo n.º 1
0
    protected new void Page_Load(object sender, EventArgs e)
    {
        base.AllowHttpMethod("POST");
        base.DisableTop(false);

        int ID = GetNumber <int>("i");

        DownloadVM VM = new DownloadVM(ID);

        var user = AuthServer.GetLoginUser();

        DataTable dt = MSDB.GetDataTable("ConnDB", "dbo.usp_FileM_xGetFileInfoByID"
                                         , new Dictionary <string, object>()
        {
            { "@ID", VM.ID },
            { "@OrgID", user.OrgID }
        });

        if (dt.Rows.Count > 0)
        {
            string Json = JsonConvert.SerializeObject(VM);
            string code = QueryStringEncryptToolS.Encrypt(Json);
            Response.Redirect(WebConfigurationManager.AppSettings["FileServerURL"] + "/livestorage.aspx?o=" + HttpUtility.UrlEncode(code));
            Response.End();
        }
        else
        {
            Response.Redirect("~/html/ErrorPage/NoPower.html");
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        int ID = GetNumber <int>("i");

        DownloadVM VM = new DownloadVM(ID);

        var user = AuthServer.GetLoginUser();


        DataTable dt = GetDataTable("ConnDB", "dbo.usp_FileM_xGetFileInfoByID"
                                    , new Dictionary <string, object>()
        {
            { "@ID", ID },
            { "@OrgID", user.OrgID }
        });



        if (dt.Rows.Count > 0)
        {
            string Json = JsonConvert.SerializeObject(VM);
            string code = QueryStringEncryptToolS.Encrypt(Json);
            Response.Redirect("http://niis_fs.hyweb.com.tw/livestorage.aspx?o=" + HttpUtility.UrlEncode(code));
            //Response.Redirect("http://localhost:64351/livestorage.aspx?o=" + HttpUtility.UrlEncode(code));
            Response.End();
        }
        else
        {
            Response.Redirect("~/html/ErrorPage/NoPower.html");
        }
    }
Exemplo n.º 3
0
    public static string Decrypt(string text)
    {
        string key  = WebConfigurationManager.AppSettings["QueryStringEncryptKey"].ToString();
        string salt = WebConfigurationManager.AppSettings["QueryStringEncryptSalt"].ToString();

        return(QueryStringEncryptToolS.DecryptString(text, key, salt));
    }
Exemplo n.º 4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        base.AllowHttpMethod("GET");
        base.DisableTop(false);
        base.BodyClass = "class='leftblock'";


        UserVM user = AuthServer.GetLoginUser();

        if (user == null)
        {
            return;
        }

        if (WebConfigurationManager.AppSettings["HasCacheMenu"] == null || Convert.ToBoolean(WebConfigurationManager.AppSettings["HasCacheMenu"]) == false)
        {
            MyTreeData = GetMenu(user);
        }
        else
        {
            if (user.MenuJson != null && user.MenuJson.Trim().Equals("") == false)
            {
                MyTreeData = user.MenuJson;
            }
            else
            {
                MyTreeData    = GetMenu(user);
                user.MenuJson = MyTreeData;
                AuthServer.SetLoginUser(user);
            }
        }


        string    encryptedJsonString = Request["o"] ?? "";
        string    decryptedJsonString = QueryStringEncryptToolS.Decrypt(encryptedJsonString);
        HomeUrlVM VM = JsonConvert.DeserializeObject <HomeUrlVM>(decryptedJsonString);
        string    HomeUrlValidPeriodMinute = WebConfigurationManager.AppSettings["HomeUrlValidPeriodMinute"];
        int       minute = 0;

        int.TryParse(HomeUrlValidPeriodMinute, out minute);


        if (VM != null && VM.date != null && DateTime.Compare(DateTime.Now.Add(TimeSpan.FromMinutes(minute)), VM.date) >= 0)
        {
            if (VM.PageUrl.Equals("") == false)
            {
                PageUrl = VM.PageUrl;
            }
        }

        //Response.ContentType = "application/json; charset=utf-8";
        //Response.Write(Rtn);
        //Response.End();
    }
Exemplo n.º 5
0
    protected new void Page_Load(object sender, EventArgs e)
    {
        PassLogVM VM = new PassLogVM();
        Dictionary <string, object> dict = new Dictionary <string, object>();

        VM.TableName = TableName;
        VM.WhereDict = WhereDict;
        string Json = JsonConvert.SerializeObject(VM);

        //jsonString = Json;
        jsonString = QueryStringEncryptToolS.Encrypt(Json);
    }
Exemplo n.º 6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int ID = 0;

        int.TryParse(Request["i"], out ID);

        DownloadVM VM = new DownloadVM(ID);

        string Json = JsonConvert.SerializeObject(VM);
        string code = QueryStringEncryptToolS.Encrypt(Json);

        Response.Redirect("http://niis_fs.hyweb.com.tw/livestorage.aspx?o=" + HttpUtility.UrlEncode(code));
        Response.End();
    }
Exemplo n.º 7
0
    protected new void Page_Load(object sender, EventArgs e)
    {
        base.AllowHttpMethod("POST");

        if (Request.HttpMethod.Equals("POST"))
        {
            PageUrl        = QueryStringEncryptToolS.Decrypt(GetString("p"));
            EncryptPageUrl = QueryStringEncryptToolS.Encrypt(PageUrl);

            HasViewPower = CheckPower(PageUrl, MyPowerEnum.瀏覽);
            if (HasViewPower == false)
            {
                throw new HttpException(404, "Not found");
            }
            HasSearchPower = CheckPower(PageUrl, MyPowerEnum.查詢);


            var all      = SystemOrg.list;
            int minValue = 0;
            int maxValue = 0;
            if (all.Count > 0)
            {
                minValue = all[0].PID;
                maxValue = all[all.Count - 1].PID;
            }
            IEnumerable <SystemOrgVM> conditionList = new List <SystemOrgVM>()
            {
                SystemOrg.GetVM(AuthServer.GetLoginUser().OrgID)
            };
            IEnumerable <SystemOrgVM> queryList = new List <SystemOrgVM>();
            List <SystemOrgVM>        FinalList = new List <SystemOrgVM>()
            {
                SystemOrg.GetVM(AuthServer.GetLoginUser().OrgID)
            };
            do
            {
                queryList = GetChild(all, conditionList, minValue, maxValue);
                FinalList.AddRange(queryList);
                conditionList = queryList;
            } while (queryList.Count() > 0);

            MyTreeData = JsonConvert.SerializeObject(FinalList);
        }
        else
        {
            Response.Write("");
            Response.End();
        }
    }
Exemplo n.º 8
0
    protected new void Page_Load(object sender, EventArgs e)
    {
        base.AllowHttpMethod("GET", "POST");
        base.DisableTop(false);
        //Response.Write(Request.HttpMethod);
        if (Request.HttpMethod.Equals("POST"))
        {
            PageUrl        = QueryStringEncryptToolS.Decrypt(base.GetString("p"));
            EncryptPageUrl = QueryStringEncryptToolS.Encrypt(PageUrl);

            bool.TryParse(GetString("hf"), out hasFilter);

            //AddOrgLevel4 = GetString("addlv4");

            if (hasFilter)
            {
                loginOrgID = AuthServer.GetLoginUser().OrgID.ToString();
            }

            agencyState = GetNumber <int>("as");

            HasViewPower = CheckPower(PageUrl, MyPowerEnum.瀏覽);
            if (HasViewPower == false)
            {
                throw new HttpException(404, "Not found");
            }
            HasSearchPower = CheckPower(PageUrl, MyPowerEnum.查詢);

            PageCL CL = new PageCL();
            tbData = CL.GetList(new List <AgencyInfoVM>(), "ConnDB", "dbo.usp_ParameterM_xGetAgencyListByMany",
                                new Dictionary <string, object>()
            {
                { "@AgencyCounty", 0 },
                { "@AgencyTown", 0 },
                { "@AgencyVillage", 0 },
                { "@AgencyState", 0 },
                { "@AgencyName", "" },
                { "@pgNow", 1 },
                { "@pgSize", 10 }
            });
        }
        else
        {
            Response.Write("");
            Response.End();
        }
    }
Exemplo n.º 9
0
    protected void Page_Load(object sender, EventArgs e)
    {
        base.AllowHttpMethod("POST");
        base.DisableTop(false);
        base.BodyClass = "class='bodybg'";

        int ID = 0;

        int.TryParse(Request.Form["i"], out ID);

        DownloadVM VM = new DownloadVM(ID);

        var user = AuthServer.GetLoginUser();

        DataTable dt = new DataTable();

        using (SqlConnection sc = new SqlConnection(WebConfigurationManager.ConnectionStrings["ConnDB"].ToString()))
        {
            using (SqlCommand cmd = new SqlCommand("dbo.usp_FileM_xGetFileInfoByID", sc))
            {
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@ID", VM.ID);
                cmd.Parameters.AddWithValue("@RoleID", user.OrgID);
                cmd.CommandType = CommandType.StoredProcedure;
                using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                {
                    sc.Open();
                    da.Fill(dt);
                }
            }
        }

        if (dt.Rows.Count > 0)
        {
            string Json = JsonConvert.SerializeObject(VM);
            string code = QueryStringEncryptToolS.Encrypt(Json);
            Response.Redirect("http://niis_fs.hyweb.com.tw/livestorage.aspx?o=" + HttpUtility.UrlEncode(code));
            //Response.Redirect("http://localhost:64351/livestorage.aspx?o=" + HttpUtility.UrlEncode(code));
            Response.End();
        }
        else
        {
            Response.Redirect("~/html/ErrorPage/NoPower.html");
        }
    }
Exemplo n.º 10
0
    protected new void Page_Load(object sender, EventArgs e)
    {
        base.AllowHttpMethod("GET", "POST");

        if (Request.HttpMethod.Equals("POST"))
        {
            int ID = 0;
            int.TryParse(QueryStringEncryptToolS.Decrypt(GetString("i")), out ID);

            DownloadVM VM = new DownloadVM(ID);

            var user = AuthServer.GetLoginUser();

            //DataTable dt = MSDB.GetDataTable("ConnDB", "dbo.usp_FileM_xGetFileInfoByID"
            //                              , new Dictionary<string, object>()
            //                              {
            //                                        { "@ID", VM.ID },
            //                                        { "@OrgID",  user.OrgID }
            //                              });

            //if (dt.Rows.Count > 0)
            //{
            string Json = JsonConvert.SerializeObject(VM);
            string code = QueryStringEncryptToolS.Encrypt(Json);
            Response.Write("<script>window.open('" + WebConfigurationManager.AppSettings["FileServerURL"] + "/livestorage.aspx?o=" + HttpUtility.UrlEncode(code) + "','_blank');</script>");
            Response.End();
            //}
            //else
            //{
            //    Response.Redirect("~/html/ErrorPage/NoPower.html");
            //}
        }
        else
        {
            Response.Write("");
            Response.End();
        }
    }
Exemplo n.º 11
0
    protected new void Page_Load(object sender, EventArgs e)
    {
        base.AllowHttpMethod("POST");

        var PageUrl = QueryStringEncryptToolS.Decrypt(base.GetString("p"));

        bool hasFilter = false;

        bool.TryParse(base.GetString("hf"), out hasFilter);

        var HasViewPower = CheckPower(PageUrl, MyPowerEnum.瀏覽);

        if (HasViewPower == false)
        {
            throw new HttpException(404, "Not found");
        }

        string AgencyName = GetString("an");
        //string AddOrgLevel4 = GetString("addlv4");
        int AgencyCounty  = GetNumber <int>("ac");
        int AgencyTown    = GetNumber <int>("at");
        int AgencyVillage = GetNumber <int>("av");
        int AgencyState   = GetNumber <int>("as");
        int pgNow         = GetNumber <int>("pgNow");
        int pgSize        = GetNumber <int>("pgSize");

        PageCL CL = new PageCL();
        string tbData;

        if (hasFilter)
        {
            tbData = CL.GetList(new List <AgencyInfoVM>(), "ConnDB", "dbo.usp_ParameterM_xGetAgencyListByOrgID",
                                new Dictionary <string, object>()
            {
                { "@AgencyCounty", AgencyCounty },
                { "@AgencyTown", AgencyTown },
                { "@AgencyVillage", AgencyVillage },
                { "@AgencyState", AgencyState },
                { "@AgencyName", AgencyName },
                //{ "@AddOrgLevel4", AddOrgLevel4 },
                { "@OrgID", AuthServer.GetLoginUser().OrgID.ToString() },
                { "@pgNow", pgNow == 0 ? 1 : pgNow },
                { "@pgSize", pgSize == 0 ? 10 : pgSize }
            });
        }
        else
        {
            tbData = CL.GetList(new List <AgencyInfoVM>(), "ConnDB", "dbo.usp_ParameterM_xGetAgencyListByMany",
                                new Dictionary <string, object>()
            {
                { "@AgencyCounty", AgencyCounty },
                { "@AgencyTown", AgencyTown },
                { "@AgencyVillage", AgencyVillage },
                { "@AgencyState", AgencyState },
                { "@AgencyName", AgencyName },
                { "@pgNow", pgNow == 0 ? 1 : pgNow },
                { "@pgSize", pgSize == 0 ? 10 : pgSize }
            });
        }

        Response.ContentType = "application/json; charset=utf-8";
        Response.Write(tbData);
        Response.End();
    }
Exemplo n.º 12
0
 protected new void Page_Load(object sender, EventArgs e)
 {
     EncryptPageUrl = QueryStringEncryptToolS.Encrypt(PageUrl);
 }
Exemplo n.º 13
0
    protected new void Page_Load(object sender, EventArgs e)
    {
        base.AllowHttpMethod("GET", "POST");

        if (Request.HttpMethod.Equals("POST"))
        {
            PageUrl        = QueryStringEncryptToolS.Decrypt(GetString("p"));
            EncryptPageUrl = QueryStringEncryptToolS.Encrypt(PageUrl);

            HasViewPower = CheckPower(PageUrl, MyPowerEnum.瀏覽);
            if (HasViewPower == false)
            {
                throw new HttpException(404, "Not found");
            }
            HasSearchPower = CheckPower(PageUrl, MyPowerEnum.查詢);

            var       user = AuthServer.GetLoginUser();
            DataTable dt   = new DataTable();

            using (SqlConnection sc = new SqlConnection(WebConfigurationManager.ConnectionStrings["ConnUser"].ToString()))
            {
                using (SqlCommand cmd = new SqlCommand("dbo.usp_PowerM_xGetOrgByOrgID", sc))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@OrgID", user.OrgID);
                    using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                    {
                        sc.Open();
                        da.Fill(dt);
                    }
                }
            }

            List <SystemOrgVM> list = new List <SystemOrgVM>();
            EntityS.FillModel(list, dt);

            //var all = SystemOrg.list;
            //int minValue = 0;
            //int maxValue = 0;
            //if (all.Count > 0)
            //{
            //    minValue = all[0].PID;
            //    maxValue = all[all.Count-1].PID;
            //}
            //IEnumerable<SystemOrgVM> conditionList = new List<SystemOrgVM>() { SystemOrg.GetVM(AuthServer.GetLoginUser().OrgID) };
            //IEnumerable<SystemOrgVM> queryList = new List<SystemOrgVM>();
            //List<SystemOrgVM> FinalList = new List<SystemOrgVM>() { SystemOrg.GetVM(AuthServer.GetLoginUser().OrgID) };
            //int maxLevel = 10;
            //int i = 0;
            //do
            //{
            //    queryList = GetChild(all, conditionList, minValue, maxValue);
            //    FinalList.AddRange(queryList);
            //    conditionList = queryList;
            //    i++;
            //} while (queryList.Count() > 0 && i < maxLevel);

            list       = list.Where(item => item.OrgLevel < 5).ToList();
            MyTreeData = JsonConvert.SerializeObject(list);
        }
        else
        {
            Response.Write("");
            Response.End();
        }
    }
Exemplo n.º 14
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            string     encryptedJsonString = Request["o"] ?? "";
            string     decryptedJsonString = QueryStringEncryptToolS.Decrypt(encryptedJsonString);
            DownloadVM VM = JsonConvert.DeserializeObject <DownloadVM>(decryptedJsonString);
            string     DownloadValidPeriodSecond = WebConfigurationManager.AppSettings["DownloadValidPeriodSecond"];
            int        second = 0;
            int.TryParse(DownloadValidPeriodSecond, out second);

            DateTime maxDate = DateTime.Now.Add(TimeSpan.FromSeconds(second));
            //10秒緩衝
            DateTime minDate = DateTime.Now.Add(TimeSpan.FromSeconds(-10));
            if (VM != null && VM.date != null && DateTime.Compare(VM.date, minDate) >= 0 && DateTime.Compare(VM.date, maxDate) <= 0)
            {
                if (VM.ID > 0)
                {
                    DataTable dt = new DataTable();
                    using (SqlConnection sc = new SqlConnection(WebConfigurationManager.ConnectionStrings["ConnDB"].ToString()))
                    {
                        using (SqlCommand cmd = new SqlCommand("dbo.usp_FileM_xGetFileInfoByID", sc))
                        {
                            cmd.CommandType = CommandType.StoredProcedure;
                            cmd.Parameters.AddWithValue("@ID", VM.ID);
                            cmd.CommandType = CommandType.StoredProcedure;
                            using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                            {
                                sc.Open();
                                da.Fill(dt);
                            }
                        }
                    }

                    FileInfoVM file = new FileInfoVM();
                    EntityS.FillModel(file, dt);

                    //string folderName = "";
                    //switch (file.FileCateID)
                    //{
                    //    case 1:
                    //        folderName = "DocumentM";
                    //        break;
                    //}
                    string filePath = Path.Combine(WebConfigurationManager.AppSettings["AttachmentPath"], file.FolderName, file.CreatedDate.Year.ToString(), file.CreatedDate.Month.ToString(), file.CreatedDate.Day.ToString(), file.StorageFileName);

                    if (File.Exists(filePath))
                    {
                        Response.ContentType = "application/download";
                        Response.AddHeader("content-disposition", "attachment;filename=" + Server.UrlEncode(file.DisplayFileName));
                        Response.TransmitFile(filePath);
                        Response.End();
                    }
                    else
                    {
                        throw new HttpException(404, "Not found");
                    }
                }
            }
            else
            {
                throw new HttpException(404, "Not found");
            }
        }
        catch
        {
            throw new HttpException(404, "Not found");
        }
    }
Exemplo n.º 15
0
    protected new void Page_Load(object sender, EventArgs e)
    {
        base.AllowHttpMethod("GET", "POST");
        base.DisableTop(false);

        if (Request.HttpMethod.Equals("POST"))
        {
            PageUrl        = QueryStringEncryptToolS.Decrypt(GetString("p"));
            EncryptPageUrl = QueryStringEncryptToolS.Encrypt(PageUrl);

            HasViewPower = CheckPower(PageUrl, MyPowerEnum.瀏覽);
            if (HasViewPower == false)
            {
                throw new HttpException(404, "Not found");
            }
            HasSearchPower = CheckPower(PageUrl, MyPowerEnum.查詢);


            var all = SystemOrg.list;

            //if (Convert.ToInt32(WebConfigurationManager.AppSettings["OrgAreaSet"]) == 0)
            //{
            //    all.RemoveAll(item => item.OrgLevel == 2);
            //    all = all.Select(item =>
            //    {
            //        if (item.OrgLevel == 3)
            //        {
            //            item.PID = 1;
            //        }
            //        return item;
            //    }).ToList<SystemOrgVM>();
            //}

            int minValue = 0;
            int maxValue = 0;
            if (all.Count > 0)
            {
                minValue = all[0].PID;
                maxValue = all[all.Count - 1].PID;
            }
            IEnumerable <SystemOrgVM> conditionList = new List <SystemOrgVM>()
            {
                SystemOrg.GetVM(AuthServer.GetLoginUser().OrgID)
            };
            IEnumerable <SystemOrgVM> queryList = new List <SystemOrgVM>();
            List <SystemOrgVM>        FinalList = new List <SystemOrgVM>()
            {
                SystemOrg.GetVM(AuthServer.GetLoginUser().OrgID)
            };
            do
            {
                queryList = GetChild(all, conditionList, minValue, maxValue);
                FinalList.AddRange(queryList);
                conditionList = queryList;
            } while (queryList.Count() > 0);

            MyTreeData = JsonConvert.SerializeObject(FinalList);
        }
        else
        {
            Response.Write("");
            Response.End();
        }
    }