Esempio n. 1
0
        public virtual void ProcessRequest(HttpContext context)
        {
            string htmltext = string.Empty;
            string guid     = string.Empty;
            int    ww;
            int    wh;
            int    x;
            int    y;
            int    cw;
            int    ch;

            htmltext = context.Request["HTML"];
            ww       = Convert.ToInt32(context.Request["ww"]);
            wh       = Convert.ToInt32(context.Request["wh"]);
            x        = Convert.ToInt32(context.Request["x"]);
            y        = Convert.ToInt32(context.Request["y"]);
            cw       = Convert.ToInt32(context.Request["cw"]);
            ch       = Convert.ToInt32(context.Request["ch"]);
            guid     = Guid.NewGuid().ToString();

            using (OracleConnection conn = new OracleConnection(context.Cache["ORASTR"].ToString()))
            {
                conn.Open();
                OracleCommand     comm  = conn.CreateCommand();
                OracleParameter[] parms = new OracleParameter[] {
                    new OracleParameter(":GUID", OracleType.VarChar),
                    new OracleParameter(":DATA", OracleType.NClob),
                };
                parms[0].Value = guid;
                parms[1].Value = htmltext;

                comm.CommandText = SQL_INSERT;
                comm.CommandType = CommandType.Text;
                foreach (OracleParameter parm in parms)
                {
                    comm.Parameters.Add(parm);
                }
                comm.ExecuteNonQuery();
            }
            string URL = context.Request.Url.AbsoluteUri.Substring(0, context.Request.Url.AbsoluteUri.IndexOf("SVR/GetSnap.ashx"));
            string url = URL + "Delegate.aspx?q=" + guid + "&w=" + ww + "&h=" + wh;

            string PATH = @"" + context.Server.MapPath(@"~") + context.Cache["CACHEPATH"].ToString() + guid + ".png";

            SnapParams para = new SnapParams(url, PATH, ww, wh, x, y, cw, ch);
            SnapResult res  = SnapUtil.Snap(para);

            context.Response.Write("window.open('" + URL + context.Cache["CACHEURL"].ToString() + guid + ".png')");
        }
Esempio n. 2
0
        public double SnapY(double original, bool snap)
        {
            var prop = Context.CurrentCanvas.GetProperties();

            return(snap == true?SnapUtil.Snap(original, prop.SnapY) : original);
        }