当前位置: 首页>>代码示例>>C#>>正文


C# FormDataCollection类代码示例

本文整理汇总了C#中FormDataCollection的典型用法代码示例。如果您正苦于以下问题:C# FormDataCollection类的具体用法?C# FormDataCollection怎么用?C# FormDataCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


FormDataCollection类属于命名空间,在下文中一共展示了FormDataCollection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PostLogin

        public string PostLogin(FormDataCollection body)
        {
            string username = body.Get("username");
            string password = body.Get("password");

            using(var session = store.OpenSession())
            {
                var profile = session.Load<Profile>("profiles/" + username);
                if(profile.Password == password)
                {
                    var defaultPrincipal = new ClaimsPrincipal(
                        new ClaimsIdentity(new[] {new Claim(MyClaimTypes.ProfileKey, profile.Id)},
                            "Application" // this is important. if it's null or empty, IsAuthenticated will be false
                            ));
                    var principal = FederatedAuthentication.FederationConfiguration.IdentityConfiguration.
                            ClaimsAuthenticationManager.Authenticate(
                                Request.RequestUri.AbsoluteUri, // this, or any other string can be available
                                                                // to your ClaimsAuthenticationManager
                                defaultPrincipal);
                    AuthenticationManager.EstablishSession(principal);
                    return "login ok";
                }
                return "login failed";
            }
        }
开发者ID:tzarger,项目名称:contrib,代码行数:25,代码来源:ValuesController.cs

示例2: GetTreeNodes

 protected override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings)
 {
     TreeNodeCollection nodes = new TreeNodeCollection();
     TreeNode item = this.CreateTreeNode("-1", "-1", queryStrings, "");
     nodes.Add(item);
     return nodes;
 }
开发者ID:scyllagroup,项目名称:UmbracoFlare,代码行数:7,代码来源:UmbracoFlareTreeController.cs

示例3: ReadFromStreamAsync

 public override Task<object> ReadFromStreamAsync(Type type, System.IO.Stream readStream, HttpContent content, System.Net.Http.Formatting.IFormatterLogger formatterLogger)
 {
     var commandType = type;
     if (type.IsAbstract || type.IsInterface)
     {
         var commandContentType = content.Headers.ContentType.Parameters.FirstOrDefault(p => p.Name == "command");
         if (commandContentType != null)
         {
             commandType = GetCommandType(HttpUtility.UrlDecode(commandContentType.Value));
         }
         else
         {
             commandType = GetCommandType(HttpContext.Current.Request.Url.Segments.Last());
         }
     }
     var part = content.ReadAsStringAsync();
     var mediaType = content.Headers.ContentType.MediaType;
     return Task.Factory.StartNew<object>(() =>
     {
         object command = null;
         if (mediaType == "application/x-www-form-urlencoded" || mediaType == "application/command+form")
         {
             command = new FormDataCollection(part.Result).ConvertToObject(commandType);
         }
         if (command == null)
         {
             command = part.Result.ToJsonObject(commandType);
         }
         return command;
     });
 }
开发者ID:codeice,项目名称:IFramework,代码行数:31,代码来源:CommandMediaTypeFormatter.cs

示例4: AddToCalendar

        public IHttpActionResult AddToCalendar(FormDataCollection form)
        {
            string message = "success";

            try
            {
                CylorDbEntities context = this.getContext();
                string ThisDay = form.Get("ThisDay");
                string sSelectUserId = form.Get("sSelectUserId");

                int nCalendarUserListId;
                if (int.TryParse(sSelectUserId, out nCalendarUserListId) && DateFunctions.IsValidDate(ThisDay))
                {
                    CalendarItem instance = new CalendarItem();
                    instance.CalendarDate = DateTime.Parse(ThisDay);
                    instance.CalendarUserListId = nCalendarUserListId;
                    instance.EnteredDate = DateTime.Now.Date;

                    context.CalendarItems.Add(instance);
                    context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                message = ex.Message;
            }

            dynamic json = new ExpandoObject();
            json.message = message;

            return Json(json);
        }
开发者ID:monahan7,项目名称:Cylor,代码行数:32,代码来源:CalendarController.cs

示例5: GetMenuForNode

 /// <summary>
 /// Returns context menu for each tree node
 /// </summary>
 /// <param name="id">Node's id.</param>
 /// <param name="queryStrings">Query strings</param>
 /// <returns>Collection of menu items</returns>
 protected override MenuItemCollection GetMenuForNode(string id, FormDataCollection queryStrings)
 {
     var menu = new MenuItemCollection();
     if (id == Constants.System.Root.ToInvariantString())
     {
         // WebPack node actions:       
         menu.Items.Add<RefreshNode, ActionRefresh>(ui.Text("actions", ActionRefresh.Instance.Alias), true);
         return menu;
     }
     else if(id == "0")
     {
         // Websites node actions:
         MenuItem createItem = new MenuItem("Create", ActionNew.Instance.Alias);
         createItem.Name = "Create";
         createItem.Icon = "add";
         menu.Items.Add(createItem);
         //menu.Items.Add<CreateChildEntity, ActionNew>(ActionNew.Instance.Alias);
         menu.Items.Add<RefreshNode, ActionRefresh>(ui.Text("actions", ActionRefresh.Instance.Alias), true);
         return menu;
     }
     else
     {
         // Website node actions:
         menu.Items.Add<ActionDelete>(ui.Text("actions", ActionDelete.Instance.Alias));                
     }
     return menu;
 }
开发者ID:WebCentrum,项目名称:WebPackUI,代码行数:33,代码来源:WebpackTreeController.cs

示例6: GetTreeNodes

        protected override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings)
        {
            // check if we're rendering the root node's children
            if (id == Constants.System.Root.ToInvariantString())
            {
                var tree = new TreeNodeCollection();
                var ctrl = new EasyADApiController();

                foreach (var g in ctrl.GetAll())
                {
                    var node = CreateTreeNode(
                                    g.Id.ToInvariantString(),
                                    Constants.System.Root.ToInvariantString(),
                                    queryStrings,
                                    g.Name,
                                    "icon-users-alt");
                    tree.Add(node);
                }

                return tree;
            }

            // this tree doesn't support rendering more than 1 level
            throw new NotSupportedException();
        }
开发者ID:ThumNet,项目名称:EasyAD,代码行数:25,代码来源:EasyADTreeController.cs

示例7: Edit

        public string Edit(FormDataCollection form)
        {
            var retVal = string.Empty;
            var operation = form.Get("oper");
            var id = form.Get("Id").Split(',')[0].ToInt32();
            if (string.IsNullOrEmpty(operation)) return retVal;

            PackageFeeEduInfo info;
            switch (operation)
            {
                case "edit":
                    info = CatalogRepository.GetInfo<PackageFeeEduInfo>(id);
                    if (info != null)
                    {
                        info.Name = form.Get("Name");
                        CatalogRepository.Update(info);
                    }
                    break;
                case "add":
                    info = new PackageFeeEduInfo { Name = form.Get("Name") };
                    CatalogRepository.Create(info);
                    break;
                case "del":
                    CatalogRepository.Delete<PackageFeeEduInfo>(id);
                    break;
            }
            StoreData.ReloadData<PackageFeeEduInfo>();
            return retVal;
        }
开发者ID:haoas,项目名称:CRMTPE,代码行数:29,代码来源:PackageFeeEdu.cs

示例8: AddFiles

        private TreeNodeCollection AddFiles(string folder, FormDataCollection queryStrings)
        {
            var pickerApiController = new FileSystemPickerApiController();
            //var str = queryStrings.Get("startfolder");

            if (string.IsNullOrWhiteSpace(folder))
                return null;

            var filter = queryStrings.Get("filter").Split(',').Select(a => a.Trim().EnsureStartsWith(".")).ToArray();

            var path = IOHelper.MapPath(folder);
            var rootPath = IOHelper.MapPath(queryStrings.Get("startfolder"));
            var treeNodeCollection = new TreeNodeCollection();

            foreach (FileInfo file in pickerApiController.GetFiles(folder, filter))
            {
                string nodeTitle = file.Name;
                string filePath = file.FullName.Replace(rootPath, "").Replace("\\", "/");

                //if (file.Extension.ToLower() == ".gif" || file.Extension.ToLower() == ".jpg" || file.Extension.ToLower() == ".png")
                //{
                //    nodeTitle += "<div><img src=\"/umbraco/backoffice/FileSystemPicker/FileSystemThumbnailApi/GetThumbnail?width=150&imagePath="+ HttpUtility.UrlPathEncode(filePath) +"\" /></div>";
                //}

                TreeNode treeNode = CreateTreeNode(filePath, path, queryStrings, nodeTitle, "icon-document", false);
                treeNodeCollection.Add(treeNode);
            }

            return treeNodeCollection;
        }
开发者ID:scyllagroup,项目名称:UmbracoFlare,代码行数:30,代码来源:FolderSystemTreeController.cs

示例9: TryLoadFromLegacyTree

        private Attempt<TreeNodeCollection> TryLoadFromLegacyTree(ApplicationTree appTree, string id, FormDataCollection formCollection)
        {
            //This is how the legacy trees worked....
            var treeDef = TreeDefinitionCollection.Instance.FindTree(appTree.Alias);
            if (treeDef == null)
            {
                return new Attempt<TreeNodeCollection>(new InstanceNotFoundException("Could not find tree of type " + appTree.Alias));
            }

            var bTree = treeDef.CreateInstance();
            var treeParams = new TreeParams();

            //we currently only support an integer id or a string id, we'll refactor how this works
            //later but we'll get this working first
            int startId;
            if (int.TryParse(id, out startId))
            {
                treeParams.StartNodeID = startId;
            }
            else
            {
                treeParams.NodeKey = id;
            }
            var xTree = new XmlTree();
            bTree.SetTreeParameters(treeParams);
            bTree.Render(ref xTree);

            return new Attempt<TreeNodeCollection>(true, LegacyTreeDataAdapter.ConvertFromLegacy(xTree));
        }
开发者ID:jakobloekke,项目名称:Belle,代码行数:29,代码来源:ApplicationTreeApiController.cs

示例10: GetMenuForNode

        protected override MenuItemCollection GetMenuForNode(string id, FormDataCollection queryStrings)
        {
            var menu = new MenuItemCollection();
            menu.DefaultMenuAlias = ActionNull.Instance.Alias;

            return menu;
        }
开发者ID:alanmac,项目名称:uContactor,代码行数:7,代码来源:uContactorController.cs

示例11: GetTreeNodes

        protected override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings)
        {
            if (id == "-1")
            {
                var nodes = new TreeNodeCollection();

                var allContacts = this.CreateTreeNode("dashboard", id, queryStrings, "All Contact Message", "icon-list", false);
                var repliedContacts = this.CreateTreeNode("replied", id, queryStrings, "Replied Contact Message", "icon-check", false);
                var unRepliedContacts = this.CreateTreeNode("unreplied", id, queryStrings, "Un-Replied Contact Message", "icon-time", false);
                var spamContacts = this.CreateTreeNode("spam", id, queryStrings, "Spam", "icon-squiggly-line", false);
                var trashedContacts = this.CreateTreeNode("deleted", id, queryStrings, "Deleted", "icon-trash", false);
                var settingsContacts = this.CreateTreeNode("settings", id, queryStrings, "Settings", "icon-wrench", false);

                repliedContacts.RoutePath = "/uContactor/uContactorSection/replied/0";
                unRepliedContacts.RoutePath = "/uContactor/uContactorSection/unreplied/0";
                spamContacts.RoutePath = "/uContactor/uContactorSection/spam/0";
                trashedContacts.RoutePath = "/uContactor/uContactorSection/deleted/0";
                settingsContacts.RoutePath = "/uContactor/uContactorSection/settings/0";

                nodes.Add(allContacts);
                nodes.Add(repliedContacts);
                nodes.Add(unRepliedContacts);
                nodes.Add(spamContacts);
                nodes.Add(trashedContacts);
                nodes.Add(settingsContacts);

                return nodes;
            }

            throw new NotImplementedException();
        }
开发者ID:alanmac,项目名称:uContactor,代码行数:31,代码来源:uContactorController.cs

示例12: Post

        // POST: api/User
        //public string Post([FromBody]int userid, [FromBody]List<SaleItem> itens)
        public string Post(FormDataCollection Data)
        {
            var ret = string.Empty;

            JavaScriptSerializer ser = new JavaScriptSerializer();
            List<SaleItem> itens = ser.Deserialize<List<SaleItem>>(Data.Get("itens"));

            int IdStore = 0;

            foreach (SaleItem item in itens)
            {
               var  aux = productBusiness.SelectSingle(e => e.Id == item.IdProduct);
                item.Item = null; //
                item.Price = aux.Price;
                IdStore = aux.IdStore;
            }

            Sale vend = new Sale();
            vend.IdUser = Convert.ToInt32(Data.Get("userid"));
            vend.Items = itens;
            vend.IdStore = IdStore;
            vend.Paid = true;
            vend.Delivered = false;
            vend.Ticket = RandomString(20);

            var result = (new SaleValidator()).Validate(vend);
            if (vend != null && result.IsValid)
                saleBusiness.Insert(vend);
            else
                ret = String.Join("<br>", result.Errors);

            return ret;
        }
开发者ID:lucasteles,项目名称:Canteen,代码行数:35,代码来源:SaleController.cs

示例13: ClearDraft

        public string ClearDraft(FormDataCollection form)
        {
            try
            {
                var employeeTypeType = (EmployeeType)form.Get("employeeTypeId").ToInt32();
                ContactRepository.ContactUpdateClearDraft(employeeTypeType);

                // Update Account Draft
                var account = new UserDraftInfo
                {
                    IsDraftConsultant = false,
                    IsDraftCollabortor = false,
                    CreatedDate = DateTime.Now,
                    BranchId = UserContext.GetDefaultBranch(),
                    UserId = UserContext.GetCurrentUser().UserID,
                };
                UserDraftRepository.Update(account);

                // Return
                return "Xóa draft thành công";
            }
            catch
            {
                return "Xóa draft không thành công";
            }
        }
开发者ID:haoas,项目名称:CRMTPE,代码行数:26,代码来源:ContactController.cs

示例14: GetTreeNodes

 protected override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings)
 {
     var nodes = new TreeNodeCollection();
     var item = this.CreateTreeNode("dashboard", id, queryStrings, "Applicaion Forms", "icon-truck", true);
     nodes.Add(item);
     return nodes;
 }
开发者ID:fraygit,项目名称:iRefundWebsite,代码行数:7,代码来源:ApplicationFormSection.cs

示例15: GetRootNode

        public TreeNode GetRootNode(FormDataCollection queryStrings)
        {
            if (queryStrings == null) queryStrings = new FormDataCollection("");
            var node = CreateRootNode(queryStrings);

            //add the tree alias to the root
            node.AdditionalData["treeAlias"] = TreeAlias;

            AddQueryStringsToAdditionalData(node, queryStrings);

            //check if the tree is searchable and add that to the meta data as well
            if (this is ISearchableTree)
            {
                node.AdditionalData.Add("searchable", "true");
            }

            //now update all data based on some of the query strings, like if we are running in dialog mode           
            if (IsDialog(queryStrings))
            {
                node.RoutePath = "#";
            }

            OnRootNodeRendering(this, new TreeNodeRenderingEventArgs(node, queryStrings));

            return node;
        }
开发者ID:phaniarveti,项目名称:Experiments,代码行数:26,代码来源:TreeControllerBase.cs


注:本文中的FormDataCollection类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。