protected override void AttachChildControls()
 {
     this.listOrders  = (System.Web.UI.WebControls.Repeater) this.FindControl("listOrders");
     this.panl_nodata = (System.Web.UI.WebControls.Panel) this.FindControl("panl_nodata");
     this.listOrders.ItemDataBound += new System.Web.UI.WebControls.RepeaterItemEventHandler(this.listOrders_ItemDataBound);
     this.listOrders.ItemCommand   += new System.Web.UI.WebControls.RepeaterCommandEventHandler(this.listOrders_RowCommand);
 }
Example #2
0
        /// <summary>
        /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
        /// </summary>
        protected override void CreateChildControls()
        {
            // Remove any controls
#if _4_0 || _4_5
            this.ClearCachedClientID();
#endif
            this.Controls.Clear();

            if (this.Content != null)
            {
                // Add all content to a container.
                var container = new System.Web.UI.WebControls.Panel();
                container.CssClass = "modal-body";
                this.Content.InstantiateIn(container);
                this.Controls.Add(container);
            }

            if (this.Footer != null)
            {
                // Add all footer to a container.
                var footer = new System.Web.UI.WebControls.Panel();
                footer.CssClass = "modal-footer";
                this.Footer.InstantiateIn(footer);
                this.Controls.Add(footer);
            }
        }
Example #3
0
        public System.Web.UI.WebControls.Panel RenderOption(IGameOption opt, bool Selectable)
        {
            System.Web.UI.WebControls.Panel optionPanel =
                new System.Web.UI.WebControls.Panel();

            if (Selectable)
            {
                optionPanel.Controls.Add(
                    new System.Web.UI.HtmlControls.HtmlGenericControl("label")
                {
                    ID       = "opt_label_" + opt.OptionName,
                    Controls =
                    {
                        new System.Web.UI.HtmlControls.HtmlInputCheckBox()
                        {
                            Name          = opt.OptionName,
                            ID            = "opt_" + opt.OptionName,
                            ViewStateMode = System.Web.UI.ViewStateMode.Disabled
                        },
                        ImageFromObject(opt.Picture, "", Selectable)
                    }
                }
                    );
            }
            else
            {
                optionPanel.Controls.Add(ImageFromObject(opt.Picture, "", Selectable));
            }
            return(optionPanel);
        }
Example #4
0
        public virtual void FormatSingleEntered(DataEntryController dec)
        {
            /*
             * Show Insert, Entry, and Read-only fields.  Only Entry fields should
             * be enabled.
             */
            foreach (DataFieldControl c in dec.AllDataFields.Values)
            {
                c.Visible = false;
                c.Enabled = false;
                if (c.IsReadOnly == true || c.IsInsertField == true || c.IsEntryField == true)
                {
                    c.Visible = true;
                }
                if (c.IsEntryField == true)
                {
                    c.Enabled = true;
                }
            }

            // show mainPanel, if it exists
            System.Web.UI.WebControls.Panel mainPanel = dec.Parent.FindControl("mainPanel") as System.Web.UI.WebControls.Panel;
            if (mainPanel != null)
            {
                mainPanel.Visible = true;
            }
        }
Example #5
0
        public virtual void FormatCorrectingDoubleEntering(DataEntryController dec)
        {
            /*
             * Show Insert, Entry, and Read-only fields.  Only Double-Entry fields with
             * verification errors are enabled.
             * If there were validation errors (FormError == true) then don't show
             * override check boxes.
             */
            foreach (DataFieldControl c in dec.AllDataFields.Values)
            {
                c.Visible = false;
                c.Enabled = false;
                c.OverrideCheckBoxVisible = false;
                if (c.IsReadOnly == true || c.IsInsertField == true || c.IsEntryField == true)
                {
                    c.Visible = true;
                }
                if (c.IsDoubleEntryField == true && c.VerifyError == true)
                {
                    c.Enabled = true;
                }
                if (c.IsDoubleEntryField == true && c.VerifyError == true && dec.FormError == false)
                {
                    c.OverrideCheckBoxVisible = true;
                }
            }


            // show mainPanel, if it exists
            System.Web.UI.WebControls.Panel mainPanel = dec.Parent.FindControl("mainPanel") as System.Web.UI.WebControls.Panel;
            if (mainPanel != null)
            {
                mainPanel.Visible = true;
            }
        }
Example #6
0
        protected override void CreateChildControls()
        {
            if (_fileUpload == null)
            {
                _fileUpload    = new System.Web.UI.HtmlControls.HtmlInputFile();
                _fileUpload.ID = "upload";
            }

            if (_label == null)
            {
                _label = new System.Web.UI.WebControls.Panel();
            }

            if (_state == null)
            {
                _state    = new System.Web.UI.HtmlControls.HtmlInputHidden();
                _state.ID = "state";
            }

            Controls.Add(_label);
            Controls.Add(_fileUpload);
            Controls.Add(_state);

            base.CreateChildControls();
        }
Example #7
0
        protected new void Page_Load(object sender, EventArgs e)
        {
            //header info
            int vpm     = Request.QueryString["vpm"].ToInt32(0);
            int modelId = Request.QueryString["model"].ToInt32(0);
            int rictype = Request.QueryString["rictype"].ToInt32(0);
            int ricId   = Request.QueryString["id"].ToInt32(0);

            using (AppDb ctx = new AppDb())
            {
                if (ricId > 0)
                {
                    ric = ctx.RICs.Where(x => x.Id == ricId).FirstOrDefault();
                }
                else
                {
                    ric = ctx.RICs.Where(x => x.CatalogModelId == modelId && x.RICTypeId == rictype && x.PackingMonth == vpm.ToString()).FirstOrDefault();
                }
            }

            if (ric == null)
            {
                var panel1 = new System.Web.UI.WebControls.Panel();
                panel1.CssClass = "mainContent";
                panel1.Controls.Clear();
                panel1.Controls.Add(new LiteralControl(string.Format("<h2 class='grid-header'>Invalid Model/Variant/PackingMonth for RIC</h2>")));

                masterPage.MainContent.Controls.Add(panel1);
                masterPage.PageTitle.Controls.Add(new LiteralControl("Record Implementation Control"));

                return;
            }

            byte[] reportb = ReportRepository.GetReportBinary("Ric");
            if (reportb != null)
            {
                using (var stream = new MemoryStream(reportb))
                {
                    XtraReport report = XtraReport.FromStream(stream, true);

                    report.Parameters["parameter1"].Value   = ric.Id;
                    report.Parameters["parameter1"].Visible = false;

                    ASPxDocumentViewer1.Report = report;
                    ASPxDocumentViewer1.DataBind();
                }
            }
            else
            {
                string filePath = HttpContext.Current.ApplicationInstance.Server.MapPath("~/App_Data/rptRic.repx");
                DevExpress.XtraReports.UI.XtraReport report = DevExpress.XtraReports.UI.XtraReport.FromFile(filePath, true);


                report.Parameters["parameter1"].Value   = ric.Id;
                report.Parameters["parameter1"].Visible = false;

                ASPxDocumentViewer1.Report = report;
                ASPxDocumentViewer1.DataBind();
            }
        }
Example #8
0
        public virtual void FormatDoubleEntered(DataEntryController dec)
        {
            /*
             * Show Insert, Entry, and Read-only fields.  Only Entry fields should
             * be enabled.
             */
            foreach (DataFieldControl c in dec.AllDataFields)
            {
                // clear any verification errors left
                // over from verification state
                c.VerifyError = false;

                c.Visible = false;
                c.Enabled = false;
                if (c.IsReadOnly == true || c.IsInsertField == true || c.IsEntryField == true)
                {
                    c.Visible = true;
                }
                if (c.IsEntryField == true)
                {
                    c.Enabled = true;
                }
            }

            // show mainPanel, if it exists
            System.Web.UI.WebControls.Panel mainPanel = dec.Parent.FindControl("mainPanel") as System.Web.UI.WebControls.Panel;
            if (mainPanel != null)
            {
                mainPanel.Visible = true;
            }
        }
Example #9
0
        public static void HelpLink(System.Web.UI.HtmlControls.HtmlControl htmlControl, string helpLabel, string helpHref, string helpText = null, bool helpHrefIsJS = false)
        {
            System.Web.UI.WebControls.Panel panel;
            int id = new System.Random().Next();

            panel = new System.Web.UI.WebControls.Panel
            {
                ID       = "panel_help_" + id,
                CssClass = "col margin-top s12"
            };

            if (helpText != null)
            {
                panel.Controls.Add(new System.Web.UI.WebControls.Label
                {
                    ID       = "help_text" + id,
                    Text     = helpText,
                    CssClass = "col text-red label padding-16 margin-bottom"
                });
            }

            panel.Controls.Add(new System.Web.UI.WebControls.HyperLink
            {
                ID          = "help_link" + id,
                NavigateUrl = helpHrefIsJS ? string.Concat("javascript:", helpHref, "();") : helpHref,
                Text        = helpLabel,
                CssClass    = "text-blue hover-blue",
            });

            htmlControl.Controls.Add(panel);
        }
Example #10
0
 private void AddHiddenField(System.Web.UI.WebControls.Panel p, string id)
 {
     using (System.Web.UI.WebControls.HiddenField hidden = new System.Web.UI.WebControls.HiddenField())
     {
         hidden.ID = id;
         p.Controls.Add(hidden);
     }
 }
        public static void SetMessage(this System.Web.UI.WebControls.Panel c, string message)
        {
            HtmlGenericControl div = (HtmlGenericControl)c.FindControl("editorbody");

            if (div.NotNull())
            {
                div.InnerText = message;
            }
        }
        public static void SetHeader(this System.Web.UI.WebControls.Panel c, string header)
        {
            HtmlGenericControl div = (HtmlGenericControl)c.FindControl("editorHaeder");

            if (div.NotNull())
            {
                div.InnerText = header;
            }
        }
Example #13
0
 public System.Web.UI.Control GetControl()
 {
     System.Web.UI.WebControls.Panel p = new System.Web.UI.WebControls.Panel()
     {
         CssClass = "OverlapContainer",
         Width    = System.Web.UI.WebControls.Unit.Pixel(width),
         Height   = System.Web.UI.WebControls.Unit.Pixel(height),
     };
     return(AddNext(p));
 }
Example #14
0
 /// <summary>
 /// 清空所有panel里面的textbox内容
 /// </summary>
 /// <param name="pan"></param>
 public static void clearAll(System.Web.UI.WebControls.Panel pan)
 {
     foreach (Control panl in pan.Controls)
     {
         if (panl.GetType().ToString() == "System.Web.UI.WebControls.TextBox")
         {
             ((System.Web.UI.WebControls.TextBox)panl).Text = "";
         }
     }
 }
Example #15
0
        private void RenderTitlePorletInTable()
        {
            System.Web.UI.WebControls.Table tblTop = new System.Web.UI.WebControls.Table();
            tblTop.CellPadding = 0;
            tblTop.CellSpacing = 0;
            System.Web.UI.WebControls.TableRow rTop = new System.Web.UI.WebControls.TableRow();
            tblTop.Rows.Add(rTop);
            System.Web.UI.WebControls.TableCell cLeft = new System.Web.UI.WebControls.TableCell();
            cLeft.Width    = System.Web.UI.WebControls.Unit.Percentage(100);
            cLeft.CssClass = "TitlePortlet";

            rTop.Cells.Add(cLeft);
            System.Web.UI.WebControls.TableCell cRight = new System.Web.UI.WebControls.TableCell();
            rTop.Cells.Add(cRight);
            cRight.Width    = System.Web.UI.WebControls.Unit.Pixel(50);
            cRight.CssClass = "PanelTitlePortlet";

            System.Web.UI.WebControls.Panel pnTitle = new System.Web.UI.WebControls.Panel();
            pnTitle.Width = System.Web.UI.WebControls.Unit.Percentage(100);

            System.Web.UI.WebControls.Label lblPortletInfo = new System.Web.UI.WebControls.Label();
            lblPortletInfo.Text = string.Format("{0}{1}", Portlet.PortletInstance.Portlet.Name, Portlet.PortletInstance.Name != string.Empty ? "-" + Portlet.PortletInstance.Name : string.Empty);
            pnTitle.Controls.Add(lblPortletInfo);


            System.Web.UI.WebControls.Panel pnControlPortlet = new System.Web.UI.WebControls.Panel();
            pnControlPortlet.Width = System.Web.UI.WebControls.Unit.Pixel(50);

            LiteralControl btnDelete = new LiteralControl();

            btnDelete.Text = string.Format("<img src='{0}' onclick=\"{1}\" class='{2}' alt='{3}'/>", "/Systems/Engine/Images/PortletDelete.png", string.Format("PortletRemove('{0}','{1}');", Portlet.PortletInstance.Id, Portlet.PortletInstance.Name), "ButtonImage", "Remove Portlet");

            LiteralControl btnEdit = new LiteralControl();

            btnEdit.Text = string.Format("<img src='{0}' onclick=\"{1}\" class='{2}' alt='{3}'/>", "/Systems/Engine/Images/PortletEditData.png", string.Format("PortletEditData('{0}');", Portlet.PortletInstance.Id), "ButtonImage", "Edit Portlet");

            LiteralControl btnEditApperance = new LiteralControl();

            btnEditApperance.Text = string.Format("<img src='{0}' onclick=\"{1}\" class='{2}' alt='{3}'/>", "/Systems/Engine/Images/PortletEditApperance.png", string.Format("PortletEditCSS('{0}');", Portlet.PortletInstance.Id), "ButtonImage", "Edit Portlet CSS");

            if (Portlet.PortletInstance.Portlet.EditURL.Trim() != string.Empty)
            {
                pnControlPortlet.Controls.Add(btnEdit);
            }
            pnControlPortlet.Controls.Add(btnEditApperance);
            pnControlPortlet.Controls.Add(btnDelete);

            _pnTop.ID = string.Format("{0}", "Title");
            cLeft.Controls.Add(pnTitle);
            cRight.Controls.Add(pnControlPortlet);
            _pnTop.Controls.Add(tblTop);

            Controls.AddAt(0, _pnTop);
        }
        public static int?GetEditedItemId(this System.Web.UI.WebControls.Panel c)
        {
            var ed = (c.Page as SynnWebFormBase).GetFromSession(EditedItemKey);

            if (ed.NotNull())
            {
                return(ed.ToString().ToInteger());
            }

            return((int?)null);
        }
Example #17
0
 protected override void Render(System.Web.UI.HtmlTextWriter writer)
 {
     base.Render(writer);
     System.Web.UI.WebControls.Panel dragPanel = new System.Web.UI.WebControls.Panel();
     dragPanel.ID = string.Format("{0}___Drag", ClientID);
     dragPanel.Style.Add("display", "none");
     dragPanel.Style.Add("position", "absolute");
     dragPanel.Style.Add("z-index", "32000");
     dragPanel.Style.Add("filter", "alpha(opacity=75)");
     dragPanel.RenderControl(writer);
 }
        public static void AddModalToPage(this System.Web.UI.WebControls.Panel c)
        {
            // modal background creation
            HtmlGenericControl div = new HtmlGenericControl(HtmlTextWriterTag.Div.ToString());

            div.Attributes.Add("class", "modalbackground");
            div.Style.Add("z-index", ModalHelper.ZIndex.ToString()); // HtmlTextWriterStyle.ZIndex rendered without hypen
            div.Style.Add("opacity", string.Format(".{0}", ModalHelper.ModalBackgroundOpacity / 10));
            div.Style.Add(HtmlTextWriterStyle.Filter.ToString(), string.Format("alpha(opacity={0})", ModalHelper.ModalBackgroundOpacity));
            div.ID = string.Format("{0}_modal", c.ID);

            c.Page.Form.Style.Add(HtmlTextWriterStyle.Height.ToString(), "100%");
            c.Page.Form.Controls.Add(div);
        }
Example #19
0
        public virtual void FormatInserting(DataEntryController dec)
        {
            /*
             * Show only controls that are insert fields or are read-only. Insert fields
             * should be enabled.  Read-only fields should be disabled. Clear all fields.
             * Set all fields to default value, if any.
             */
            foreach (DataFieldControl c in dec.AllDataFields.Values)
            {
                /*
                 * clear field controls if not re-entering
                 * state because of an error. This is needed
                 * to reset all form fields when arriving in the INSERTING
                 * state after a lookup or create new.
                 */
                if (dec.FormError == false)
                {
                    c.OverrideCheckBoxChecked = false;
                    c.OverrideCheckBoxVisible = false;
                    c.VerifyError             = false;

                    // initialize insert/read-only fields
                    if (c.IsInsertField == true || c.IsReadOnly == true)
                    {
                        c.FieldTextBoxText = c.FieldTextBoxTextDefault;
                    }
                }

                c.Visible = false;
                c.Enabled = false;
                if (c.IsReadOnly == true || c.IsInsertField == true)
                {
                    c.Visible = true;
                }
                if (c.IsInsertField == true)
                {
                    c.Enabled = true;
                }
            }

            // hide mainPanel, if it exists
            System.Web.UI.WebControls.Panel mainPanel = dec.Parent.FindControl("mainPanel") as System.Web.UI.WebControls.Panel;
            if (mainPanel != null)
            {
                mainPanel.Visible = false;
            }
        }
        public void ResolveValidationContainerToEnclosingPageRecursively()
        {
            // direct containment
            Page page = new Page();
            TestValidationControl vc = new TestValidationControl();

            page.Controls.Add(vc);
            Assert.AreSame(page, vc.TheValidationContainer);

            // indirect containment
            page = new Page();
            vc   = new TestValidationControl();
            Control inBetweenControl = new System.Web.UI.WebControls.Panel();

            inBetweenControl.Controls.Add(vc);
            page.Controls.Add(inBetweenControl);
            Assert.AreSame(page, vc.TheValidationContainer);
        }
Example #21
0
        /// <summary>
        /// Page Init event; creates all required controls in a page.
        /// </summary>
        /// <param name="sender">The page sending the event.</param>
        /// <param name="e"></param>
        protected void Page_Init(object sender, EventArgs e)
        {
            var tableName  = RouteData.Values["module"] == null ? "" : RouteData.Values["module"].ToString();
            var schemaInfo = Application["SchemaInfo"] as SchemaInfo;

            tableMeta = schemaInfo.Tables.Where(s => s.Name.Equals(tableName, StringComparison.InvariantCultureIgnoreCase)).SingleOrDefault();
            if (tableMeta == null)
            {
                Response.Redirect("~/404.aspx");
            }

            var user = HttpContext.Current.Session["user"] as User;
            //var sessionName = string.Format("accessRights_{0}_{1}", user == null ? "default" : user.UserName, HttpContext.Current.Request.RawUrl);
            var sessionName = string.Format("accessRights_{0}_{1}", user == null ? "reader" : user.UserName, HttpContext.Current.Request.RawUrl);

            permissions = Session[sessionName] as List <PermissionType>;
            if (permissions == null)
            {
                //set default to view only permission
                permissions = new List <PermissionType>();
                permissions.Add(PermissionType.Read);
            }
            var gridCreator = new MasterGridCreator(tableMeta, connectionString, permissions);

            masterGrid = gridCreator.CreateMasterGrid();
            var masterPage = this.Controls[0] as IMainMaster;

            if (masterPage == null)
            {
                Response.Write("<p>Your master page must implement IMainMaster interface.</p>");
            }
            else
            {
                var panel = new System.Web.UI.WebControls.Panel();
                panel.CssClass = "mainContent";
                panel.Controls.Add(new LiteralControl(string.Format("<h2>{0}</h2>", tableMeta.Caption)));
                panel.Controls.Add(masterGrid);

                masterPage.MainContent.Controls.Add(panel);
                masterPage.PageTitle.Controls.Add(new LiteralControl(tableMeta.Caption));
            }
        }
Example #22
0
        public virtual void FormatEntering(DataEntryController dec)
        {
            /*
             * Show Insert, Entry, and Read-only fields.  Only Entry fields should
             * be enabled.
             *
             * Initialize fields with default values if not entering as result of error.
             * Only initialize fields that are entry fields.
             */
            foreach (DataFieldControl c in dec.AllDataFields.Values)
            {
                c.Visible = false;
                c.Enabled = false;
                if (c.IsReadOnly == true || c.IsInsertField == true || c.IsEntryField == true)
                {
                    c.Visible = true;
                }
                if (c.IsEntryField == true)
                {
                    c.Enabled = true;
                }

                if (dec.FormError == false)
                {
                    // initialize entry fields, leave fields that are also insert fields alone
                    if (c.IsEntryField == true && c.IsInsertField == false)
                    {
                        c.FieldTextBoxText = c.FieldTextBoxTextDefault;
                    }
                }
            }

            // show mainPanel, if it exists
            System.Web.UI.WebControls.Panel mainPanel = dec.Parent.FindControl("mainPanel") as System.Web.UI.WebControls.Panel;
            if (mainPanel != null)
            {
                mainPanel.Visible = true;
            }
        }
Example #23
0
        public virtual void FormatNoData(DataEntryController dec)
        {
            /*
             * Show only controls that are insert fields or are read-only. All fields
             * are disabled.
             */
            foreach (DataFieldControl c in dec.AllDataFields.Values)
            {
                c.Visible = false;
                c.Enabled = false;
                if (c.IsReadOnly == true || c.IsInsertField == true)
                {
                    c.Visible = true;
                }
            }

            // show mainPanel, if it exists
            System.Web.UI.WebControls.Panel mainPanel = dec.Parent.FindControl("mainPanel") as System.Web.UI.WebControls.Panel;
            if (mainPanel != null)
            {
                mainPanel.Visible = true;
            }
        }
Example #24
0
        /// <summary>
        /// Page Init event; creates all required controls in a page.
        /// </summary>
        /// <param name="sender">The page sending the event.</param>
        /// <param name="e"></param>
        protected void Page_Init(object sender, EventArgs e)
        {
            var tableName  = RouteData.Values["module"] == null ? "" : RouteData.Values["module"].ToString();
            var schemaInfo = Application["SchemaInfo"] as SchemaInfo;

            tableMeta = schemaInfo.Tables.Where(s => s.Name.Equals(tableName, StringComparison.InvariantCultureIgnoreCase)).SingleOrDefault();
            if (tableMeta == null)
            {
                Response.Redirect("~/404.aspx");
            }

            var routeValues = RouteData.Values["values"] == null ? "" : RouteData.Values["values"].ToString();
            var idValues    = routeValues.Split(new char[] { ',' });

            var formLayoutCreator = new FormLayoutCreator(tableMeta, connectionString, idValues, (RouteData.Route as Route).Url.Contains("view"));

            formLayoutCreator.EmptyData += formLayoutCreator_EmptyData;
            formLayout = formLayoutCreator.CreateFormLayout();

            var masterPage = this.Controls[0] as IMainMaster;

            if (masterPage == null)
            {
                Response.Write("<p>Your master page must implement IMainMaster interface.</p>");
            }
            else
            {
                var panel = new System.Web.UI.WebControls.Panel();
                panel.CssClass = "mainContent";
                panel.Controls.Add(new LiteralControl(string.Format("<h2>{0}</h2>", tableMeta.Caption)));
                panel.Controls.Add(formLayout);

                masterPage.MainContent.Controls.Add(panel);
                masterPage.PageTitle.Controls.Add(new LiteralControl(tableMeta.Caption));
            }
        }
Example #25
0
        public virtual void FormatDoubleEntering(DataEntryController dec)
        {
            /*
             * Show Insert, Entry, and Read-only fields.  Only Double-Entry fields should
             * be enabled.
             *
             * Double-Entry fields must be a subset of entry fields. Clear any
             * existing contents of double entry fields  (or set them to default if any)
             * unless re-entering state because of an error.
             */
            foreach (DataFieldControl c in dec.AllDataFields.Values)
            {
                c.Visible = false;
                c.Enabled = false;
                if (c.IsReadOnly == true || c.IsInsertField == true || c.IsEntryField == true)
                {
                    c.Visible = true;
                }
                if (c.IsDoubleEntryField == true)
                {
                    c.Enabled = true;
                    if (dec.FormError == false)
                    {
                        c.FieldTextBoxText = string.Empty;
                        c.FieldTextBoxText = c.FieldTextBoxTextDefault;
                    }
                }
            }

            // show mainPanel, if it exists
            System.Web.UI.WebControls.Panel mainPanel = dec.Parent.FindControl("mainPanel") as System.Web.UI.WebControls.Panel;
            if (mainPanel != null)
            {
                mainPanel.Visible = true;
            }
        }
Example #26
0
        /// <summary>
        /// Set back the updated value from the dataset to each controls of the panel
        /// Also sets validation and javascript events on the controls.
        /// </summary>
        /// <param name="PanelControls"></param>
        /// <param name="datasetDocument"></param>
        public void SetControlValues(System.Web.UI.WebControls.Panel PanelControls, DataSet datasetDocument)
        {
            try
            {
                System.Web.UI.WebControls.HiddenField HiddenFieldValidation = new System.Web.UI.WebControls.HiddenField();
                using (datasetDocument)
                {
                    HiddenFieldValidation.ID = "HiddenFieldValidation";
                    PanelControls.Controls.Add(HiddenFieldValidation);
                    System.Collections.IEnumerator eControls = PanelControls.Controls.GetEnumerator();
                    while (eControls.MoveNext())
                    {
                        object objCurrentControl = eControls.Current;
                        switch (objCurrentControl.GetType().ToString())
                        {
                        case "System.Web.UI.HtmlControls.HtmlInputHidden":
                        {
                            System.Web.UI.HtmlControls.HtmlInputHidden hdnTemp = (System.Web.UI.HtmlControls.HtmlInputHidden)objCurrentControl;
                            string primaryKey = hdnTemp.Attributes["PrimaryKey"];

                            if (!String.IsNullOrEmpty(primaryKey))
                            {
                                string fieldName = hdnTemp.Attributes["FieldName"];
                                string tableName = hdnTemp.Attributes["TableName"];
                                if (CheckFieldValues(tableName, fieldName, datasetDocument))
                                {
                                    hdnTemp.Value = datasetDocument.Tables[tableName].Rows[0][fieldName].ToString();
                                }
                            }
                            break;
                        }

                        case "System.Web.UI.WebControls.TextBox":
                        {
                            System.Web.UI.WebControls.TextBox txtTemp = (System.Web.UI.WebControls.TextBox)objCurrentControl;
                            txtTemp.Attributes.Add("OnChange", "isdirty()");
                            string fieldName  = txtTemp.Attributes["FieldName"];
                            string tableName  = txtTemp.Attributes["TableName"];
                            string validation = txtTemp.Attributes["Validate"];

                            if (!String.IsNullOrEmpty(validation))
                            {
                                if (HiddenFieldValidation.Value == "")
                                {
                                    HiddenFieldValidation.Value = txtTemp.ClientID;
                                }
                                else
                                {
                                    HiddenFieldValidation.Value += ";" + txtTemp.ClientID;
                                }
                            }
                            if (CheckFieldValues(tableName, fieldName, datasetDocument))
                            {
                                txtTemp.Text = datasetDocument.Tables[tableName].Rows[0][fieldName].ToString();
                            }
                            break;
                        }

                        case "System.Web.UI.WebControls.CheckBox":
                        {
                            System.Web.UI.WebControls.CheckBox chkTemp = (System.Web.UI.WebControls.CheckBox)objCurrentControl;
                            chkTemp.Attributes.Add("OnClick", "isdirty()");
                            string fieldName  = chkTemp.Attributes["FieldName"];
                            string tableName  = chkTemp.Attributes["TableName"];
                            string validation = chkTemp.Attributes["Validate"];

                            if (!String.IsNullOrEmpty(validation))
                            {
                                if (HiddenFieldValidation.Value == "")
                                {
                                    HiddenFieldValidation.Value = chkTemp.ClientID;
                                }
                                else
                                {
                                    HiddenFieldValidation.Value += ";" + chkTemp.ClientID;
                                }
                            }
                            if (CheckFieldValues(tableName, fieldName, datasetDocument))
                            {
                                chkTemp.Checked = datasetDocument.Tables[tableName].Rows[0][fieldName].ToString() == "Y" ? true : false;
                            }
                            break;
                        }

                        case "System.Web.UI.WebControls.DropDownList":
                        {
                            System.Web.UI.WebControls.DropDownList ddlTemp = (System.Web.UI.WebControls.DropDownList)objCurrentControl;
                            ddlTemp.Attributes.Add("OnChange", "isdirty()");
                            string fieldName      = ddlTemp.Attributes["FieldName"];
                            string tableName      = ddlTemp.Attributes["TableName"];
                            string dataSource     = ddlTemp.Attributes["DataSource"];    /////////No Need
                            string SelectCase     = ddlTemp.Attributes["SelectCase"];
                            string SelectType     = ddlTemp.Attributes["SelectType"];
                            string dataTextField  = ddlTemp.Attributes["TextField"];
                            string dataValueField = ddlTemp.Attributes["ValueField"];
                            string validation     = ddlTemp.Attributes["Validate"];

                            if (!String.IsNullOrEmpty(validation))
                            {
                                if (HiddenFieldValidation.Value == "")
                                {
                                    HiddenFieldValidation.Value = ddlTemp.ClientID;
                                }
                                else
                                {
                                    HiddenFieldValidation.Value += ";" + ddlTemp.ClientID;
                                }
                            }

                            //FillDropDowns(ddlTemp, dataSource, dataTextField, dataValueField);
                            FillDropDowns(ddlTemp, dataSource, dataTextField, dataValueField, SelectCase, SelectType);
                            if (CheckFieldValues(tableName, fieldName, datasetDocument))
                            {
                                ddlTemp.SelectedValue = datasetDocument.Tables[tableName].Rows[0][fieldName].ToString();
                            }
                            break;
                        }

                        case "System.Web.UI.WebControls.RadioButton":
                        {
                            System.Web.UI.WebControls.RadioButton rbTemp = (System.Web.UI.WebControls.RadioButton)objCurrentControl;
                            rbTemp.Attributes.Add("OnClick", "isdirty()");
                            string fieldName  = rbTemp.Attributes["FieldName"];
                            string tableName  = rbTemp.Attributes["TableName"];
                            string value      = rbTemp.Attributes["Value"];
                            string validation = rbTemp.Attributes["Validate"];

                            if (!String.IsNullOrEmpty(validation))
                            {
                                if (HiddenFieldValidation.Value == "")
                                {
                                    HiddenFieldValidation.Value = rbTemp.ClientID;
                                }
                                else
                                {
                                    HiddenFieldValidation.Value += ";" + rbTemp.ClientID;
                                }
                            }

                            if (CheckFieldValues(tableName, fieldName, datasetDocument))
                            {
                                if (datasetDocument.Tables[tableName].Rows[0][fieldName].ToString().Trim() == value.Trim())
                                {
                                    rbTemp.Checked = true;
                                }
                            }
                            break;
                        }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw (ex);
            }
        }
Example #27
0
        /// <summary>
        /// Creates datarows pertaining to the controls in the panel and updates them
        /// </summary>
        /// <param name="PanelControls">Panel with contains the collection </param>
        /// <param name="objTemp">Object which contains values regarding the documentrow</param>
        /// <returns>true on successful update</returns>
        public bool UpdateData(System.Web.UI.WebControls.Panel PanelControls, ref object objTemp)
        {
            try
            {
                objCommonBase = new Streamline.DataService.CommonBase();
                System.Collections.Hashtable hashTableTemp = (System.Collections.Hashtable)objTemp;
                string dataFileTemp        = PanelControls.Attributes["DataFile"];
                string dataFileAfterUpdate = PanelControls.Attributes["DataFileAfterUpdate"];

                //This statement is used to get the collections of controls in the panel.
                //GetEnumerator is a forward only and light weight cursor.Hence it is more efficient than
                // For each control in Panel.
                System.Collections.IEnumerator eControls = PanelControls.Controls.GetEnumerator();
                datasetMain = new DataSet();


                if (!String.IsNullOrEmpty(dataFileAfterUpdate))
                {
                    datasetMain.ReadXml(PATH + System.Web.HttpContext.Current.Session.SessionID + "\\" + dataFileAfterUpdate, XmlReadMode.ReadSchema);
                    datasetMain.AcceptChanges();
                }
                else
                {
                    datasetMain.ReadXmlSchema(PATH + dataFileTemp);
                }

                newRow = true;
                //if(hashTableTemp.ContainsKey("DocumentId"))
                //   AddDataRowValues(tableName, fieldName, hdnTemp.Value, primaryKey == "True" ? true : false);
                //if(hashTableTemp.ContainsKey("Version"))
                //   AddDataRowValues(tableName, fieldName, hdnTemp.Value, primaryKey == "True" ? true : false);

                while (eControls.MoveNext())
                {
                    object objCurrentControl = eControls.Current;
                    switch (objCurrentControl.GetType().ToString())
                    {
                    case "System.Web.UI.HtmlControls.HtmlInputHidden":
                    {
                        System.Web.UI.HtmlControls.HtmlInputHidden hdnTemp = (System.Web.UI.HtmlControls.HtmlInputHidden)objCurrentControl;
                        string primaryKey = hdnTemp.Attributes["PrimaryKey"];
                        if (!String.IsNullOrEmpty(primaryKey))
                        {
                            string fieldName = hdnTemp.Attributes["FieldName"];
                            string tableName = hdnTemp.Attributes["TableName"];
                            if (primaryKey == "True")
                            {
                                if (String.IsNullOrEmpty(hdnTemp.Value))
                                {
                                    if (hashTableTemp.ContainsKey(fieldName))
                                    {
                                        hdnTemp.Value = hashTableTemp[fieldName].ToString();
                                    }
                                }
                                else
                                {
                                    newRow = false;
                                }
                                AddDataRowValues(tableName, fieldName, hdnTemp.Value, primaryKey == "True" ? true : false);
                            }
                        }
                        break;
                    }

                    case "System.Web.UI.WebControls.TextBox":
                    {
                        System.Web.UI.WebControls.TextBox txtTemp = (System.Web.UI.WebControls.TextBox)objCurrentControl;
                        string fieldName = txtTemp.Attributes["FieldName"];
                        string tableName = txtTemp.Attributes["TableName"];
                        AddDataRowValues(tableName, fieldName, txtTemp.Text, false);
                        break;
                    }

                    case "System.Web.UI.WebControls.CheckBox":
                    {
                        System.Web.UI.WebControls.CheckBox chkTemp = (System.Web.UI.WebControls.CheckBox)objCurrentControl;
                        string fieldName = chkTemp.Attributes["FieldName"];
                        string tableName = chkTemp.Attributes["TableName"];
                        AddDataRowValues(tableName, fieldName, chkTemp.Checked == true ? "Y" : "N", false);
                        break;
                    }

                    case "System.Web.UI.WebControls.DropDownList":
                    {
                        System.Web.UI.WebControls.DropDownList ddlTemp = (System.Web.UI.WebControls.DropDownList)objCurrentControl;
                        string fieldName = ddlTemp.Attributes["FieldName"];
                        string tableName = ddlTemp.Attributes["TableName"];
                        AddDataRowValues(tableName, fieldName, ddlTemp.SelectedValue, false);
                        break;
                    }

                    case "System.Web.UI.WebControls.RadioButton":
                    {
                        System.Web.UI.WebControls.RadioButton rbTemp = (System.Web.UI.WebControls.RadioButton)objCurrentControl;
                        string fieldName = rbTemp.Attributes["FieldName"];
                        string tableName = rbTemp.Attributes["TableName"];
                        string value     = rbTemp.Attributes["Value"];
                        if (rbTemp.Checked == true)
                        {
                            AddDataRowValues(tableName, fieldName, value, false);
                        }
                        break;
                    }
                    }
                }

                //Merging the documents table to the maindataset
                datasetMain.Merge(getDocumentTable(objTemp));

                DataSet dsUpdated  = objCommonBase.UpdateDocuments(datasetMain);
                string  updateFile = System.Guid.NewGuid().ToString() + ".xml";
                dsUpdated.WriteXml(PATH + System.Web.HttpContext.Current.Session.SessionID + "\\" + updateFile, XmlWriteMode.WriteSchema);
                PanelControls.Attributes["DataFileAfterUpdate"] = updateFile;

                // setting back the updated documentid and version id to the arguments passed by the parent class
                if (dsUpdated.Tables.Count > 0)
                {
                    if (dsUpdated.Tables[0].Columns.Contains("DocumentId"))
                    {
                        if (dsUpdated.Tables[0].Rows.Count > 0)
                        {
                            if (hashTableTemp.ContainsKey("DocumentId"))
                            {
                                hashTableTemp["DocumentId"] = Convert.ToInt32(dsUpdated.Tables[0].Rows[0]["DocumentId"]);
                            }
                            else
                            {
                                hashTableTemp.Add("DocumentId", Convert.ToInt32(dsUpdated.Tables[0].Rows[0]["DocumentId"]));
                            }

                            if (hashTableTemp.ContainsKey("Version"))
                            {
                                hashTableTemp["Version"] = Convert.ToInt32(dsUpdated.Tables[0].Rows[0]["Version"]);
                            }
                            else
                            {
                                hashTableTemp.Add("Version", Convert.ToInt32(dsUpdated.Tables[0].Rows[0]["Version"]));
                            }
                        }
                    }
                }


                // SetControlValues(PanelControls, dsUpdated);
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Example #28
0
        public System.Web.UI.Control RenderDebugInfo(GameState GameStatus, IPage Source)
        {
            System.Web.UI.Control Body;

            System.Web.UI.WebControls.Panel pPanel = new System.Web.UI.WebControls.Panel();
            Body = pPanel;
            Body.Controls.Add(new System.Web.UI.WebControls.Label()
            {
                Text = "<pre>"
                       + FlorineJSON.JsonHelper.FormatJson(
                    FlorineJSON.JSONUtil.SerializeGameState(
                        GameStatus,
                        false
                        )
                    )
                       + "</pre>"
            });
            pPanel.BorderStyle = System.Web.UI.WebControls.BorderStyle.Solid;
            pPanel.BorderWidth = new System.Web.UI.WebControls.Unit("1 px");
            foreach (string w in warnings)
            {
                Body.Controls.Add(new System.Web.UI.WebControls.Label()
                {
                    Text      = "Warning: " + w,
                    BackColor = System.Drawing.Color.MistyRose
                });
            }
            Body.Controls.Add(new System.Web.UI.WebControls.Label()
            {
                Text = Source.MainType.ToString() + "(" + Source.SubType.ToString() + ")"
                       + "<pre>" + Source.ToString() + "</pre>"
            });
            Body.Controls.Add(new System.Web.UI.HtmlControls.HtmlAnchor()
            {
                HRef      = ".?reset=1",
                InnerText = "DeForm"
            });
            Body.Controls.Add(new System.Web.UI.WebControls.Label()
            {
                Text = "["
                       + _params["stg_curpage"]
                       + " -> "
                       + Source.MainType.ToString()
                       + "]"
            });
            Body.Controls.Add(new System.Web.UI.WebControls.Label()
            {
                Text = "{<ul><li>"
                       + String.Join("<li>",
                                     GetOptionList(Source.PrimaryOptions))
                       + " </ul>-><ul><li> "
                       + String.Join("<li>",
                                     GetOptionList(Source.AppliedOptions))
                       + "</ul>}"
            });
            System.Web.UI.HtmlControls.HtmlGenericControl dbgList = new System.Web.UI.HtmlControls.HtmlGenericControl("ul");
            for (int i = 0; i < _params.Count; ++i)
            {
                System.Web.UI.HtmlControls.HtmlGenericControl li = new System.Web.UI.HtmlControls.HtmlGenericControl("li");
                li.Controls.Add(new System.Web.UI.WebControls.Label()
                {
                    Text = _params.GetKey(i)
                });
                string[] pval = _params.GetValues(i);

                System.Web.UI.HtmlControls.HtmlGenericControl subList = new System.Web.UI.HtmlControls.HtmlGenericControl("ul");
                foreach (string s in pval)
                {
                    subList.Controls.Add(new System.Web.UI.WebControls.Label()
                    {
                        Text = s
                    });
                }
                li.Controls.Add(subList);

                dbgList.Controls.Add(li);
            }
            Body.Controls.Add(dbgList);
            return(Body);
        }
Example #29
0
 public System.Web.UI.Control RenderNutrientBlock(
     Florine.NutrientSet Nutrients,
     string Title,
     bool IncludeNutrientDetails
     )
 {
     System.Web.UI.WebControls.Panel pPanel = new System.Web.UI.WebControls.Panel();
     pPanel.BorderStyle = System.Web.UI.WebControls.BorderStyle.Solid;
     pPanel.BorderWidth = new System.Web.UI.WebControls.Unit("1 px");
     System.Web.UI.HtmlControls.HtmlTable tab = new System.Web.UI.HtmlControls.HtmlTable();
     if (null == Nutrients)
     {
         return(tab);
     }
     if (Nutrients.Count == 0)
     {
         return(tab);
     }
     if (null != Title)
     {
         tab.Rows.Add(new System.Web.UI.HtmlControls.HtmlTableRow()
         {
             Cells =
             {
                 new System.Web.UI.HtmlControls.HtmlTableCell()
                 {
                     ColSpan  = 2,
                     Controls =
                     {
                         new System.Web.UI.HtmlControls.HtmlGenericControl("b")
                         {
                             InnerHtml = Title
                         }
                     }
                 }
             }
         });
     }
     foreach (KeyValuePair <Florine.Nutrient, Florine.NutrientAmount> kvp in Nutrients)
     {
         tab.Rows.Add(new System.Web.UI.HtmlControls.HtmlTableRow()
         {
             Cells =
             {
                 new System.Web.UI.HtmlControls.HtmlTableCell()
                 {
                     Controls =
                     {
                         new System.Web.UI.WebControls.Literal()
                         {
                             Text = kvp.Key.Name.ToString()
                         }
                     }
                 },
                 new System.Web.UI.HtmlControls.HtmlTableCell()
                 {
                     Controls =
                     {
                         new System.Web.UI.WebControls.Literal()
                         {
                             Text = kvp.Value.ToString("N2")
                         }
                     }
                 }
             }
         });
         if (IncludeNutrientDetails &&
             null != kvp.Key.Units
             )
         {
             tab.Rows[tab.Rows.Count - 1].Cells.Add(
                 new System.Web.UI.HtmlControls.HtmlTableCell()
             {
                 Controls =
                 {
                     new System.Web.UI.WebControls.Literal()
                     {
                         Text = "/"
                                + ((null == kvp.Key.DailyTarget)?
                                   "??"
                                                                            :kvp.Key.DailyTarget.ToString())
                                + kvp.Key.Units.ToString()
                     }
                 }
             }
                 );
         }
     }
     pPanel.Controls.Add(tab);
     return(pPanel);
 }
Example #30
0
        protected System.Web.UI.Control CharCreateControls(IPage Source)
        {
            System.Web.UI.WebControls.Panel p = new System.Web.UI.WebControls.Panel();

            p.HorizontalAlign = System.Web.UI.WebControls.HorizontalAlign.Center;

            /* Name */
            System.Web.UI.WebControls.TextBox NameBox = new System.Web.UI.WebControls.TextBox()
            {
                ID          = "Avatar_Name",
                Text        = "Faerina",
                BorderStyle = System.Web.UI.WebControls.BorderStyle.None,
                Width       = System.Web.UI.WebControls.Unit.Percentage(100)
            };
            NameBox.Font.Size = System.Web.UI.WebControls.FontUnit.Larger;
            p.Controls.Add(NameBox);

            List <string> AvatarParts = new List <string>()
            {
                "skin", "wings", "hair", "pants", "shirt", "shoes"
            };

            System.Web.UI.WebControls.Panel combined = new System.Web.UI.WebControls.Panel()
            {
                CssClass = "OverlapContainer",
                Width    = System.Web.UI.WebControls.Unit.Pixel(262),
                Height   = System.Web.UI.WebControls.Unit.Pixel(332),
            };

            foreach (string part in AvatarParts)
            {
                combined.Controls.Add(new System.Web.UI.WebControls.Image()
                {
                    ImageUrl = "Images/Avatar/char_" + part + ".png",
                    CssClass = "OverlapImage img_" + part
                });
            }
            System.Web.UI.WebControls.Panel scom = new System.Web.UI.WebControls.Panel()
            {
                HorizontalAlign = System.Web.UI.WebControls.HorizontalAlign.Center
            };
            scom.Controls.Add(combined);
            p.Controls.Add(scom);
            Dictionary <string, int> BaseColor = new Dictionary <string, int>
            {
                { "skin", 195 },
                { "wings", 193 },
                { "hair", 61 },
                { "pants", 82 },
                { "shirt", 154 },
                { "shoes", 45 }
            };
            Dictionary <string, double> PartBrightBase = new Dictionary <string, double>
            {
                { "skin", .3 },
                { "wings", .3 },
                { "hair", .2 },
                { "pants", .4 },
                { "shirt", .3 },
                { "shoes", .2 }
            };
            Dictionary <string, double> PartBright = new Dictionary <string, double>
            {
                { "skin", .2 },
                { "wings", .2 },
                { "hair", .5 },
                { "pants", .4 },
                { "shirt", .2 },
                { "shoes", .5 }
            };

            foreach (string part in AvatarParts)
            {
                //inline block
                System.Web.UI.WebControls.Panel icom = new System.Web.UI.WebControls.Panel()
                {
                    CssClass = "TileImage"
                };
                System.Web.UI.HtmlControls.HtmlTable Tabular =
                    new System.Web.UI.HtmlControls.HtmlTable();
                int HueCount    = 5;
                int BrightCount = 5;
                int HueSpacing  = 360 / HueCount;
                int HueBase     = 45;
                if (part == "skin")
                {
                    HueBase = -HueBase;
                }
                for (int row_idx = 0; row_idx < HueCount + 1; ++row_idx)
                {
                    System.Web.UI.HtmlControls.HtmlTableRow row =
                        new System.Web.UI.HtmlControls.HtmlTableRow();
                    if (row_idx < HueCount)
                    {
                        //Hue
                        row.Cells.Add(new System.Web.UI.HtmlControls.HtmlTableCell()
                        {
                            Controls =
                            {
                                Stylize(new System.Web.UI.WebControls.Button()
                                {
                                    UseSubmitBehavior = false,
                                    Text        = " ",
                                    BorderStyle =
                                        System.Web.UI.WebControls.BorderStyle.None,
                                    OnClientClick = "changeHue('"
                                                    + part
                                                    + "',"
                                                    + ((HueSpacing * (row_idx - 2)) + HueBase)
                                                    + ");//",
                                    BackColor = System.Drawing.Color.FromArgb(
                                        BaseColor[part], BaseColor[part], BaseColor[part]
                                        )
                                },
                                        "filter_brightness_" + part,
                                        "sepia(1)"
                                        + " hue-rotate("
                                        + ((HueSpacing * (row_idx - 2)) + HueBase)
                                        + "deg)"
                                        )
                            }
                        });
                        if (row_idx == 0)
                        {
                            System.Web.UI.HtmlControls.HtmlInputHidden partHue =
                                new System.Web.UI.HtmlControls.HtmlInputHidden()
                            {
                                ID            = "val_h_" + part,
                                Value         = HueBase.ToString(),
                                ViewStateMode = System.Web.UI.ViewStateMode.Disabled
                            };
                            System.Web.UI.HtmlControls.HtmlInputHidden partBri =
                                new System.Web.UI.HtmlControls.HtmlInputHidden()
                            {
                                ID            = "val_b_" + part,
                                Value         = (PartBrightBase[part] + PartBright[part] * 2).ToString(),
                                ViewStateMode = System.Web.UI.ViewStateMode.Disabled
                            };
                            System.Web.UI.WebControls.Image img =
                                new System.Web.UI.WebControls.Image()
                            {
                                ImageUrl = "Images/Avatar/Zoom/char_" + part + ".png",
                                CssClass = "img_" + part
                            };


                            row.Cells.Add(new System.Web.UI.HtmlControls.HtmlTableCell()
                            {
                                ColSpan  = HueCount,
                                RowSpan  = BrightCount,
                                Controls = { img, partHue, partBri }
                            });
                        }
                    }
                    else
                    {
                        row.Cells.Add(new System.Web.UI.HtmlControls.HtmlTableCell());
                        for (int col_idx = 0; col_idx < BrightCount; ++col_idx)
                        {
                            row.Cells.Add(new System.Web.UI.HtmlControls.HtmlTableCell()
                            {
                                Controls =
                                {
                                    Stylize(
                                        new System.Web.UI.WebControls.Button()
                                    {
                                        UseSubmitBehavior = false,
                                        Text        = " ",
                                        BorderStyle =
                                            System.Web.UI.WebControls.BorderStyle.None,
                                        OnClientClick = "changeBrightness('"
                                                        + part
                                                        + "',"
                                                        + (PartBrightBase[part] + PartBright[part] * col_idx)
                                                        + ");//",
                                        BackColor = System.Drawing.Color.FromArgb(
                                            BaseColor[part], BaseColor[part], BaseColor[part]
                                            )
                                    },
                                        "filter_hue_" + part,
                                        "sepia(1) brightness("
                                        + (PartBrightBase[part] + PartBright[part] * col_idx)
                                        + ");"
                                        )
                                }
                            });
                        }
                    }
                    Tabular.Rows.Add(row);
                }
                icom.Controls.Add(Tabular);
                p.Controls.Add(icom);
            }


            return(p);
        }
Example #31
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (QuestionnaireDto.Company_Code == Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["Company_HPI"]))
            {
                /*Gofa Image Display Vivek */
                if (!string.IsNullOrEmpty(QuestionnaireDto.banner_template.ToString()) && !string.IsNullOrEmpty(QuestionnaireDto.banner))
                {
                    if (QuestionnaireDto.banner_template == 1)
                    {
                        rfgImageTop.Visible = true;
                        rfgImageBottom.Visible = false;
                        rfgImageTop.Src = ".." + ResolveUrl(bannerPath + QuestionnaireDto.banner.ToString().Replace(@"\", @"/"));
                        rfgImageTop.Style["width"] = QuestionnaireDto.banner_width.ToString() + "px";
                        rfgImageTop.Style["hieght"] = QuestionnaireDto.banner_height.ToString() + "px";

                    }
                    else if (QuestionnaireDto.banner_template == 2)
                    {
                        rfgImageTop.Visible = false;
                        rfgImageBottom.Visible = true;
                        rfgImageBottom.Src = ".." + ResolveUrl(bannerPath + QuestionnaireDto.banner.ToString().Replace(@"\", @"/"));
                        rfgImageBottom.Style["width"] = QuestionnaireDto.banner_width.ToString() + "px";
                        rfgImageBottom.Style["hieght"] = QuestionnaireDto.banner_height.ToString() + "px";
                    }
                    else
                    {
                        rfgImageTop.Visible = false;
                        rfgImageBottom.Visible = false;
                        ImgDisplayBottm.Visible = false;
                        ImgDisplayTop.Visible = false;
                    }
                }
                else
                {
                    ImgDisplayBottm.Visible = false;
                    ImgDisplayTop.Visible = false;
                }


                //Sprint 2 balakumar
                if (QuestionnaireDto.max_number_responses != -1 && QuestionnaireDto.max_number_responses <= QuestionnaireDto.number_of_responses)
                {
                    Literal_Ux_MaxResponses.Text = "Thank you for participating in the campaign.</br>We are sorry that this campaign has ended.</br>Please do visit us again for other campaigns.";
                    Ux_Submit.Visible = false;
                    Ux_PostParams.Visible = false;
                    ImgDisplayBottm.Visible = false;
                    ImgDisplayTop.Visible = false;
                    return;
                }

                this.Master.SetCountryAndLanguage(_questionnaire.CountryCode, _questionnaire.LanguageCode,_questionnaire.Company_Code);


                Ux_FaxRequiredSentence.Visible = false;
                Ux_MobileRequiredSentence.Visible = false;
                Ux_PhoneRequiredSentence.Visible = false;

                SetTelPhoneFaxValidationMessages();

                if (_questionnaire.LeftNavHtml != null)
                {
                    Ux_SecondaryNavigation.Text = _questionnaire.LeftNavHtml;
                }

                #region validation for Flexfield10(AssetID)
                //††† 20100817 Biju Pattathil | RFG 2.2  Start†††
                //string questionnaire_id = Request.Params["qid"];
                //Hashtable h_params = new Hashtable();
                //h_params.Add("questionnaire_id", questionnaire_id);

                //DataTable questionnaire_general = DB.execProc("select_questionnaire_general", h_params);
                //h_params.Clear();
                //if (questionnaire_general.Rows.Count != 0)
                //{

                //    if ((Request.Params["status"] == null) || (Request.Params["status"].ToString() != "test"))
                //    {
                //        if (bool.Parse(questionnaire_general.Rows[0]["any_asset"].ToString()))
                //        {
                //            if (Request.Params["flexfield10"] != null)
                //            {
                //                if (Request.Params["flexfield10"].ToString() != "")
                //                {
                //                    if (!System.Text.RegularExpressions.Regex.IsMatch(Request.Params["flexfield10"].ToString(), utility.getParameter("FlexField10Format")))
                //                    {
                //                        Response.Redirect(String.Format("~/FormContentError.aspx?flex10msg=flexfield10 Incorrect"), true);
                //                    }
                //                }
                //            }
                //            else
                //            {
                //                Response.Redirect(String.Format("~/FormContentError.aspx?flex10msg=flexfield10 Missing"), true);
                //            }


                //        }
                //    }
                //}
                //else
                //{
                //    Response.Redirect("404_invalidqid.aspx", true);
                //}

                //††† 20100817 Biju Pattathil | RFG 2.2  Start†††
                #endregion


                #region validation for Flexfield12(AssetID)

                //Code commented because of message localization issue in UI 
                //††† 20120507 | Tirumala Raju | RFG 2.7 | flexfield12 length validation  Start†††
                //string questionnaire_id = Request.Params["qid"];
                //Hashtable h_params = new Hashtable();
                //h_params.Add("questionnaire_id", questionnaire_id);

                //DataTable questionnaire_general = DB.execProc("select_questionnaire_general", h_params);
                //h_params.Clear();
                //if (questionnaire_general.Rows.Count != 0)
                //{
                //    if (bool.Parse(questionnaire_general.Rows[0]["any_asset"].ToString()))
                //    {
                //        if (!string.IsNullOrEmpty(Request.Params["flexfield12"]))
                //        {
                //            if (Request.Params["flexfield12"].ToString().Length > 255)
                //            {
                //                Response.Redirect(String.Format("FormContentError.aspx?flex12msg=flexfield12 value exceeds 255 characters so can't be uploaded"), true);
                //            }
                //        }
                //    }
                //}
                //††† 20120507 | Tirumala Raju | RFG 2.7  End†††
                #endregion


                if (Wucs != null)
                {
                    if (PageAssembly.Page.RequiredSentence != null)
                        Ux_RequiredSentence.Text = WebConstants.ToRequiredSentence(PageAssembly.Page.RequiredSentence);

                    if (PageAssembly.Page.PrivacySentence != null)
                        Ux_PrivacySentance.Text = PageAssembly.Page.PrivacySentence;

                    //Random random = new Random();
                    string submitText = PageAssembly.Page.ButtonText != null ? PageAssembly.Page.ButtonText : String.Empty;
                    Ux_Submit.Text = submitText;
                    //Img_Submit.Attributes.Add("width", ePeRFGen.live.images.btn_submit.MeasureImgWidth(submitText, "1", _questionnaire.LanguageCode, Server.MapPath("~/live/fonts")).ToString());
                    //Img_Submit.Attributes.Add("src", "~/templates/live/images/btn_submit.aspx?qid=" + _questionnaire.QuestionnaireId + "&pageid=" + PageAssembly.Page.PageId + "&btype=1&random=" + random.Next());
                    //Img_SubmitHover.Attributes.Add("width", ePeRFGen.live.images.btn_submit.MeasureImgWidth(submitText, "1", _questionnaire.LanguageCode, Server.MapPath("~/live/fonts")).ToString());
                    //Img_SubmitHover.Attributes.Add("src", "~/templates/live/images/btn_submit.aspx?qid=" + _questionnaire.QuestionnaireId + "&pageid=" + PageAssembly.Page.PageId + "&type=hover" + "&btype=1&random=" + random.Next());                                

                    if (PageAssembly.Elements.Find(elem => elem.Pageelement.PageElementType == PageElementType.RequiredHeadline) != null)
                    {
                        Ux_Required_Headline.Text = PageAssembly
                            .Elements
                            .Find(elem => elem.Pageelement.PageElementType == PageElementType.RequiredHeadline)
                            .Pageelement.ElementText;
                    }

                    if (PageAssembly.Page.Introduction != null)
                        Ux_IntroText.Text = PageAssembly.Page.Introduction;

                    if (LanguageCode.ToLower().Equals("ja") &&
                        CountryCode.ToLower().Equals("jp"))
                    {
                        Ux_Title.Text = utility.getParameter("html_head_title_prefix_jp_ja") + PageAssembly.Page.PageTitle;
                    }
                    else
                        Ux_Title.Text = PageAssembly.Page.PageTitle;

                    Ux_Headline.Text = PageAssembly.Page.PageTitle;

                    Ux_Tagline.Text = PageAssembly.Page.PageTagline;

                    //Removed in 2.8
                    //if (!string.IsNullOrEmpty(PageAssembly.Questionnaire.MainImage))
                    //    Ux_MainImage.ImageUrl = "../mainimages/" + PageAssembly.Questionnaire.MainImage;
                    //else
                    //    Ux_MainImage.ImageUrl = Ux_MainImage.ImageUrl.Replace("_default.jpg", "_default_" + ElementReadDirection + ".jpg");
                    if (TabNavigationElements.Count > 0)
                    {
                        ((WucTabNavigation)Ux_TabNavigation).NavigationElements = TabNavigationElements;
                    }

                    ((WucRightNavigation)Ux_RightNavigation).NavigationElements = AdditionalNavigationElements;

                    foreach (WucPageElementBase elem in Wucs)
                    {
                        System.Web.UI.WebControls.Panel div = new System.Web.UI.WebControls.Panel();
                        div.CssClass = "rfgQuestionContainer rfg" + elem.PageElementType.ToString();
                        div.Controls.Add(elem);
                        Ux_Content.Controls.Add(div);

                        if (elem.PageElementType == PageElementType.PersonalDataSection)
                        {
                            if (((HP.Rfg.Common.Questionnaire.PersonalDataSectionDto)elem.PageElement) != null)
                            {
                                HP.Rfg.Common.Questionnaire.PersonalDataSectionDto personalDataDto = (HP.Rfg.Common.Questionnaire.PersonalDataSectionDto)elem.PageElement;
                                if (personalDataDto.MobileNumber != null)
                                {
                                    if (!string.IsNullOrEmpty(personalDataDto.MobileNumber.ToString().Trim()))
                                        bMobileExists = true;
                                }

                                if (personalDataDto.FaxNumber != null)
                                {
                                    if (!string.IsNullOrEmpty(personalDataDto.FaxNumber.ToString().Trim()))
                                        bFaxExists = true;
                                }

                                if (personalDataDto.TelephoneNumber != null)
                                {
                                    if (!string.IsNullOrEmpty(personalDataDto.TelephoneNumber.ToString().Trim()))
                                        bTelePhoneExists = true;
                                }
                            }
                        }
                    }



                    if (bFaxExists == true)
                    {
                        //    Ux_FaxRequiredSentence.Visible = true;
                        if (FaxValidationMessage != null)
                            Ux_FaxRequiredSentence.Text = WebConstants.ToLabelWithErrorBullet(FaxValidationMessage);
                    }
                    if (bMobileExists == true)
                    {
                        //     Ux_MobileRequiredSentence.Visible = true;
                        if (MobileValidatioinMessage != null)
                            Ux_MobileRequiredSentence.Text = WebConstants.ToLabelWithErrorBullet(MobileValidatioinMessage);
                    }
                    if (bTelePhoneExists == true)
                    {
                        //   Ux_PhoneRequiredSentence.Visible = true;
                        if (TelephoneValidationMessage != null)
                            Ux_PhoneRequiredSentence.Text = WebConstants.ToLabelWithErrorBullet(TelephoneValidationMessage);
                    }
                }//else: there should be a redirect from RfgExternalPage

                if (Request.Params["status"] == "test" && Configuration.Platform != "production")
                {
                    Ux_PostParams.Visible = true;
                }
                else
                {
                    Ux_PostParams.Visible = false;
                }

                if (RfgPage.MdaId != null)
                {
                    string path = Server.MapPath(utility.getParameter("path_to_MDAs"));
                    Ux_MdaTagline.Text = page_utilities.get_mda_taglineStandalone(path, RfgPage.MdaFileName, QuestionnaireDto.CountryCode, QuestionnaireDto.LanguageCode);


                    Ux_MdaDisclaimer.Text = page_utilities.get_mda_tagline(path, "msmda_vistaDis.inc", QuestionnaireDto.CountryCode, QuestionnaireDto.LanguageCode);
                }
            }
            else
            {
                String URI = Request.Url.ToString();
                URI = URI.Replace("/index", "/index_e");
                Response.Redirect(URI);
            }
        }
        public void ResolveValidationContainerToEnclosingPageRecursively()
        {
            // direct containment
            Page page = new Page();
            TestValidationControl vc = new TestValidationControl();
            page.Controls.Add(vc);
            Assert.AreSame(page, vc.TheValidationContainer);

            // indirect containment
            page = new Page();
            vc = new TestValidationControl();
            Control inBetweenControl = new System.Web.UI.WebControls.Panel();
            inBetweenControl.Controls.Add(vc);
            page.Controls.Add(inBetweenControl);
            Assert.AreSame(page, vc.TheValidationContainer);
        }