Пример #1
0
        public void SetSelectionsInPlaceholder(Option baseOption, PlaceHolder ph, OptionSelectionList selections)
        {
            if (ph == null)
            {
                return;
            }
            if (selections == null)
            {
                return;
            }
            var val = selections.FindByOptionId(baseOption.Bvin);

            if (val == null)
            {
                return;
            }

            var vals = val.SelectionData.Split(',');

            foreach (var s in vals)
            {
                var checkId = string.Concat("opt", s.Replace("-", string.Empty));
                var cb      = (HtmlInputCheckBox)ph.FindControl(checkId);
                if (cb != null)
                {
                    cb.Checked = true;
                }
            }
        }
Пример #2
0
        private bool IsSelected(OptionItem item, OptionSelectionList selections)
        {
            bool result = false;

            if (selections == null)
            {
                return(false);
            }

            OptionSelection val = selections.FindByOptionId(item.OptionBvin);

            if (val == null)
            {
                return(result);
            }

            string[] vals = val.SelectionData.Split(',');
            foreach (string s in vals)
            {
                if (s == item.Bvin.Replace("-", ""))
                {
                    return(true);
                }
            }
            return(result);
        }
Пример #3
0
        private bool IsSelected(OptionItem item, OptionSelectionList selections)
        {
            var result = false;

            if (selections == null || selections.Count < 1)
            {
                return(item.IsDefault);
            }

            var val = selections.FindByOptionId(item.OptionBvin);

            if (val == null)
            {
                return(result);
            }

            var vals = val.SelectionData.Split(',');

            foreach (var s in vals)
            {
                if (s == item.Bvin.Replace("-", string.Empty))
                {
                    return(true);
                }
            }
            return(result);
        }
Пример #4
0
        /// <summary>
        ///     Used to show the option values in view order
        /// </summary>
        /// <param name="baseOption"></param>
        /// <param name="selections"></param>
        /// <returns></returns>
        public string CartDescription(Option baseOption, OptionSelectionList selections)
        {
            if (selections == null)
            {
                return(string.Empty);
            }
            var val = selections.FindByOptionId(baseOption.Bvin);

            if (val == null)
            {
                return(string.Empty);
            }

            if (!string.IsNullOrWhiteSpace(val.SelectionData))
            {
                var files = val.SelectionData.Split('|').ToList();

                if (files.Count <= 0)
                {
                    return(string.Empty);
                }

                var downloadLinks = string.Empty;
                var strFormat     = "<li><a href=\"{0}\" target=\"_blank\" class=\"fileDownLoadLink\">{1}</a><span class=\"fileSize\"> ({2})</span></li>";

                foreach (var file in files)
                {
                    if (string.IsNullOrWhiteSpace(file))
                    {
                        continue;
                    }

                    var fileParam = file.Split('<');


                    //Temporary fix : Revert back of fix - Replace character ? (questionmark) with - (dash)
                    //See ParseFromForm function for root cause
                    var fileDownloadPath = fileParam[0].Replace('?', '-');


                    var fileSize = fileParam[1];
                    var fileName = Path.GetFileName(fileDownloadPath);
                    var fileHtml = string.Format(strFormat, fileDownloadPath, fileName, fileSize);

                    //var fileHtml = "<li>" +
                    //               "<a href=\"" + fileDownloadPath + "\" target=\"_blank\" class=\"fileDownLoadLink\" >" +
                    //               fileName + "</a><span class=\"fileSize\" > (" + fileSize + ")</span>" +
                    //               "</li>";

                    downloadLinks = string.Concat(downloadLinks, fileHtml);
                }

                var bvin = baseOption.Bvin.Replace("-", string.Empty);
                downloadLinks = string.Format("<br /><ul id=\"downloads-{0}\" class=\"fileDownLoadLinks\">{1}</ul>", bvin, downloadLinks);

                return(string.Concat(baseOption.Name, ": ", downloadLinks));
            }

            return(string.Empty);
        }
Пример #5
0
        public void SetSelectionsInPlaceholder(Option baseOption, PlaceHolder ph, OptionSelectionList selections)
        {
            if (ph == null)
            {
                return;
            }
            if (selections == null)
            {
                return;
            }
            var val = selections.FindByOptionId(baseOption.Bvin);

            if (val == null)
            {
                return;
            }

            var ddl = (System.Web.UI.WebControls.DropDownList)ph.FindControl("opt" + baseOption.Bvin.Replace("-", string.Empty));

            if (ddl != null)
            {
                if (ddl.Items.FindByValue(val.SelectionData) != null)
                {
                    ddl.ClearSelection();
                    ddl.Items.FindByValue(val.SelectionData).Selected = true;
                }
            }
        }
Пример #6
0
        public void SetSelectionsInPlaceholder(Option baseOption, PlaceHolder ph, OptionSelectionList selections)
        {
            if (ph == null)
            {
                return;
            }
            if (selections == null)
            {
                return;
            }
            var val = selections.FindByOptionId(baseOption.Bvin);

            if (val == null)
            {
                return;
            }

            var radioId = "opt" + val.SelectionData.Replace("-", string.Empty);
            var rb      = (HtmlInputRadioButton)ph.FindControl(radioId);

            if (rb != null)
            {
                rb.Checked = true;
            }
        }
Пример #7
0
        /// <summary>
        ///     Used to show the option values in view order
        /// </summary>
        /// <param name="baseOption"></param>
        /// <param name="selections"></param>
        /// <returns></returns>
        public string CartDescription(Option baseOption, OptionSelectionList selections)
        {
            if (selections == null)
            {
                return(string.Empty);
            }
            var val = selections.FindByOptionId(baseOption.Bvin);

            if (val == null)
            {
                return(string.Empty);
            }

            if (!string.IsNullOrWhiteSpace(val.SelectionData))
            {
                var files = val.SelectionData.Split('|').ToList();

                if (files.Count <= 0)
                {
                    return(string.Empty);
                }

                var downloadLinks = string.Empty;

                foreach (var file in files)
                {
                    if (string.IsNullOrWhiteSpace(file))
                    {
                        continue;
                    }

                    var fileParam = file.Split('<');


                    //Temporary fix : Revert back of fix - Replace character ? (questionmark) with - (dash)
                    //See ParseFromForm function for root cause
                    var fileDownloadPath = fileParam[0].Replace('?', '-');


                    var fileSize = fileParam[1];
                    var fileName = Path.GetFileName(fileDownloadPath);

                    var fileHtml = "<li>" +
                                   "<a href=\"" + fileDownloadPath + "\" target=\"_blank\" class=\"fileDownLoadLink\" >" +
                                   fileName + "</a><span class=\"fileSize\" > (" + fileSize + ")</span>" +
                                   "</li>";
                    downloadLinks += fileHtml;
                }

                var bvin = baseOption.Bvin.Replace("-", string.Empty);
                downloadLinks = "<br>" +
                                "<ul class=\"fileDownLoadLinks\" >" +
                                downloadLinks +
                                "</ul>";
                return(baseOption.Name + ": " + downloadLinks); //System.Web.HttpUtility.HtmlDecode(val.SelectionData);
            }

            return(string.Empty);
        }
Пример #8
0
        public List <string> GetSelectionValues(Option option, OptionSelectionList selections)
        {
            var opSel = selections.FindByOptionId(option.Bvin);
            var data  = opSel != null ? opSel.SelectionData : null;
            var vals  = new List <string> {
                data
            };

            return(vals);
        }
Пример #9
0
        public string RenderWithSelection(Option baseOption, OptionSelectionList selections, string prefix = null, string className = null)
        {
            var selected = string.Empty;

            if (selections != null)
            {
                var sel = selections.FindByOptionId(baseOption.Bvin);
                if (sel != null)
                {
                    selected = sel.SelectionData;
                }
            }

            var sb = new StringBuilder();

            var cols = GetColumns(baseOption);

            if (string.IsNullOrEmpty(cols))
            {
                cols = DEFAULT_COLS;
            }

            var rows = GetRows(baseOption);

            if (string.IsNullOrEmpty(rows))
            {
                rows = DEFAULT_ROWS;
            }

            var optionNameId = string.Concat("opt", prefix, baseOption.Bvin.Replace("-", string.Empty));

            if (rows != DEFAULT_ROWS)
            {
                sb.AppendFormat(TEXTAREA_MARKUP_FORMAT, optionNameId, cols, rows, selected, className);
                //sb.Append("<textarea id=\"" + optionNameId + "\" cols=\"" + c + "\" rows=\"" + r + "\" ");
                //sb.Append(" name=\"" + optionNameId + "\" ");
                //sb.Append(">");
                //sb.Append(selected);
                //sb.Append("</textarea>");
            }
            else
            {
                var maxLength = GetMaxLength(baseOption);

                // HCC 03.03.00 ignoring the cols HTML attribute in <input type="text" />
                sb.AppendFormat(TEXTBOX_MARKUP_FORMAT, optionNameId, maxLength, selected, className);
                //sb.Append("<input type=\"text\" id=\"" + optionNameId + "\" cols=\"" + c + "\" maxlength=\"" +
                //          maxLength + "\"");
                //sb.Append(" name=\"" + optionNameId + "\" ");
                //sb.Append(" value=\"" + selected + "\"");
                //sb.Append("/>");
            }

            return(sb.ToString());
        }
Пример #10
0
        private bool IsSelected(OptionItem item, OptionSelectionList selections)
        {
            bool result = false;
            if (selections == null) return false;

            OptionSelection val = selections.FindByOptionId(item.OptionBvin);
            if (val == null) return result;

            if (val.SelectionData == item.Bvin.Replace("-","")) return true;
            
            return result;
        }
Пример #11
0
        public List <string> GetSelectionValues(Option option, OptionSelectionList selections)
        {
            var opSel = selections.FindByOptionId(option.Bvin);
            var data  = opSel != null ? opSel.SelectionData : null;
            var vals  = new List <string>();

            if (!string.IsNullOrEmpty(data))
            {
                vals = option.Items.Where(i => data == i.Bvin.Replace("-", string.Empty)).Select(i => i.Name).ToList();
            }

            return(vals);
        }
Пример #12
0
        public List <string> GetSelectionValues(Option baseOption, OptionSelectionList selections)
        {
            var retVal = new List <string>();

            if (selections == null)
            {
                return(retVal);
            }

            var val = selections.FindByOptionId(baseOption.Bvin);

            if (val == null)
            {
                return(retVal);
            }

            if (!string.IsNullOrWhiteSpace(val.SelectionData))
            {
                var files = val.SelectionData.Split('|').ToList();

                if (files.Count <= 0)
                {
                    return(retVal);
                }
                var downloadLinks = string.Empty;

                foreach (var file in files)
                {
                    if (string.IsNullOrWhiteSpace(file))
                    {
                        continue;
                    }

                    var fileParam = file.Split('<');

                    //Temporary fix : Revert back of fix - Replace character ? (questionmark) with - (dash)
                    //See ParseFromForm function for root cause
                    var fileDownloadPath = fileParam[0].Replace('?', '-');

                    var fileSize = fileParam[1];
                    var fileName = Path.GetFileName(fileDownloadPath);

                    var fileDetails = string.Concat(fileName, " (", fileSize, ") ");
                    retVal.Add(fileDetails);
                }

                return(retVal);
            }

            return(retVal);
        }
Пример #13
0
        public string RenderWithSelection(Option baseOption, OptionSelectionList selections, string prefix = null, string className = null)
        {
            string selected = null;

            if (selections != null)
            {
                var sel = selections.FindByOptionId(baseOption.Bvin);
                if (sel != null)
                {
                    selected = sel.SelectionData;
                }
            }

            var sb    = new StringBuilder();
            var oBvin = baseOption.Bvin.Replace("-", string.Empty);

            sb.AppendFormat(DROPDOWN_MARKUP_FORMAT, prefix, oBvin, className);

            //sb.Append("<select id=\"opt" + prefix + oBvin + "\" ");
            //sb.Append(" name=\"opt" + prefix + oBvin + "\" ");
            //sb.Append(" class=\"hcIsOption\" >");

            foreach (var o in baseOption.Items)
            {
                if (o.IsLabel)
                {
                    sb.Append("<option value=\"\" disabled");

                    if (string.IsNullOrEmpty(selected) && o.IsDefault)
                    {
                        sb.Append(" selected ");
                    }
                    sb.Append(string.Concat(">", o.Name, "</option>"));
                }
                else
                {
                    sb.Append(string.Concat("<option value=\"", o.Bvin.Replace("-", string.Empty), "\""));
                    if (o.Bvin.Replace("-", string.Empty) == selected || (string.IsNullOrEmpty(selected) && o.IsDefault))
                    {
                        sb.Append(" selected ");
                    }
                    sb.Append(string.Concat(">", o.Name, "</option>"));
                }
            }
            sb.Append("</select>");

            return(sb.ToString());
        }
Пример #14
0
        public string RenderWithSelection(Option baseOption, OptionSelectionList selections, string prefix = null)
        {
            var selected = string.Empty;

            if (selections != null)
            {
                var sel = selections.FindByOptionId(baseOption.Bvin);
                if (sel != null)
                {
                    selected = sel.SelectionData;
                }
            }

            var sb = new StringBuilder();
            var c  = GetColumns(baseOption);

            if (string.IsNullOrEmpty(c))
            {
                c = "20";
            }
            var r = GetRows(baseOption);

            if (string.IsNullOrEmpty(r))
            {
                r = "1";
            }

            var optionNameId = "opt" + prefix + baseOption.Bvin.Replace("-", string.Empty);

            if (r != "1")
            {
                sb.Append("<textarea id=\"" + optionNameId + "\" cols=\"" + c + "\" rows=\"" + r + "\" ");
                sb.Append(" name=\"" + optionNameId + "\" ");
                sb.Append(">");
                sb.Append(selected);
                sb.Append("</textarea>");
            }
            else
            {
                sb.Append("<input type=\"text\" id=\"" + optionNameId + "\" cols=\"" + c + "\" maxlength=\"" +
                          GetMaxLength(baseOption) + "\"");
                sb.Append(" name=\"" + optionNameId + "\" ");
                sb.Append(" value=\"" + selected + "\"");
                sb.Append("/>");
            }

            return(sb.ToString());
        }
Пример #15
0
        public string RenderWithSelection(Option baseOption, OptionSelectionList selections, string prefix = null)
        {
            string selected = null;

            if (selections != null)
            {
                var sel = selections.FindByOptionId(baseOption.Bvin);
                if (sel != null)
                {
                    selected = sel.SelectionData;
                }
            }

            var sb = new StringBuilder();

            sb.Append("<select id=\"opt" + prefix + baseOption.Bvin.Replace("-", string.Empty) + "\" ");
            sb.Append(" name=\"opt" + prefix + baseOption.Bvin.Replace("-", "") + "\" ");
            sb.Append(" class=\"hcIsOption\" >");

            foreach (var o in baseOption.Items)
            {
                if (o.IsLabel)
                {
                    sb.Append("<option value=\"\" disabled");
                    //sb.Append("<option value=\"systemlabel\" disabled");

                    if (string.IsNullOrEmpty(selected) && o.IsDefault)
                    {
                        sb.Append(" selected ");
                    }
                    sb.Append(">" + o.Name + "</option>");
                }
                else
                {
                    sb.Append("<option value=\"" + o.Bvin.Replace("-", string.Empty) + "\"");
                    if (o.Bvin.Replace("-", string.Empty) == selected || (string.IsNullOrEmpty(selected) && o.IsDefault))
                    {
                        sb.Append(" selected ");
                    }
                    sb.Append(">" + o.Name + "</option>");
                }
            }
            sb.Append("</select>");

            return(sb.ToString());
        }
Пример #16
0
        public string RenderWithSelection(Option baseOption, OptionSelectionList selections)
        {
            string selected = string.Empty;

            if (selections != null)
            {
                OptionSelection sel = selections.FindByOptionId(baseOption.Bvin);
                if (sel != null)
                {
                    selected = sel.SelectionData;
                }
            }

            StringBuilder sb = new StringBuilder();
            string        c  = this.GetColumns(baseOption);

            if (c == "")
            {
                c = "20";
            }
            string r = this.GetRows(baseOption);

            if (r == "")
            {
                r = "1";
            }

            if (r != "1")
            {
                sb.Append("<textarea id=\"opt" + baseOption.Bvin.Replace("-", "") + "\" cols=\"" + c + "\" rows=\"" + r + "\" ");
                sb.Append(" name=\"opt" + baseOption.Bvin.Replace("-", "") + "\" ");
                sb.Append(">");
                sb.Append(selected);
                sb.Append("</textarea>");
            }
            else
            {
                sb.Append("<input type=\"text\" id=\"opt" + baseOption.Bvin.Replace("-", "") + "\" cols=\"" + c + "\" maxlength=\"" + this.GetMaxLength(baseOption) + "\"");
                sb.Append(" name=\"opt" + baseOption.Bvin.Replace("-", "") + "\" ");
                sb.Append(" value=\"" + selected + "\"");
                sb.Append("/>");
            }

            return(sb.ToString());
        }
Пример #17
0
        private bool IsSelected(OptionItem item, OptionSelectionList selections)
        {
            bool result = false;
            if (selections == null) return false;

            OptionSelection val = selections.FindByOptionId(item.OptionBvin);
            if (val == null) return result;

            string[] vals = val.SelectionData.Split(',');
            foreach (string s in vals)
            {
                if (s == item.Bvin.Replace("-", ""))
                {
                    return true;
                }                
            }                       
            return result;
        }
Пример #18
0
        public string CartDescription(Option baseOption, OptionSelectionList selections)
        {
            if (selections == null)
            {
                return(string.Empty);
            }
            var val = selections.FindByOptionId(baseOption.Bvin);

            if (val == null)
            {
                return(string.Empty);
            }

            if (val.SelectionData.Trim().Length > 0)
            {
                return(string.Concat(baseOption.Name, ": ", HttpUtility.HtmlEncode(val.SelectionData)));
            }

            return(string.Empty);
        }
Пример #19
0
        public string RenderWithSelection(Option baseOption, OptionSelectionList selections)
        {
            string selected = string.Empty;

            if (selections != null)
            {
                OptionSelection sel = selections.FindByOptionId(baseOption.Bvin);
                if (sel != null)
                {
                    selected = sel.SelectionData;
                }
            }

            StringBuilder sb = new StringBuilder();

            sb.Append("<select id=\"opt" + baseOption.Bvin.Replace("-", "") + "\" ");
            sb.Append(" name=\"opt" + baseOption.Bvin.Replace("-", "") + "\" ");
            sb.Append(" class=\"isoption\" >");

            foreach (OptionItem o in baseOption.Items)
            {
                if (o.IsLabel)
                {
                    sb.Append("<option value=\"systemlabel\">" + o.Name + "</option>");
                }
                else
                {
                    sb.Append("<option value=\"" + o.Bvin.Replace("-", "") + "\"");
                    if (o.Bvin.Replace("-", "") == selected)
                    {
                        sb.Append(" selected ");
                    }
                    sb.Append(">" + o.Name + "</option>");
                }
            }
            sb.Append("</select>");

            return(sb.ToString());
        }
Пример #20
0
        public string RenderWithSelection(Option baseOption, OptionSelectionList selections)
        {
            string selected = string.Empty;
            if (selections != null)
            {
                OptionSelection sel = selections.FindByOptionId(baseOption.Bvin);
                if (sel != null)
                {
                    selected = sel.SelectionData;
                }
            }

            StringBuilder sb = new StringBuilder();

            sb.Append("<select id=\"opt" + baseOption.Bvin.Replace("-", "") + "\" ");
            sb.Append(" name=\"opt" + baseOption.Bvin.Replace("-", "") + "\" ");
            sb.Append(" class=\"isoption\" >");

            foreach (OptionItem o in baseOption.Items)
            {
                if (o.IsLabel)
                {
                    sb.Append("<option value=\"systemlabel\">" + o.Name + "</option>");
                }
                else
                {
                    sb.Append("<option value=\"" + o.Bvin.Replace("-", "") + "\"");
                    if (o.Bvin.Replace("-","") == selected)
                    {
                        sb.Append(" selected ");
                    }
                    sb.Append(">" + o.Name + "</option>");
                }
            }
            sb.Append("</select>");

            return sb.ToString();
        }
Пример #21
0
        private bool IsSelected(OptionItem item, OptionSelectionList selections)
        {
            bool result = false;

            if (selections == null)
            {
                return(false);
            }

            OptionSelection val = selections.FindByOptionId(item.OptionBvin);

            if (val == null)
            {
                return(result);
            }

            if (val.SelectionData == item.Bvin.Replace("-", ""))
            {
                return(true);
            }

            return(result);
        }
Пример #22
0
        public string CartDescription(Option baseOption, OptionSelectionList selections)
        {
            if (selections == null)
            {
                return(string.Empty);
            }
            var val = selections.FindByOptionId(baseOption.Bvin);

            if (val == null)
            {
                return(string.Empty);
            }

            foreach (var oi in baseOption.Items)
            {
                var cleaned = OptionSelection.CleanBvin(oi.Bvin);
                if (cleaned == val.SelectionData)
                {
                    return(baseOption.Name + ": " + oi.Name);
                }
            }

            return(string.Empty);
        }
Пример #23
0
        public string RenderWithSelection(Option baseOption, OptionSelectionList selections)
        {
            string selected = string.Empty;
            if (selections != null)
            {
                OptionSelection sel = selections.FindByOptionId(baseOption.Bvin);
                if (sel != null)
                {
                    selected = sel.SelectionData;
                }
            }

            StringBuilder sb = new StringBuilder();
            string c = this.GetColumns(baseOption);
            if (c == "") c = "20";
            string r = this.GetRows(baseOption);
            if (r == "") r = "1";
            
            if (r != "1")
            {
                sb.Append("<textarea id=\"opt" + baseOption.Bvin.Replace("-","") + "\" cols=\"" + c + "\" rows=\"" + r + "\" ");
                sb.Append(" name=\"opt" + baseOption.Bvin.Replace("-", "") + "\" ");
                sb.Append(">");
                sb.Append(selected);
                sb.Append("</textarea>");
            }
            else
            {                
                sb.Append("<input type=\"text\" id=\"opt" + baseOption.Bvin.Replace("-","") + "\" cols=\"" + c + "\" maxlength=\"" + this.GetMaxLength(baseOption) + "\"");
                sb.Append(" name=\"opt" + baseOption.Bvin.Replace("-", "") + "\" ");
                sb.Append(" value=\"" + selected + "\"");
                sb.Append("/>");
            }

            return sb.ToString();
        }
Пример #24
0
        public string CartDescription(Option baseOption, OptionSelectionList selections)
        {
            if (selections == null)
            {
                return(string.Empty);
            }
            var val = selections.FindByOptionId(baseOption.Bvin);

            if (val == null)
            {
                return(string.Empty);
            }
            var vals = val.SelectionData.Split(',');

            var result = string.Concat(baseOption.Name, ": ");
            var first  = true;

            foreach (var oi in baseOption.Items)
            {
                var cleaned = OptionSelection.CleanBvin(oi.Bvin);
                if (vals.Contains(cleaned))
                {
                    if (!first)
                    {
                        result += ", ";
                    }
                    else
                    {
                        first = false;
                    }
                    result += oi.Name;
                }
            }

            return(result);
        }
Пример #25
0
        public void SetSelectionsInPlaceholder(Option baseOption, PlaceHolder ph, OptionSelectionList selections)
        {
            if (ph == null)
            {
                return;
            }
            if (selections == null)
            {
                return;
            }
            var val = selections.FindByOptionId(baseOption.Bvin);

            if (val == null)
            {
                return;
            }

            var tb = (TextBox)ph.FindControl(string.Concat("opt", baseOption.Bvin.Replace("-", string.Empty)));

            if (tb != null)
            {
                tb.Text = val.SelectionData;
            }
        }