Пример #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     SiteConstants sitecons = new SiteConstants();
     Response.Write("<br/>Loginid:");
     //Response.Write(sitecons.ulogin());
     Response.Write("<br/>User:"******"<br/>");
     Response.Write(Session[SiteConstants.UserValidLogin]);
     Response.Write("<br/>");
 }
Пример #2
0
        public static Vector128 <float> GetFlewellingGrowthEffectiveAge(SiteConstants site, float timeStepInYears, Vector128 <float> treeHeight, out Vector128 <float> potentialHeightGrowth)
        {
            // for now, just a vector to scalar shim for caller convenience
            // TODO: SIMD implementation
            float growthEffectiveAge0 = WesternHemlock.GetFlewellingGrowthEffectiveAge(site, timeStepInYears, Avx.Extract(treeHeight, 0), out float potentialHeightGrowth0);
            float growthEffectiveAge1 = WesternHemlock.GetFlewellingGrowthEffectiveAge(site, timeStepInYears, Avx.Extract(treeHeight, 0), out float potentialHeightGrowth1);
            float growthEffectiveAge2 = WesternHemlock.GetFlewellingGrowthEffectiveAge(site, timeStepInYears, Avx.Extract(treeHeight, 0), out float potentialHeightGrowth2);
            float growthEffectiveAge3 = WesternHemlock.GetFlewellingGrowthEffectiveAge(site, timeStepInYears, Avx.Extract(treeHeight, 0), out float potentialHeightGrowth3);

            potentialHeightGrowth = Vector128.Create(potentialHeightGrowth0, potentialHeightGrowth1, potentialHeightGrowth2, potentialHeightGrowth3);
            Vector128 <float> growthEffectiveAge = Vector128.Create(growthEffectiveAge0, growthEffectiveAge1, growthEffectiveAge2, growthEffectiveAge3);

            return(growthEffectiveAge);
        }
Пример #3
0
        /// <summary>
        /// Estimate top height for site index and tree age.
        /// </summary>
        /// <param name="SI">site index (meters) for breast height age of 50 years</param>
        /// <param name="AGE">breast height age (years)</param>
        /// <param name="HTOP">site height (meters) for given site index and age</param>
        /// <remarks>PSI is the pivoted (translated) site index from SITEF_SI.</remarks>
        public static void SITECV_F(SiteConstants site, float AGE, out float HTOP)
        {
            // apply height-age equation
            float X = AGE - 1.0F;

            if (X < site.Xk)
            {
                HTOP = site.H1 + site.PPSI * X + (1.0F - site.B1) * site.PPSI * site.Xk / (site.C + 1.0F) * (MathF.Pow((site.Xk - X) / site.Xk, site.C + 1.0F) - 1.0F);
            }
            else
            {
                float Z = X - site.Xk;
                HTOP = site.Yk + site.Alpha * (1.0F - MathV.Exp(-site.Beta * Z));
            }
        }
Пример #4
0
        /// <summary>
        /// Estimate growth effective age for Douglas-fir and grand fir using Bruce's (1981) dominant height model.
        /// </summary>
        /// <param name="site">Site growth constants.</param>
        /// <param name="treeHeight">Tree height in feet.</param>
        /// <param name="potentialHeightGrowth"></param>
        /// <returns>Growth effective age in years.</returns>
        /// <remarks>
        /// Bruce. 1981. Forest Science 27:711-725.
        /// </remarks>
        public static float GetBrucePsmeAbgrGrowthEffectiveAge(SiteConstants site, float timeStepInYears, float treeHeight, out float potentialHeightGrowth)
        {
            float XX1 = MathV.Ln(treeHeight / site.SiteIndexFromGround) / site.B1 + site.X2toB2;
            float growthEffectiveAge = 500.0F;

            if (XX1 > 0.0F)
            {
                growthEffectiveAge = MathV.Pow(XX1, 1.0F / site.B2) - site.X1;
            }

            float potentialHeight = site.SiteIndexFromGround * MathV.Exp(site.B1 * (MathV.Pow(growthEffectiveAge + timeStepInYears + site.X1, site.B2) - site.X2toB2));

            potentialHeightGrowth = potentialHeight - treeHeight;

            return(growthEffectiveAge);
        }
Пример #5
0
        /// <summary>
        /// Calculate western hemlock growth effective age and potential height growth using Flewelling's model for dominant individuals.
        /// </summary>
        /// <param name="site">Site growth constants.</param>
        /// <param name="treeHeight">Height of tree.</param>
        /// <param name="timeStepInYears"></param>
        /// <param name="growthEffectiveAge">Growth effective age of tree.</param>
        /// <param name="potentialHeightGrowth">Potential height growth increment in feet.</param>
        public static float GetFlewellingGrowthEffectiveAge(SiteConstants site, float timeStepInYears, float treeHeight, out float potentialHeightGrowth)
        {
            // For Western Hemlock compute Growth Effective Age and 5-year potential
            // or 1-year height growth using the western hemlock top height curves of
            // Flewelling.These subroutines are required:
            // SITECV_F   computes top height from site and age
            // SITEF_C computes model parameters
            // SITEF_SI   calculates an approximate psi for a given site
            // Note: Flewelling's curves are metric.
            // Site Index is not adjusted for stump height.
            float HTM = Constant.MetersPerFoot * treeHeight;

            // find growth effective age within precision of 0.01 years
            float HTOP;
            float AGE = 1.0F;
            float growthEffectiveAge;

            for (int index = 0; index < 4; ++index)
            {
                do
                {
                    AGE += 100.0F / MathV.Exp10(index);
                    if (AGE > 500.0F)
                    {
                        growthEffectiveAge = 500.0F;
                        WesternHemlock.SITECV_F(site, growthEffectiveAge, out float XHTOP1);
                        WesternHemlock.SITECV_F(site, growthEffectiveAge + timeStepInYears, out float XHTOP2);
                        potentialHeightGrowth = Constant.FeetPerMeter * (XHTOP2 - XHTOP1);
                        return(growthEffectiveAge);
                    }
                    WesternHemlock.SITECV_F(site, AGE, out HTOP);
                }while (HTOP < HTM);
                AGE -= 100.0F / MathV.Exp10(index);
            }
            growthEffectiveAge = AGE;

            // Compute top height and potential height growth
            WesternHemlock.SITECV_F(site, growthEffectiveAge + timeStepInYears, out HTOP);
            float potentialTopHeightInFeet = Constant.FeetPerMeter * HTOP;

            potentialHeightGrowth = potentialTopHeightInFeet - treeHeight;

            return(growthEffectiveAge);
        }
Пример #6
0
        public static Vector128 <float> GetBrucePsmeAbgrGrowthEffectiveAge(SiteConstants site, float timeStepInYears, Vector128 <float> treeHeight, out Vector128 <float> potentialHeightGrowth)
        {
            Vector128 <float> B1     = AvxExtensions.BroadcastScalarToVector128(site.B1);
            Vector128 <float> B2     = AvxExtensions.BroadcastScalarToVector128(site.B2);
            Vector128 <float> X2toB2 = AvxExtensions.BroadcastScalarToVector128(site.X2toB2);
            Vector128 <float> siteIndexFromGround128 = AvxExtensions.BroadcastScalarToVector128(site.SiteIndexFromGround);
            Vector128 <float> X1 = AvxExtensions.BroadcastScalarToVector128(site.X1);

            Vector128 <float> XX1                = Avx.Add(Avx.Divide(MathV.Ln(Avx.Divide(treeHeight, siteIndexFromGround128)), B1), X2toB2);
            Vector128 <float> xx1lessThanZero    = Avx.CompareLessThanOrEqual(XX1, Vector128 <float> .Zero);
            Vector128 <float> growthEffectiveAge = Avx.Subtract(MathV.Pow(XX1, Avx.Reciprocal(B2)), X1);

            growthEffectiveAge = Avx.BlendVariable(growthEffectiveAge, AvxExtensions.BroadcastScalarToVector128(500.0F), xx1lessThanZero);

            Vector128 <float> timeStepInYearsPlusX1 = AvxExtensions.BroadcastScalarToVector128(timeStepInYears + site.X1);
            Vector128 <float> potentialHeightPower  = Avx.Multiply(B1, Avx.Subtract(MathV.Pow(Avx.Add(growthEffectiveAge, timeStepInYearsPlusX1), B2), X2toB2));
            Vector128 <float> potentialHeight       = Avx.Multiply(siteIndexFromGround128, MathV.Exp(potentialHeightPower));

            potentialHeightGrowth = Avx.Subtract(potentialHeight, treeHeight);

            return(growthEffectiveAge);
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        string posi = "";
        if (Convert.ToBoolean(Session["authenticated"]) != true)
        {
            Response.Redirect("CMS_Login.aspx");
        }
        Session["CurrentPage"] = "mnt_FeatureProducts.aspx";
        if (Request["ContentGroupId"] != null)
        {
            Session["contId"] = Convert.ToInt32(Request["ContentGroupId"]);
        }

        System.Text.StringBuilder sb = new System.Text.StringBuilder();
        DataSet data = new DataSet();

        #region First Load
        bool fila = false;
        if (Request["Home"] != null)
        {

            data = Get_FeatureProduct_Main(Convert.ToInt32(Session["siteId"]), Convert.ToInt32(Session["contId"]));
            WrapperProduct.Style.Value = "margin-left:80px; float:left";
            Selection_Area.Visible = true;
        }
        else {
            IndexPos = Request["SubjID"];
            ddlSubject_Load();
            data = getAllFeaturedProductsBySubjectID(Convert.ToInt32(Session["siteId"]), Convert.ToInt32(Session["contId"]), Convert.ToInt32(Request["SubjID"]));
            div_SubjectSelection.Visible = true;
        }

        sb.AppendLine("<table width=\"943\">");
        sb.AppendLine("<tr class=\"topTable\">");
        sb.AppendLine("<td width=\"50\" height=\"30\" class=\"tableSelect\">Select</td>");
        sb.AppendLine("<td width=\"95\"></td>");
        sb.AppendLine("<td width=\"230\" class=\"productName\">Product Name</td>");
        sb.AppendLine("<td width=\"78\" class=\"item\">Item #</td>");
        sb.AppendLine("<td width=\"387\" class=\"descriptionTable\">Description</td>");
        sb.AppendLine("<td width=\"87\" class=\"priceTable\">Price</td></tr>");

        int concat = 0;
        foreach (DataTable table in data.Tables)
        {
            foreach (DataRow row in table.Rows)
            {
                if (Convert.ToInt32(row["FeatProOrdPos"]) == 0)
                {
                    posi = "";
                }
                else
                {
                    posi = Convert.ToString(row["FeatProOrdPos"]);
                    vector[concat] = Convert.ToInt32(posi);
                }
                if (fila == true)
                { sb.AppendLine("<tr>"); }
                else { sb.AppendLine("<tr class=\"whiteTable\">"); }
                if (Request["Home"] != null)
                {
                    sb.AppendLine("<td class=\"tableSelect\"><a href='mnt_FeatureProducts.aspx?Home=True&Delete=" + row["FeatPro"] + "&acc=delete&press=send' onclick=\"return confirm('Do you want to delete this Feature Product?');\"><img src=\"imagesCss/bulletTable.jpg\" /></a></td>");

                }
                else
                {
                    sb.AppendLine("<td class=\"tableSelect\"><a href='mnt_FeatureProducts.aspx?SubjID=" + Request["SubjID"] + "&Delete=" + row["FeatPro"] + " &acc=delete&press=send'  onclick=\"return confirm('Do you want to delete this Feature Product?');\"><img src=\"imagesCss/bulletTable.jpg\"/></a></td>");
                }
                sb.AppendLine("<td><img src=\""+strFolder+row["ImageTN"].ToString() +"\" /></td>");
                sb.AppendLine("<td class=\"productName\"><p>" + searchTitle(Convert.ToInt32(row["TitleID"])) + "</p></td>");
                sb.AppendLine("<td class=\"item\"><p>" + row["TitleID"].ToString() + "</p></td>");
                sb.AppendLine("<td class=\"descriptionTable\"><p>" + addin.cutDescription(row["Titletext"].ToString(), 241) + "</p></td>");
                sb.AppendLine("<td class=\"priceTable\"><p>"+row["ER_Price"].ToString()+"</p></td></tr>");
                concat++;
                contmain++;
                contpos++;
                if (fila == true)
                { fila = false; }
                else
                { fila = true; }
            }
        }
        sb.AppendLine("</TABLE>");
        btnAddFP.Visible = true;
        div_FeatureProducts.InnerHtml = sb.ToString();

        #endregion
        //--------------------------------------------------------------------------------------------------------------
        #region New
        if (Request["AddNew"] != null)
        {
            if ((Request["Mainsite"] == "0") && contmain == 3)
            {
                lbErroMax.Text = "Only 3 elements can be added as Feature products on the main site";
            }
            else
            {
                System.Text.StringBuilder sbSearch = new System.Text.StringBuilder();
                sbSearch.AppendLine("Search <br>");
                if (Request["SearchId"] != null)
                {
                    sbSearch.AppendLine("<input id=\"txtCriteria\" name=\"txtCriteria\" runat=\"server\"  value=\"" + Convert.ToString(Request["SearchID"]) + "\" />");
                }
                else
                {
                    sbSearch.AppendLine("<input id=\"txtCriteria\" name=\"txtCriteria\" runat=\"server\" />");
                }
                btnSearch.Visible = true;
                div_AddFP.InnerHtml = sbSearch.ToString();
            }
        }
        #endregion
        //----------------------------------------------------------------------------------------------------------------
        #region Search by criteria
        if (Request["SearchID"] != null)
        {
            System.Text.StringBuilder sbNew = new System.Text.StringBuilder();
            string a = Convert.ToString(Request["type"]);
            if ((Convert.ToString(Request["type"])) == "text")
            {
                data2 = getFeatureProductByTitle(Convert.ToInt32(Session["siteId"]),Convert.ToInt32(Session["contId"]),Convert.ToString(Request["SearchID"]));
            }
            else
            {
                data2 = getFeatureProductById(Convert.ToInt32(Session["siteId"]),Convert.ToInt32(Session["contId"]), Convert.ToInt32(Request["SearchID"]));
            }
            SiteConstants constants = new SiteConstants();

            sbNew.AppendLine("<input id=\"txtPosition\" readonly value=\"" + contpos + "\" type=\"hidden\" name=\"txtPosition\"/>");
            sbNew.AppendLine("<table width=\"943\">");
            sbNew.AppendLine("<tr class=\"topTable\">");
            sbNew.AppendLine("<td width=\"50\" height=\"30\" class=\"tableSelect\">Select</td>");
            sbNew.AppendLine("<td width=\"95\"></td>");
            sbNew.AppendLine("<td width=\"230\" class=\"productName\">Product Name</td>");
            sbNew.AppendLine("<td width=\"78\" class=\"item\">Item #</td>");
            sbNew.AppendLine("<td width=\"387\" class=\"descriptionTable\">Description</td>");
            sbNew.AppendLine("<td width=\"87\" class=\"priceTable\">Price</td></tr>");
            //if (data2.Tables["table"].Rows.Count != 0)
            //{
                foreach (DataTable table2 in data2.Tables)
                {
                    foreach (DataRow row in table2.Rows)
                    {

                        if (fila == true)
                        {
                            sbNew.AppendLine("<tr>");
                        }
                        else
                        {
                            sbNew.AppendLine("<tr class=\"whiteTable\"> ");
                        }
                        sbNew.AppendLine("<td class=\"tableSelect\"><input type=\"checkbox\" value=\"" + row["TitleID"].ToString() + "\" name=\"chk" + contTitle + "\" /> </td>");
                        sbNew.AppendLine("<td><img src=\""+strFolder+row["ImageTN"].ToString() +"\" /></td>");
                        sbNew.AppendLine("<td class=\"productName\"><p>" + row["Title"].ToString() + "</p></td>");
                        sbNew.AppendLine("<td class=\"item\"><p>" + row["TitleID"].ToString() + "</p></td>");
                        sbNew.AppendLine("<td class=\"descriptionTable\"><p>"+ addin.cutDescription(row["Titletext"].ToString(),241)+"</p></td>");
                        sbNew.AppendLine("<td class=\"priceTable\"><p>"+row["ER_Price"].ToString()+"</p></td></tr>");
                        if (contTitle < 499)
                        {
                            ids[contTitle] = Convert.ToInt32(row["TitleID"]);
                        }
                        contTitle++;
                        if (fila == true)
                        {
                            fila = false;
                        }
                        else
                        {
                            fila = true;
                        }
                    }

                }
                sbNew.AppendLine("</TABLE>");
                btnCancelFeat.Visible = true;
                btnSaveFeat.Visible = true;
                sbNew.AppendLine("<input name=\"contTitle\" type=\"hidden\" value=\"" + contTitle + "\" />");
                div_SearchResult.InnerHtml = sbNew.ToString();
           // }
        }
        #endregion

        #region Delete
        if (Request["Delete"] != null)
        {

            deleteFeatureProducts(Convert.ToInt32(Request["Delete"]));
            if (Request["Home"] != null)
            {
                Response.Redirect("mnt_FeatureProducts.aspx?Home=True");
            }
            else
            {
                Response.Redirect("mnt_FeatureProducts.aspx?SubjID=" + Request["SubjID"] + "&Subject=" + Request["Subject"]);
            }
        }
        #endregion
    }