Exemplo n.º 1
0
 public editPropertyFieldTemplate(FeatProperty p)
     : this(p, string.Empty)
 {
 }
Exemplo n.º 2
0
        public editPropertyFieldTemplate(FeatProperty p, string sdfFile)
        {
            if (p.IsReadOnly == true)
            {
                Label lbl = new Label();
                lbl.Text = p.Value.ToString();
                lbl.ID = p.Name;
                c.Add(lbl);
            }
            else if (p.AviableValues != null)
            {
                DropDownList ddl = new DropDownList();
                ddl.ID = p.Name;
                for (int i = 0; i < p.AviableValues.Count; i++)
                {
                    ddl.Items.Add(new ListItem(p.AviableValues[i]));
                }
                ddl.SelectedIndex = ddl.Items.IndexOf(ddl.Items.FindByText(p.Value.ToString()));
                ddl.Style["width"] = "150px";
                c.Add(ddl);

                if (!string.IsNullOrEmpty(sdfFile))
                {
                    LiteralControl lnkEditConstraint = new LiteralControl();
                    lnkEditConstraint.Text = string.Format("<span class='buttonP' onclick='ShowSdfEditorDialog(\"{0}\", \"_FeatureCard_{0}\")'>+</span>", HttpUtility.UrlEncode(p.Name));
                    ddl.Style["width"] = "130px";
                    c.Add(lnkEditConstraint);
                }
            }
            else if (p.LookUpValues != null && p.LookUpValues.Count != 0)
            {
                DropDownList ddl = new DropDownList();
                ddl.ID = p.Name;
                foreach (var item in p.LookUpValues)
                {
                    ddl.Items.Add(new ListItem(item.Value, item.Key.ToString()));
                }
                if (p.Value == null) ddl.SelectedIndex = 0;
                else ddl.SelectedIndex = ddl.Items.IndexOf(ddl.Items.FindByValue(p.Value.ToString()));
                ddl.Style["width"] = "150px";
                c.Add(ddl);

                if (!string.IsNullOrEmpty(sdfFile))
                {
                    LiteralControl lnkEditConstraint = new LiteralControl();
                    lnkEditConstraint.Text = string.Format("<span class='buttonP' onclick='ShowSdfEditorDialog(\"{0}\", \"_FeatureCard_{0}\")'>+</span>", HttpUtility.UrlEncode(p.Name));
                    ddl.Style["width"] = "130px";
                    c.Add(lnkEditConstraint);
                }
            }
            else if (p.PropertyType == MgPropertyType.DateTime)
            {
                TextBox tb = new TextBox();
                tb.ID = p.Name;
                if (p.Value != null)
                    tb.Text = p.Value.ToString();

                tb.Style.Add("margin-left", "2px");
                tb.ToolTip = "dd/MM/yyyy";
                tb.Attributes.Add("dir", "ltr");
                tb.Style.Add("text-align", "right");
                c.Add(tb);
                if (p.Alias == "תאריך עדכון" || p.Alias == "עדכון אחרון")
                {
                    tb.Enabled = false;
                    return;
                }
                tb.CssClass = "dateField";
                ImageButton btnPicker = new ImageButton();
                btnPicker.ID = string.Format("{0}_btnPicker", p.Name);
                btnPicker.ImageUrl = "~/Images/calendar.jpg";
                btnPicker.ImageAlign = ImageAlign.Middle;
                btnPicker.Height = new Unit("16px");
                c.Add(btnPicker);

                CalendarExtender ext = new CalendarExtender();
                ext.PopupButtonID = btnPicker.ID;
                ext.TargetControlID = tb.ID;
                ext.Format = "dd/MM/yyyy";
                ext.CssClass = "cal_Theme1";
                ext.ID = string.Format("{0}_ext", p.Name);
                ext.Enabled = true;
                c.Add(ext);

                MaskedEditExtender meExt = new MaskedEditExtender();
                meExt.Mask = "99/99/9999";
                meExt.InputDirection = MaskedEditInputDirection.RightToLeft;
                meExt.TargetControlID = tb.ID;
                meExt.MaskType = MaskedEditType.Date;
                meExt.ID = string.Format("{0}_MaskEditExt", p.Name);
                c.Add(meExt);

            }
            else if (p.PropertyType == MgPropertyType.Boolean)
            {
                CheckBox cb = new CheckBox();
                cb.ID = p.Name;
                if (p.Value == null) p.Value = "False";
                cb.Checked = bool.Parse(p.Value.ToString());
                c.Add(cb);
            }
            else
            {
                TextBox tb = new TextBox();
                tb.ID = p.Name;
                if (p.Value != null)
                    tb.Text = p.Value.ToString();
                else
                    tb.Text = string.Empty;
                c.Add(tb);
            }
        }
Exemplo n.º 3
0
 public viewPropertyFieldTemplate(FeatProperty p)
 {
     if (p.PropertyType == MgPropertyType.Boolean)
     {
         CheckBox cb = new CheckBox();
         cb.ID = p.Name;
         cb.Checked = bool.Parse(p.Value.ToString());
         cb.Enabled = false;
         c.Add(cb);
         Label lbl = new Label();
         lbl.Text = cb.Checked ? "(כן)" : "(לא)";
         lbl.ID = "lbl_" + p.Name;
         c.Add(lbl);
     }
     else
     {
         Label lbl = new Label();
         if (p.Value != null)
         {
             if (p.LookUpValues != null && p.LookUpValues.Count > 0)
             {
                 var vals = p.LookUpValues.Where(x => x.Key == (int)p.Value);
                 foreach (var v in vals)
                 {
                     Label lblTxt = new Label();
                     lblTxt.Text = v.Value;
                     lblTxt.ID = p.Name + "_txt";
                     lbl.Visible = false;
                     c.Add(lblTxt);
                     break;
                 }
             }
             lbl.Text = p.Value.ToString();
         }
         lbl.ID = p.Name;
         //lbl.DataBinding += new EventHandler(lbl_DataBinding);
         c.Add(lbl);
     }
 }