Ejemplo n.º 1
0
 protected void CloseWindow()
 {
     this.FieldList       = new List <EmailTemplateFieldDTO>();
     Session["FieldList"] = null;
     Session["FieldType"] = null;
     //reset fieldOption session value
     Session["FieldOptions"] = null;
     this.btnAddTemplate.Enable();
     //form reset
     FormPanelFieldData.Reset();
     //hide the form panel
     X.GetCmp <Ext.Net.Panel>("panelFieldData").Hidden = true;
     //set window height as form panel is hidden
     this.Window1.Height = 200;
     //reset radio group to select again
     //rdRadioGroup.Reset();
     rdHidden.Checked    = true;
     cbxFieldList.Hidden = true;
     ResetFieldList();
     strFieldList.RemoveAll();
     //hide save template button
     btnSaveTemplate.Hidden = true;
     btnSaveTemplate.Disable();
     //reset window title
     Window1.Title = "Email Template";
 }
Ejemplo n.º 2
0
        public void DisableFieldDataForm()
        {
            int fieldListOffset = 0, saveTemplateOffset = 0;

            //form reset
            FormPanelFieldData.Reset();

            //hide the form panel
            X.GetCmp <Ext.Net.Panel>("panelFieldData").Hidden = true;



            //reset radio group to select again/fieldList
            //rdRadioGroup.Reset();
            rdHidden.Checked = true;
            ResetFieldList();

            //reset fieldOption session value
            Session["FieldOptions"] = null;

            //get fieldList from session if exists
            if (Session["FieldList"] != null)
            {
                FieldList = (List <EmailTemplateFieldDTO>)Session["FieldList"];
                if (FieldList.Count > 0)
                {
                    btnSaveTemplate.Hidden = false;
                    btnSaveTemplate.Enable();
                    cbxFieldList.Hidden = false;
                    fieldListOffset     = 15;
                    saveTemplateOffset  = 40;
                }
                else
                {
                    btnSaveTemplate.Hidden = true;
                    btnSaveTemplate.Disable();
                    cbxFieldList.Hidden = true;
                    fieldListOffset     = 0;
                    saveTemplateOffset  = 0;
                }
            }
            this.Window1.Height = 200 + fieldListOffset + saveTemplateOffset;
        }
Ejemplo n.º 3
0
        protected void Select_RadioButton(object sender, DirectEventArgs e)
        {
            int optionListOffset = 0, saveTemplateOffset = 0;

            if (Session["FieldList"] != null)
            {
                FieldList = (List <EmailTemplateFieldDTO>)Session["FieldList"];
            }

            //set field type
            FieldType = X.GetCmp <RadioGroup>("rdRadioGroup").CheckedItems[0].InputValue;
            this.FormPanelFieldData.Title = FieldType + " Field";
            Session["FieldType"]          = FieldType;

            pnlFieldOptions.Hidden = true;

            //set panel size
            if (FieldType == "Dropdown")
            {
                optionListOffset       = 110;
                pnlFieldOptions.Hidden = false;
            }
            panelFieldData.Height = 265 + optionListOffset;

            //set the window size if/else count>0
            if (FieldList.Count > 0)
            {
                saveTemplateOffset = 30;
            }
            this.Window1.Height = 455 + optionListOffset + saveTemplateOffset;

            this.Window1.X = 200;

            //show the form panel
            var panel = X.GetCmp <Ext.Net.Panel>("panelFieldData");

            panel.Hidden = false;

            //reset form
            FormPanelFieldData.Reset();
        }
Ejemplo n.º 4
0
        protected void SelectField(object sender, DirectEventArgs e)
        {
            //store the selected field properties
            var selectedValue = cbxFieldList.Value.ToString();

            Session["SelectedFieldIndex"] = cbxFieldList.SelectedItem.Index;
            Session["SelectedFieldValue"] = selectedValue;

            // cbxFieldList.RemoveByIndex(v);
            //var selectedValue = cbxFieldList.Value.ToString();

            //Enable cancel button
            //btnCancel.Hidden = false;

            if (Session["FieldList"] != null)
            {
                FieldList = (List <EmailTemplateFieldDTO>)Session["FieldList"];
            }

            //  FieldList.RemoveAll(f => f.FieldName == selectedValue);

            //get the selected field to edit
            var selectedField = FieldList.Where(f => f.FieldName == selectedValue).Select(f => f).ToList().FirstOrDefault();

            //store the field type of selected field
            FieldType                = selectedField.FieldType;
            Session["FieldType"]     = FieldType;
            FormPanelFieldData.Title = FieldType + " Field";



            //reset form
            EnableFieldDataForm(false);

            //enable delete button if existing field is selected and count of fields > 1
            if (FieldList != null && FieldList.Count > 1)
            {
                btnDelete.Hidden = false;
            }


            if (selectedField.FieldOptions != null)
            {
                //get field options
                var fieldOptions = selectedField.FieldOptions;
                //set fieldoptions on field selection to edit
                Session["FieldOptions"] = fieldOptions;

                //bind with fieldOption list
                cbxFieldOptions.Store[0].DataSource = fieldOptions;
                cbxFieldOptions.Store[0].DataBind();
            }



            //set the field values for selected field in UI
            FormPanelFieldData.SetValues(new
            {
                FieldName    = selectedField.FieldName,
                DisplayName  = selectedField.DisplayName,
                IsAllowBlank = selectedField.IsAllowBlank,
                MaxLength    = selectedField.MaxLength,
                DataType     = selectedField.DataType,
                FieldOrder   = selectedField.FieldOrder,
                DefaultValue = selectedField.DefaultValue
                               // FieldOptions = selectedField.FieldOptions
            });
        }
Ejemplo n.º 5
0
        protected void EnableFieldDataForm(bool isNewField)
        {
            // reset field option data
            Session["FieldOptions"] = null;
            cbxFieldOptions.Reset();
            strFieldOptions.RemoveAll();

            //show the field data panel
            var panel = X.GetCmp <Ext.Net.Panel>("panelFieldData");

            panel.Hidden = false;

            //set field type
            if (isNewField)
            {
                FieldType = X.GetCmp <RadioGroup>("rdRadioGroup").CheckedItems[0].InputValue;
                this.FormPanelFieldData.Title = "New " + FieldType + " Field";
            }

            //Update field type
            Session["FieldType"] = FieldType;

            //reset existing field cbox on select new element/vice-versa
            if (isNewField)
            {
                ResetFieldList();
            }
            else
            {
                rdHidden.Checked = true;
            }

            //set panel size
            int optionListOffset = 0, saveTemplateOffset = 0, fieldListOffset = 0;

            pnlFieldOptions.Hidden = true;
            if (FieldType == "Dropdown")
            {
                optionListOffset       = 65;
                pnlFieldOptions.Hidden = false;
            }
            panelFieldData.Height = 280 + optionListOffset;

            //set the window size if/else count>0
            if (Session["FieldList"] != null)
            {
                FieldList = (List <EmailTemplateFieldDTO>)Session["FieldList"];
            }
            if (FieldList.Count > 0)
            {
                saveTemplateOffset = 30;
                fieldListOffset    = 40;
            }
            this.Window1.Height = 470 + optionListOffset + saveTemplateOffset + fieldListOffset;

            //reset form
            FormPanelFieldData.Reset();
            this.Window1.X = 200;

            var vv = Session["SelectedFieldValue"];
        }