protected void lbTop_Click(object sender, EventArgs e)
        {
            string param = Request.Params.Get("__EVENTARGUMENT");
            Guid   uid   = Guid.Empty;

            try
            {
                uid = new Guid(param);
            }
            catch
            {
                return;
            }

            FormController fController = new FormController(FormDocumentData);
            FormSection    itemSection = fController.GetSectionByUid(uid);

            if (itemSection != null)
            {
                fController.MoveSectionUp(uid);
            }
            else
            {
                FormItem item = fController.GetSTLItemByUid(uid);
                if (item != null)
                {
                    fController.MoveFormItemUp(uid);
                }
            }

            BindRendererInner();
        }
        protected override void loadData()
        {
            var staticTable = FormItemBlock.CreateFormItemTable();

            staticTable.AddFormItems(
                FormItem.Create("Static Field", new EwfTextBox("Values here will be retained across post-backs")),
                FormItem.Create("Static Field", new EwfTextBox("")),
                FormItem.Create(
                    "Static Field",
                    new EwfTextBox("Edit this one to get a validation error"),
                    validationGetter: control => new EwfValidation(
                        (pbv, validator) => {
                if (control.ValueChangedOnPostBack(pbv))
                {
                    validator.NoteErrorAndAddMessage("You can't change the value in this box!");
                }
            })));
            staticTable.IncludeButtonWithThisText = "Submit";
            ph.AddControlsReturnThis(staticTable);

            ph.AddControlsReturnThis(getBasicRegionBlocks());

            var listTable = EwfTable.Create(
                style: EwfTableStyle.StandardLayoutOnly,
                fields: from i in new[] { 10, 1, 10 } select new EwfTableField(size: Unit.Percentage(i)));

            listTable.AddItem(
                new EwfTableItem(
                    new EwfTableItemSetup(verticalAlignment: TableCellVerticalAlignment.Top),
                    getNonIdListRegionBlocks().ToCell(),
                    "",
                    getIdListRegionBlocks().ToCell()));
            ph.AddControlsReturnThis(listTable);
        }
        private IEnumerable <Control> getBasicRegionBlocks()
        {
            var rs = new UpdateRegionSet();
            var pb = PostBack.CreateIntermediate(rs.ToCollection(), id: "basic");

            yield return
                (new LegacyParagraph(new PostBackButton(new ButtonActionControlStyle("Toggle Basic Region Below"), usesSubmitBehavior: false, postBack: pb)));

            var regionControls    = new List <Control>();
            var dynamicFieldValue = new DataValue <string>();

            FormState.ExecuteWithDataModificationsAndDefaultAction(
                pb.ToCollection(),
                () => {
                if (info.Toggled)
                {
                    regionControls.Add(
                        FormItem.Create(
                            "Dynamic Field",
                            new EwfTextBox("This was just added!"),
                            validationGetter: control => new EwfValidation((pbv, validator) => dynamicFieldValue.Value = control.GetPostBackValue(pbv))).ToControl());
                }
                else
                {
                    regionControls.Add(new LegacyParagraph("Nothing here yet."));
                }
            });
            yield return
                (new NamingPlaceholder(new Section("Basic Update Region", regionControls, style: SectionStyle.Box).ToCollection(), updateRegionSets: rs.ToCollection()));

            pb.AddModificationMethod(() => parametersModification.Toggled = !parametersModification.Toggled);
            pb.AddModificationMethod(
                () =>
                AddStatusMessage(StatusMessageType.Info, info.Toggled ? "Dynamic field value was '{0}'.".FormatWith(dynamicFieldValue.Value) : "Dynamic field added."));
        }
Example #4
0
        public ActionResult Edit(CardsModels model, Captcha captcha)
        {
            SitePage  curPage = CardsDAO.GetPage(model.No);
            FormModel item    = FormDAO.GetItemFromCardNo(model.No);

            if (item.HasCaptcha)
            {
                if (captcha == null || !captcha.Validate())
                {
                    return(new HttpStatusCodeResult(System.Net.HttpStatusCode.NonAuthoritativeInformation, "驗證碼錯誤"));
                }
            }

            FormItem formItem = FormItemSave(item);

            SendEmail(curPage.SiteID, item, formItem);

            ViewBag.CurPage         = curPage;
            ViewBag.FormItem        = formItem;
            ViewBag.UploadDesignUrl = Golbal.UpdFileInfo.GetVPathBySiteID(curPage.SiteID, formDesignFileDir).TrimEnd('/') + "/";
            ViewBag.UploadUrl       = Golbal.UpdFileInfo.GetVPathByMenuID(curPage.SiteID, curPage.MenuID);
            ViewBag.Int64Convert    = new Golbal.Int64Converter();

            ViewBag.Exit = true;

            return(View(item));
        }
Example #5
0
        public void GetFrom(Product product, ProductDesc productDesc, List<ProductPhoto> productPhotoList, List<Sku> skuList, StringBuilder errorMsg)
        {
            //基本信息
            FormItem<int> ProductIdItem = new FormItem<int>("ProductId", "产品编号", 0, 10, 0);
            FormItem<int> ProductTypeItem = new FormItem<int>("ProductType", "所属类型", 0, 3, 0);
            FormItem<string> ProductNameItem = new FormItem<string>("ProductName", "商品名称", 2, 30);
            FormItem<string> SubNameItem = new FormItem<string>("SubName", "商品卖点", 0, 30, "");
            FormItem<string> ZscItem = new FormItem<string>("Zsc", "商品编码", 0, 10,"");
            FormItem<decimal> PriceItem = new FormItem<decimal>("Price", "一口价", 0, 100000);
            FormItem<decimal> AmountItem = new FormItem<decimal>("Amount", "商品数量", 0, 100000);

            product.ProductId = ProductIdItem.GetFormValue(errorMsg);
            product.ProductType = ProductTypeItem.GetFormValue(errorMsg);
            product.ProductName = ProductNameItem.GetFormValue(errorMsg);
            product.SubName = SubNameItem.GetFormValue(errorMsg);
            product.Zsc = ZscItem.GetFormValue(errorMsg);
            product.Price = PriceItem.GetFormValue(errorMsg);
            product.Amount = AmountItem.GetFormValue(errorMsg);

            DateTime dt=DateTime.Now;
            product.CreateTime = dt;
            product.UpdateTime = dt;
            product.StartTime = dt;
            product.EndTime = dt;

            //产品说明
            FormItem<string> DescItem = new FormItem<string>("Desc", "商品详细", 0, 25000);

            productDesc.Desc = DescItem.GetFormValue(errorMsg);
        }
Example #6
0
        private void BtnDeviceMQTTSend_Click(object sender, EventArgs e)
        {
            FormItem d = (FormItem)listBox1.SelectedItem;

            if (d == null)
            {
                return;
            }

            if (mqttClient == null || !mqttClient.IsConnected)
            {
                MessageBox.Show("MQTT服务器未连接成功,请先确认连接成后,再同步mqtt服务器", "MQTT未连接");
                return;
            }

            JArray  jArray = new JArray();
            JObject obj    = new JObject();

            obj["mac"] = d.GetMac();

            JObject objItem = new JObject();

            objItem["mqtt_uri"]      = txtMQTTServer.Text;
            objItem["mqtt_port"]     = (int)numMQTTPort.Value;
            objItem["mqtt_user"]     = txtMQTTUser.Text;
            objItem["mqtt_password"] = txtMQTTPassword.Text;


            obj["setting"] = objItem;
            string json = obj.ToString();

            send(null, json);
        }
Example #7
0
 public void RunStarted(object automationObject, Dictionary <string, string> replacementsDictionary, WizardRunKind runKind, object[] customParams)
 {
     try
     {
         DTE = (DTE)automationObject;
         if (DTE.ActiveSolutionProjects is Array activeSolutionProjects && activeSolutionProjects.Length > 0)
         {
             ActiveProject = activeSolutionProjects.GetValue(0) as Project;
         }
         var nameSpace       = replacementsDictionary["$rootnamespace$"];
         var sharedNameSpace = Utility.GetSharedNameSpace(DTE);
         var form            = new FormItem(ItemType.LateBound, DTE, nameSpace, sharedNameSpace);
         if (form.ShowDialog() == DialogResult.Cancel)
         {
             throw new WizardCancelledException();
         }
         //Creating item ...
         Class         = form.ComboBoxEntityName;
         GeneratedCode = form.GeneratedLateBoundClass;
         Wizard.ProcessItemReplacementsDictionary(replacementsDictionary, form);
         CloseWindows();
     }
     catch
     {
         throw;
     }
 }
Example #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UPStaticTextGroupModelController"/> class.
 /// </summary>
 /// <param name="formItem">The form item.</param>
 /// <param name="identifier">The identifier.</param>
 /// <param name="theDelegate">The delegate.</param>
 public UPStaticTextGroupModelController(FormItem formItem, IIdentifier identifier, IGroupModelControllerDelegate theDelegate)
     : base(theDelegate)
 {
     this.ExplicitTabIdentifier = identifier;
     this.ExplicitLabel         = formItem.Label;
     this.FormItem = formItem;
 }
        protected override void loadData()
        {
            ph.AddControlsReturnThis(new Paragraph("You may report any problems, make suggestions, or ask for help here."));

            var pb = PostBack.CreateFull(actionGetter: () => new PostBackAction(new ExternalResourceInfo(info.ReturnUrl)));

            var table = FormItemBlock.CreateFormItemTable();

            table.AddFormItems(
                FormItem.Create("From", new EmailAddress(AppTools.User.Email, AppTools.User.FriendlyName).ToMailAddress().ToString().GetLiteralControl()),
                FormItem.Create(
                    "To",
                    "{0} ({1} for this system)".FormatWith(
                        StringTools.GetEnglishListPhrase(EmailStatics.GetAdministratorEmailAddresses().Select(i => i.DisplayName), true),
                        "support contacts".ToQuantity(EmailStatics.GetAdministratorEmailAddresses().Count(), showQuantityAs: ShowQuantityAs.None)).GetLiteralControl()),
                FormItem.Create(
                    "Message",
                    new EwfTextBox("", rows: 10),
                    validationGetter:
                    control =>
                    new EwfValidation(
                        (pbv, validator) => body.Value = validator.GetString(new ValidationErrorHandler("message"), control.GetPostBackValue(pbv), false),
                        pb)));
            ph.AddControlsReturnThis(table);

            EwfUiStatics.SetContentFootActions(new ActionButtonSetup("Send Message", new PostBackButton(pb)));

            pb.AddModificationMethod(modifyData);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="UPInsightBoardGroupModelController"/> class.
        /// </summary>
        /// <param name="formItem">The form item.</param>
        /// <param name="identifier">The identifier.</param>
        /// <param name="theDelegate">The delegate.</param>
        public UPInsightBoardGroupModelController(FormItem formItem, IIdentifier identifier, IGroupModelControllerDelegate theDelegate)
            : base(formItem, theDelegate)
        {
            this.itemControllerArray   = new List <UPInsightBoardItemGroupModelController>();
            this.ExplicitTabIdentifier = identifier;
            this.ExplicitLabel         = formItem.Label;
            this.testViewReference     = formItem.ViewReference;
            string contextMenuName      = formItem.ViewReference.ContextValueForKey("MenuName");
            string recordIdentification = formItem.ViewReference.ContextValueForKey("RecordId");

            recordIdentification = UPCRMDataStore.DefaultStore.ReplaceRecordIdentification(recordIdentification);
            this.ConfigInsightBoard(contextMenuName, recordIdentification);

            UPMInsightBoardGroup insightBoardGroup = new UPMInsightBoardGroup(identifier);

            insightBoardGroup.LabelText = formItem.Label;

            if (formItem.Options != null)
            {
                string heightValue = formItem.Options.ContainsKey("height") ? formItem.Options["height"] as string : null;
                if (!string.IsNullOrEmpty(heightValue))
                {
                    insightBoardGroup.Height = Convert.ToInt32(heightValue);
                }

                string maxVisibleItems = formItem.Options.ContainsKey("MaxVisibleItems") ? formItem.Options["MaxVisibleItems"] as string : null;
                if (!string.IsNullOrEmpty(maxVisibleItems))
                {
                    insightBoardGroup.MaxVisibleItems = Convert.ToInt32(maxVisibleItems);
                }

                string vertical = formItem.Options.ContainsKey("Vertical") ? formItem.Options["Vertical"] as string : null;
                if (!string.IsNullOrEmpty(vertical))
                {
                    var isIntValue = int.TryParse(vertical, out int intValue);
                    insightBoardGroup.SingleRow = isIntValue ? !Convert.ToBoolean(intValue) : !Convert.ToBoolean(vertical);
                    if (!insightBoardGroup.SingleRow)
                    {
                        insightBoardGroup.Center = true;
                    }
                }

                string centerString = formItem.Options.ContainsKey("Center") ? formItem.Options["Center"] as string : null;
                if (!string.IsNullOrEmpty(centerString))
                {
                    insightBoardGroup.Center = Convert.ToBoolean(centerString);
                }

                string layoutValue = formItem.Options.ContainsKey("layout") ? formItem.Options["layout"] as string : null;
                if (!string.IsNullOrEmpty(layoutValue))
                {
                    insightBoardGroup.Layout = (UPMInsightBoardGroupLayout)Convert.ToInt32(layoutValue);
                }
            }

            this.ControllerState = this.itemControllerArray.Count > 0 ? GroupModelControllerState.Pending : GroupModelControllerState.Empty;
            this.Group           = insightBoardGroup;
            this.AddDependingKeysFromViewReference(formItem.ViewReference);
        }
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            this.Close();
            FormItem f1 = new FormItem();

            f1.Show();
            this.Hide();
        }
Example #12
0
        public FormUpdateVisitor(FormGroup formGroup, NameValueCollection values, FormItem source, string argument)
        {
            this.values   = values;
            this.source   = source;
            this.argument = argument;

            Visit(formGroup);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="UnknownControlGroupModelController"/> class.
 /// </summary>
 /// <param name="formItem">The form item.</param>
 /// <param name="identifier">The identifier.</param>
 /// <param name="theDelegate">The delegate.</param>
 public UnknownControlGroupModelController(FormItem formItem, IIdentifier identifier, IGroupModelControllerDelegate theDelegate)
     : base(theDelegate)
 {
     this.FormItem              = formItem;
     this.ViewReference         = formItem.ViewReference;
     this.ExplicitTabIdentifier = identifier;
     this.ExplicitLabel         = this.FormItem.Label;
 }
 private void LoadFormGiaoDien()
 {
     for (int i = 0; i < arrDisplay.Length; i++)
     {
         FormItem item = new FormItem(arrValues[i], arrDisplay[i]);
         cboGiaoDienMacDinh.Items.Add(item);
     }
 }
Example #15
0
        private void tambahBarangToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var itemForm = new FormItem();

            //var itemForm = new FormBarangItem();
            itemForm.MdiParent = this;
            itemForm.Show();
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="UPFieldControlBasedGroupModelController"/> class.
 /// </summary>
 /// <param name="formItem">The form item.</param>
 /// <param name="theDelegate">The delegate.</param>
 public UPFieldControlBasedGroupModelController(FormItem formItem, IGroupModelControllerDelegate theDelegate)
     : base(theDelegate)
 {
     this.FormItem               = formItem;
     this.ControllerState        = GroupModelControllerState.Empty;
     this.ChangedControllerState = true;
     this.RequestOption          = UPRequestOption.FastestAvailable;
     this.RootTabIndex           = -1;
 }
Example #17
0
        protected override void loadData()
        {
            var pb =
                PostBack.CreateFull(
                    actionGetter:
                    () =>
                    new PostBackAction(
                        new SecondaryResponse(
                            () =>
                            EwfResponse.Create(
                                ContentTypes.ApplicationZip,
                                new EwfResponseBodyCreator(createAndZipSystem),
                                fileNameCreator: () => "{0}.zip".FormatWith(systemShortName.Value)))));

            FormState.ExecuteWithDataModificationsAndDefaultAction(
                pb.ToCollection(),
                () => {
                ph.AddControlsReturnThis(
                    FormItemBlock.CreateFormItemTable(
                        formItems: new[]
                {
                    FormItem.Create(
                        "System name",
                        new EwfTextBox(""),
                        validationGetter: control => new EwfValidation(
                            (pbv, validator) => {
                        systemName.Value = validator.GetString(
                            new ValidationErrorHandler("system name"),
                            control.GetPostBackValue(pbv),
                            false,
                            50);
                        if (systemName.Value != systemName.Value.RemoveNonAlphanumericCharacters(preserveWhiteSpace: true))
                        {
                            validator.NoteErrorAndAddMessage("The system name must consist of only alphanumeric characters and white space.");
                        }
                        systemShortName.Value = systemName.Value.EnglishToPascal();
                    })),
                    FormItem.Create(
                        "Base namespace",
                        new EwfTextBox(""),
                        validationGetter: control => new EwfValidation(
                            (pbv, validator) => {
                        baseNamespace.Value = validator.GetString(
                            new ValidationErrorHandler("base namespace"),
                            control.GetPostBackValue(pbv),
                            false,
                            50);
                        if (baseNamespace.Value != EwlStatics.GetCSharpIdentifier(baseNamespace.Value))
                        {
                            validator.NoteErrorAndAddMessage("The base namespace must be a valid C# identifier.");
                        }
                    }))
                }));
            });

            EwfUiStatics.SetContentFootActions(new ActionButtonSetup("Create System", new PostBackButton(pb)));
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="UPGroupModelController"/> class.
 /// </summary>
 /// <param name="formItem">The form item.</param>
 /// <param name="theDelegate">The delegate.</param>
 public UPGroupModelController(FormItem formItem, IGroupModelControllerDelegate theDelegate)
 {
     this.Delegate                = theDelegate;
     this.FormItem                = formItem;
     this.controllerState         = GroupModelControllerState.Empty;
     this._changedControllerState = true;
     this.RequestOption           = UPRequestOption.FastestAvailable;
     this.RootTabIndex            = -1;
 }
Example #19
0
        // Parse form data and return an array of FormItems objects
        public FormItemCollection Decode(string postData, string boundary)
        {
            string       s          = "";
            StringReader postStream = new StringReader(ref postData);

            boundary = "--" + boundary;

            FormItemCollection formItems = new FormItemCollection();

            s = postStream.ReadLine();

            while (postStream.Position < postStream.Length)
            {
                if (s == (boundary + "--"))
                {
                    break;                                              // End of the form data
                }
                if (s == boundary)
                {
                    // Here's the beginning of a form value
                    FormItem f = new FormItem();
                    s = postStream.ReadLine();

                    string[] itemData = s.Split(';');
                    f.Name = itemData[1].Replace(" name=", "");
                    f.Name = f.Name.Replace("\"", "");

                    // See if we have any additional form data
                    if (itemData.Length == 3)
                    {
                        f.Filename = (itemData[2].Replace(" filename=", "")).Replace("\"", "");

                        // Skip the next two lines;
                        s = postStream.ReadLine();
                        s = postStream.ReadLine();
                    }
                    else
                    {
                        // Skip one line
                        s = postStream.ReadLine();
                    }

                    // Parse the data of this form item
                    f.DataStartIndex = postStream.Position;
                    do
                    {
                        s = postStream.ReadLine();
                    } while ((postStream.Position < postStream.Length) &&
                             (!(s.StartsWith(boundary))));

                    // Find the Data index and length based on current stream position
                    f.DataLength = ((postStream.Position - f.DataStartIndex) - s.Length) - 4; // Disregard the terminating 0x0d0a2d2d
                    formItems.Add(f.Name, f);                                                 // Add to the return array
                }
            }
            return(formItems);
        }
Example #20
0
        protected override ApplyResult ProcessApplyItem(ref object obj, out string errormessage, out string successmessage, out bool edited)
        {
            errormessage   = "";
            successmessage = "";
            edited         = false;
            string action   = this.Request.Form.action.Value.ToLower();
            int    objectID = -1;

            if (this.Request.Form.objectID != null)
            {
                objectID = int.Parse(this.Request.Form.objectID.Value.ToString());
            }

            string html = this.Request.Form.HTML.Value;

            FormItem item = new FormItem(objectID,
                                         this.Request.Form.Name.Value,
                                         html);

            obj = item;



            switch (action)
            {
            case BaseWebModule.PostSave:

                List <SWBaseTag> tags = SWBaseTag.GetTags(html, SWBaseTag.BaseTagTypes.Form);
                foreach (SWBaseTag t1 in tags)
                {
                    foreach (SWBaseTag t2 in tags)
                    {
                        if (!t1.Equals(t2) &&
                            t1.Name.Equals(t2.Name))
                        {
                            errormessage = String.Format("There are one or more tags with the same name {0}.", t1.Name);
                            return(ApplyResult.Message);
                        }
                    }
                }

                bool result = false;
                result = new DBContent().SaveForm(item, out errormessage);
                edited = item.ID > 0;

                if (result)
                {
                    return(ApplyResult.Save);
                }
                break;

            case BaseWebModule.PostCancel:
                return(ApplyResult.Cancel);
            }
            return(ApplyResult.Message);
        }
Example #21
0
 public void RegisterWindow(FrmToolBase form, string uniqueId)
 {
     if (this._forms[uniqueId] != null)
         throw new InvalidOperationException("Window is already registered.");
     if (string.IsNullOrEmpty(uniqueId))
         throw new ArgumentNullException("uniqueId cannot be null.", "uniqueId");
     
     FormItem fi = new FormItem(form, uniqueId);
     _forms.Add(fi);
 }
Example #22
0
        public ActionResult FormItemView(long siteId, long menuId, long id, bool?isEvent)
        {
            FormItem item = FormItemDAO.GetItem(id);

            ViewBag.IsEvent   = isEvent ?? false;
            ViewBag.SiteID    = siteId;
            ViewBag.MenuID    = menuId;
            ViewBag.UploadUrl = Golbal.UpdFileInfo.GetVPathByMenuID(siteId, menuId).TrimEnd('/');
            return(View(item));
        }
Example #23
0
        public ActionResult ModifyFlag(long siteId, long formItemId)
        {
            FormItem             formItem = FormItemDAO.GetItem(formItemId);
            IEnumerable <string> flags    = UserFlagDAO.GetFlags(siteId, formItem.Email, formItem.Mobile, formItem.Phone, formItem.IDCard);

            ViewBag.SiteID     = siteId;
            ViewBag.FormItemID = formItemId;
            ViewBag.AllFlags   = UserFlagDAO.GetFlags(siteId);
            return(View(flags));
        }
        private void addHtmlEditor()
        {
            HtmlBlockEditorModification mod;

            ph.AddControlsReturnThis(
                FormItem.Create(
                    "",
                    new HtmlBlockEditor(null, id => { }, out mod),
                    validationGetter: c => new Validation((pbv, v) => c.Validate(pbv, v, new ValidationErrorHandler("html")), DataUpdate)).ToControl());
        }
        private Section test4(Action <string> setValue)
        {
            var pb  = PostBack.CreateFull(id: "test4");
            var box =
                FormItem.Create(
                    "",
                    new EwfTextBox("", postBack: pb, autoPostBack: true),
                    validationGetter: control => new EwfValidation((pbv, v) => setValue(control.GetPostBackValue(pbv)), pb)).Control;

            return(new Section("Post-back on change.", box.ToSingleElementArray(), style: SectionStyle.Box));
        }
Example #26
0
        public ActionResult DeleteConfirmed(int id)
        {
            FormItem formItem = db.FormItems.Find(id);

            db.FormItems.Remove(formItem);

            db.SaveChanges();

            //string url = Url.Action("Index", "Downloads", new { /*id = address.PersonID*/ });
            return(Json(new { success = true /*, url = url*/ }));
        }
        protected override void loadData()
        {
            var table = FormItemBlock.CreateFormItemTable();

            table.AddFormItems(
                FormItem.Create("Date Picker", new DatePicker(null)),
                FormItem.Create("Time Picker", new TimePicker(null)),
                FormItem.Create("Date/Time Picker", new DateTimePicker(null)),
                FormItem.Create("Duration Picker", new DurationPicker(TimeSpan.Zero)));
            ph.AddControlsReturnThis(table);
        }
Example #28
0
        private Box test5(Action <string> setValue)
        {
            var pb  = PostBack.CreateFull(id: "test5");
            var box =
                FormItem.Create(
                    "",
                    new EwfTextBox("", postBack: pb),
                    validationGetter: control => new EwfValidation((pbv, v) => setValue(control.GetPostBackValue(pbv)), pb)).Control;

            return(new Box("Post-back on enter.", box.ToSingleElementArray()));
        }
 private void bbi_ItemClick(object sender, ItemClickEventArgs e)
 {
     try
     {
         FormItem fi = clsCallForm.CreateNewForm(e.Item.Name);
         if (fi != null)
         {
             AddDocument(fi.xForm);
         }
     }
     catch { }
 }
Example #30
0
        public ActionResult FormItemEdit(long siteId, long menuId, FormItem formItem, bool?isEvent)
        {
            FormItemSave(formItem);

            ViewBag.IsEvent   = isEvent ?? false;
            ViewBag.SiteID    = siteId;
            ViewBag.MenuID    = menuId;
            ViewBag.UploadUrl = Golbal.UpdFileInfo.GetVPathByMenuID(siteId, menuId).TrimEnd('/');

            ViewBag.Exit = true;
            return(View(formItem));
        }
	private void Write (FormItem item) {
		// The types we check here need to match the
		// types we allow in .Add

		if (item.Value is FileInfo) {
			Write (item.Name, (FileInfo)item.Value);
		} else if (item.Value is string) {
			Write (item.Name, (string)item.Value);
		} else {
			throw new Exception ("Unknown value type");
		}
	}
        // Log-In

        /// <summary>
        /// Gets an email address form item for use on log-in pages. The validation sets this data value to the post back value of the text box, if valid, or adds
        /// the specified error message to the form item.
        /// </summary>
        public static FormItem <EwfTextBox> GetEmailAddressFormItem(this DataValue <string> emailAddress, FormItemLabel label, string errorMessage)
        {
            return(FormItem.Create(
                       label,
                       new EwfTextBox(""),
                       validationGetter:
                       control =>
                       new EwfValidation(
                           (pbv, validator) =>
                           emailAddress.Value =
                               validator.GetEmailAddress(new ValidationErrorHandler((v, ec) => v.NoteErrorAndAddMessage(errorMessage)), control.GetPostBackValue(pbv), false))));
        }
        private void addFileRow(DynamicTable table, BlobFile file, ActionPostBack deletePb, List <Func <bool> > deleteModMethods)
        {
            var cells = new List <EwfTableCell>();

            var thumbnailControl = BlobFileOps.GetThumbnailControl(file, ThumbnailResourceInfoCreator);

            if (thumbnailControl != null)
            {
                cells.Add(thumbnailControl);
            }

            var fileIsUnread = fileIdsMarkedAsRead != null && !fileIdsMarkedAsRead.Contains(file.FileId);

            cells.Add(
                new PostBackButton(
                    PostBack.CreateFull(
                        id: PostBack.GetCompositeId(postBackIdBase, file.FileId.ToString()),
                        firstModificationMethod: () => {
                if (fileIsUnread && markFileAsReadMethod != null)
                {
                    markFileAsReadMethod(file.FileId);
                }
            },
                        actionGetter: () => new PostBackAction(new SecondaryResponse(new BlobFileResponse(file.FileId, () => true), false))),
                    new TextActionControlStyle(file.FileName),
                    false)
            {
                ToolTip = file.FileName
            });

            cells.Add(file.UploadedDate.ToDayMonthYearString(false));
            cells.Add((fileIsUnread ? "New!" : "").ToCell(new TableCellSetup(classes: "ewfNewness".ToSingleElementArray())));

            var delete         = false;
            var deleteCheckBox =
                FormItem.Create(
                    "",
                    new EwfCheckBox(false, postBack: deletePb),
                    validationGetter: control => new EwfValidation((pbv, v) => { delete = control.IsCheckedInPostBack(pbv); }, deletePb)).ToControl();

            cells.Add(ReadOnly ? null : deleteCheckBox);
            deleteModMethods.Add(
                () => {
                if (!delete)
                {
                    return(false);
                }
                BlobFileOps.SystemProvider.DeleteFile(file.FileId);
                return(true);
            });

            table.AddRow(cells.ToArray());
        }
Example #34
0
        private AdminInfo GetAddForm()
        {
            AdminInfo info = new AdminInfo();
            FormItem<string> adminNameItem = new FormItem<string>("adminName", "帐号", 3, 15);
            FormItem<string> passwordItem = new FormItem<string>("password", "密码", 5, 10);
            FormItem<int> statusItem = new FormItem<int>("status", "状态", -100, 99999, 0);

            info.AdminName = adminNameItem.GetFormValue(ErrorMsg);
            info.Password = passwordItem.GetFormValue(ErrorMsg);
            info.Status = statusItem.GetFormValue(ErrorMsg);
            info.Keyt = Zero.Core.Web.Utils.GetRandomEn(5);
            info.Password = Zero.Core.Security.Encrypt.EncodeMD5(info.Keyt + info.Password);
            return info;
        }
Example #35
0
    /// <summary>
    /// Adds new form item (field or category) to the form definition.
    /// </summary>
    /// <param name="formItem">Form item to add</param>
    protected void InsertFormItem(FormItem formItem)
    {
        // Set new item preffix
        string newItemPreffix = (formItem is FormFieldInfo) ? newFieldPreffix : newCategPreffix;

        ListItem newItem = lstAttributes.Items.FindByValue(newItemPreffix);
        int newItemIndex = lstAttributes.Items.IndexOf(newItem);

        if ((newItemIndex > 0) && (lstAttributes.Items[newItemIndex - 1] != null))
        {
            // Add new item at the specified position
            fi.AddFormItem(formItem, newItemIndex);
        }
        else
        {
            if (formItem is FormFieldInfo)
            {
                // Add new field at the end of the collection
                fi.AddFormField((FormFieldInfo)formItem);
            }
            else if (formItem is FormCategoryInfo)
            {
                // Add new category at the end of the collection
                fi.AddFormCategory((FormCategoryInfo)formItem);
            }
        }
    }
Example #36
0
        private CateInfo GetEditForm(CateInfo info)
        {
            FormItem<int> parentIdItem = new FormItem<int>("cateList", "请选择分类", 0, int.MaxValue, 0);
            FormItem<string> cateNameItem = new FormItem<string>("cateName", "分类名称", 1, 50);

            info.Pid = parentIdItem.GetFormValue(ErrorMsg);
            info.CateName = cateNameItem.GetFormValue(ErrorMsg);
            return info;
        }
Example #37
0
        private void GetEditForm(CateAttrInfo info)
        {
            FormItem<int> cateIdItem = new FormItem<int>("cateList", "请选择分类", 1, int.MaxValue);
            FormItem<int> attrIdItem = new FormItem<int>("attrId", "请选择属性", 1, int.MaxValue);
            FormItem<int> typeItem = new FormItem<int>("type", "属性类型", 0, 4);
            FormItem<int> isMustItem = new FormItem<int>("isMust", "是否必须", 0, 1);
            FormItem<int> isSaleItem = new FormItem<int>("isSale", "是否销售属性", 0, 1);
            FormItem<int> isKeyItem = new FormItem<int>("isKey", "是否关键属性", 0, 1);

            info.CateId = cateIdItem.GetFormValue(ErrorMsg);
            info.AttrId = attrIdItem.GetFormValue(ErrorMsg);
            info.Type = typeItem.GetFormValue(ErrorMsg);
            info.IsMust = isMustItem.GetFormValue(ErrorMsg);
            info.IsSale = isSaleItem.GetFormValue(ErrorMsg);
            info.IsKey = isKeyItem.GetFormValue(ErrorMsg);
        }
 private int getCellSpan( FormItem formItem )
 {
     return formItem.CellSpan ?? defaultFormItemCellSpan;
 }
	private long MultipartLength (FormItem item) {
		// The types we check here need to match the
		// types we allow in .Add

		if (item.Value is FileInfo) {
			return MultipartLength (item.Name, (FileInfo)item.Value);
		} else if (item.Value is string) {
			return MultipartLength (item.Name, (string)item.Value);
		} else {
			throw new Exception ("Unknown value type");
		}
	}
Example #40
0
        private void GetEditForm(AttrInfo info)
        {
            //FormItem<int> cateIdItem = new FormItem<int>("cateList", "请选择分类", 1, int.MaxValue);
            FormItem<string> attrItem = new FormItem<string>("attr", "属性名称", 0, 100);
            //FormItem<int> typeItem = new FormItem<int>("type", "属性类型", 0, 4);
            //FormItem<int> isMustItem = new FormItem<int>("isMust", "是否必须", 0, 1);
            //FormItem<int> isSaleItem = new FormItem<int>("isSale", "是否销售属性", 0, 1);
            FormItem<int> statusItem = new FormItem<int>("status", "状态", 0, 99999);

            //info.CateId = cateIdItem.GetFormValue(ErrorMsg);
            info.Attr = attrItem.GetFormValue(ErrorMsg);
            //info.Type = typeItem.GetFormValue(ErrorMsg);
            //info.IsMust = isMustItem.GetFormValue(ErrorMsg);
            //info.IsSale = isSaleItem.GetFormValue(ErrorMsg);
            info.Status = statusItem.GetFormValue(ErrorMsg);
        }
Example #41
0
        private void CreateDocument()
        {
            FormTable tL = new FormTable();
            tL.Columns = "50%;*";
            tL.Width = "100%";
            tL.CellPadding = 5;

            FormRow row1 = new FormRow();
            FormCell cell11 = new FormCell();
            cell11.ColSpan = 2;
            cell11.Name = "cell_11";
            row1.Cells.Add(cell11);
            tL.Rows.Add(row1);

            FormRow row2 = new FormRow();
            FormCell cell21 = new FormCell();
            FormCell cell22 = new FormCell();
            cell21.ColSpan = 1;
            cell22.ColSpan = 1;
            cell21.Name = "cell_21";
            cell22.Name = "cell_22";
            row2.Cells.Add(cell21);
            row2.Cells.Add(cell22);
            tL.Rows.Add(row2);

            FormRow row3 = new FormRow();
            FormCell cell31 = new FormCell();
            cell31.ColSpan = 2;
            cell31.Name = "cell_31";
            row3.Cells.Add(cell31);
            tL.Rows.Add(row3);

            FormSection sec1 = new FormSection();
            sec1.BorderType = 1;
            sec1.ItemIndex = 1;
            sec1.ShowLabel = true;
            sec1.Uid = "dd6acdd98240403984e561399d33d9a9";
            sec1.Labels.Add(new FormLabel("Sec1", Thread.CurrentThread.CurrentUICulture.Name));
            cell11.Sections.Add(sec1);

            FormSection sec2 = new FormSection();
            sec2.BorderType = 0;
            sec2.ItemIndex = 1;
            sec2.ShowLabel = true;
            sec2.Uid = "886cb9a3aae34e68ac8ef234d0ce8ce2";
            sec2.Labels.Add(new FormLabel("Sec2", Thread.CurrentThread.CurrentUICulture.Name));
            cell21.Sections.Add(sec2);

            FormSection sec3 = new FormSection();
            sec3.BorderType = 0;
            sec3.ItemIndex = 1;
            sec3.ShowLabel = true;
            sec3.Uid = "bb6acbb98240403784e561397b33d7a7";
            sec3.Labels.Add(new FormLabel("Sec3", Thread.CurrentThread.CurrentUICulture.Name));
            cell22.Sections.Add(sec3);

            FormSection sec4 = new FormSection();
            sec4.BorderType = 0;
            sec4.ItemIndex = 1;
            sec4.ShowLabel = true;
            sec4.Uid = Guid.NewGuid().ToString("N");
            sec4.Labels.Add(new FormLabel("Sec4", Thread.CurrentThread.CurrentUICulture.Name));
            cell31.Sections.Add(sec4);

            FormControl ctrl1 = new FormControl(FormController.SmartTableLayoutType);
            ctrl1.Columns = "50%;*";
            ctrl1.Width = "100%";
            ctrl1.CellPadding = 5;

            FormItem item1 = new FormItem();
            item1.LabelWidth = "120px";
            item1.ShowLabel = true;
            item1.Labels.Add(new FormLabel("test label1:", Thread.CurrentThread.CurrentUICulture.Name));
            item1.Uid = "9b3c4642e59b405faa2a1f38559a06cc";
            item1.RowIndex = 1;
            item1.CellIndex = 1;
            item1.RowSpan = 1;
            item1.ColSpan = 2;
            FormControl item1c = new FormControl(FormController.MetaPrimitiveControlType);
            item1c.Uid = Guid.NewGuid().ToString("N");
            item1c.Source = "Title";
            item1.Control = item1c;
            ctrl1.Items.Add(item1);

            FormItem item2 = new FormItem();
            item2.LabelWidth = "120px";
            item2.ShowLabel = true;
            item2.Labels.Add(new FormLabel("test label2:", Thread.CurrentThread.CurrentUICulture.Name));
            item2.Uid = "cafa725a31b74ad6a069e3b6446d89c0";
            item2.RowIndex = 2;
            item2.CellIndex = 1;
            item2.RowSpan = 1;
            item2.ColSpan = 1;
            FormControl item2c = new FormControl(FormController.MetaPrimitiveControlType);
            item2c.Uid = Guid.NewGuid().ToString("N");
            item2c.Source = "Priority";
            item2.Control = item2c;
            ctrl1.Items.Add(item2);

            FormItem item3 = new FormItem();
            item3.LabelWidth = "120px";
            item3.ShowLabel = true;
            item3.Labels.Add(new FormLabel("test label3:", Thread.CurrentThread.CurrentUICulture.Name));
            item3.Uid = "8d36be893c3f4cf1b5295be6853eb246";
            item3.RowIndex = 3;
            item3.CellIndex = 1;
            item3.RowSpan = 1;
            item3.ColSpan = 1;
            FormControl item3c = new FormControl(FormController.MetaPrimitiveControlType);
            item3c.Uid = Guid.NewGuid().ToString("N");
            item3c.Source = "Created";
            item3.Control = item3c;
            ctrl1.Items.Add(item3);

            FormItem item4 = new FormItem();
            item4.LabelWidth = "120px";
            item4.ShowLabel = true;
            item4.Labels.Add(new FormLabel("test label4:", Thread.CurrentThread.CurrentUICulture.Name));
            item4.Uid = "a5d87024cbf849cea5d273d77a292e6f";
            item4.RowIndex = 2;
            item4.CellIndex = 2;
            item4.RowSpan = 2;
            item4.ColSpan = 1;
            FormControl item4c = new FormControl(FormController.MetaPrimitiveControlType);
            item4c.Uid = Guid.NewGuid().ToString("N");
            item4c.Source = "Description";
            item4.Control = item4c;
            ctrl1.Items.Add(item4);

            sec1.Control = ctrl1;

            //FormDocument fd = new FormDocument();
            FormDocument fd = FormDocument.Load("Task", "[MC_BaseForm]");
            fd.MetaClassName = "Task";
            fd.Name = "[MC_BaseForm]";
            fd.FormTable = tL;
            fd.Save();
        }
Example #42
0
        private AdminInfo GetEditForm(AdminInfo info)
        {
            FormItem<string> adminNameItem = new FormItem<string>("adminName", "帐号", 3, 15);
            FormItem<string> passwordItem = new FormItem<string>("password", "密码", 5, 10, "");
            FormItem<int> statusItem = new FormItem<int>("status", "状态", -100, 99999, 0);

            info.AdminName = adminNameItem.GetFormValue(ErrorMsg);
            info.Password = passwordItem.GetFormValue(ErrorMsg);
            info.Status = statusItem.GetFormValue(ErrorMsg);
            info.UpdateTime = DateTime.Now;

            if (!string.IsNullOrEmpty(info.Password))
            {
                info.Keyt = Zero.Core.Web.Utils.GetRandomEn(5);
                info.Password = Zero.Core.Security.Encrypt.EncodeMD5(info.Keyt + info.Password);
            }
            return info;
        }