private void AssertPermissionSet(Access expected, PermissionSet permissions) { Assert.Equal(expected, permissions.AccountModify); Assert.Equal(expected, permissions.AccountNegative); Assert.Equal(expected, permissions.AccountSpend); Assert.Equal(expected, permissions.DataModify); }
public Form1() { InitializeComponent(); Access access = new Access(); comboBox1.DataSource = access.getPatientList_All(); comboBox1.DisplayMember = "ふりがな"; comboBox1.ValueMember = "患者NO"; comboBox1.ImeMode = System.Windows.Forms.ImeMode.Hiragana; comboBox1.SelectedIndexChanged += new System.EventHandler(ComboBox_SelectedIndexChanged); comboBox1.Text = string.Empty; comboBox2.DataSource = access.getPatientList_NumberOnly(); comboBox2.DisplayMember = "患者NO"; comboBox2.ValueMember = "患者NO"; comboBox2.ImeMode = System.Windows.Forms.ImeMode.Disable; comboBox2.SelectedIndexChanged += new System.EventHandler(ComboBox_SelectedIndexChanged); comboBox2.Text = string.Empty; dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect; dataGridView1.AllowUserToAddRows = false; dataGridView1.AllowUserToDeleteRows = false; dataGridView1.RowHeadersVisible = false; dataGridView1.VirtualMode = true; }
private static void UpdateUserAccess(User user, string projectName, string applicationName, string cluster, Access access) { user.Access.AddRule(new AccessRules { Project = projectName, Application = applicationName, Cluster = cluster, Access = access }); var hostName = ApplicationConfiguration.Get("pandora_api_url"); var url = hostName + "/api/Users/" + ClaimsPrincipal.Current.Id(); var restClient = new RestSharp.RestClient(url); var editRequest = new RestSharp.RestRequest(); editRequest.Method = RestSharp.Method.PUT; editRequest.RequestFormat = RestSharp.DataFormat.Json; editRequest.AddHeader("Content-Type", "application/json;charset=utf-8"); editRequest.AddHeader("Authorization", "Bearer " + ClaimsPrincipal.Current.IdToken()); editRequest.AddBody(user); var editResult = restClient.Execute(editRequest); }
public Frame(Frame caller) { this.caller = caller; // default visibility is private at toplevel if (caller == null) scope_vmode = Access.Private; }
internal RubyMethod(MethodBody body, int arity, Access access, Class definingClass) { this.body = body; this.arity = arity; this.access = access; this.definingClass = definingClass; }
public static void ParseSymbols(string[] tokens, ref int index, SymbolDecl parent, Access access = Access.Public) { if (parent.Children == null) { parent.Children = new List<SymbolDecl>(); } while (true) { int oldIndex = index; var decls = ParseSymbol(tokens, ref index); if (decls != null) { foreach (var decl in decls) { decl.Access = access; } parent.Children.AddRange(decls); } else if (index == oldIndex) { break; } } }
public Access.DataModels.VoteType InsertVote(Access.DataModels.VoteType voteType) { voteType.Id = null; var dbVoteType = Mapper.Map<Access.DataModels.VoteType, VoteType>(voteType); _dataContext.VoteTypes.InsertOnSubmit(dbVoteType); _dataContext.SubmitChanges(); return Mapper.Map<VoteType, Access.DataModels.VoteType>(dbVoteType); }
public static Room Room(Access.Room from) { if (@from == null) { return null; } var toRoom = new Room(@from.RoomNumber, @from.Location) {Guest = Guest(@from.Guest)}; return toRoom; }
public static Guest Guest(Access.Guest from) { if (@from == null) { return null; } var toGuest = new Guest(@from.FirstName, @from.LastName); return toGuest; }
public static void GiveAccess(string projectName, string applicationName, string cluster, Access access) { var user = GetUser(); UpdateUserAccess(user, projectName, applicationName, cluster, access); UpdateClaimsPrincipal(user.Access); }
private static Access Or(Access left, Access right) { if (left == Access.Deny || right == Access.Deny) return Access.Deny; else if (left == Access.Permit || right == Access.Permit) return Access.Permit; else return Access.Unset; }
/// <summary> /// Update UserInfo model for Scheduler /// </summary> /// <param name="data"></param> /// <returns></returns> public static async Task<List<BookingViewModel>> UpdateAccountInfoFoScheduler(this List<BookingViewModel> data, Access.AccessContext identityContext) { var usersIds = data.Select(u => u.UserId).Distinct() .Select(u => u.ToString()).ToList(); // userinfo var dat = await (from user in identityContext.Users.Where(u => usersIds.Contains(u.Id)) join claim in identityContext.UserClaims on user.Id equals claim.UserId into df from defaultClaim in df.DefaultIfEmpty() select new { user = user, claim = defaultClaim }).ToListAsync(); // user summary var users = dat.GroupBy(u => u.user.Id) .Select(g => new UserInfo() { Id = g.FirstOrDefault().user.Id, Name = g.Select(c => c.claim).HasName() ? g.Select(c => c.claim).FinUserName() : g.FirstOrDefault().user.UserName, Phone = g.FirstOrDefault().user.PhoneNumber, Email = g.FirstOrDefault().user.Email, }).ToList(); foreach (var item in data) { item.UserInfo = users.FirstOrDefault(u => u.Id == item.UserId) ?? new UserInfo(); item.Start = item.Start;// DateTime.SpecifyKind(item.Start, DateTimeKind.Utc); item.End = item.End; //DateTime.SpecifyKind(item.End, DateTimeKind.Utc); if (item.UserInfo != null && !string.IsNullOrEmpty(item.UserInfo.Name)) { item.Title += " " + item.UserInfo.Name + " " + item.UserInfo.Email; } //if (item.Userid == Guid.Empty) item.Userid = Guid.NewGuid(); } return data.ToList(); //return data.Select(d=> //{ // var book = new BookingViewModel(); // book.CopyFrom(d); // book.Title = d.UserInfo.Name +"_ " ; // book.Description = "Reserva de Cancha"; // return book; //}).ToList(); }
/// <summary> /// Creates a SharedLink to associate with a File or folder /// </summary> /// <param name="access">With whom the item should be shared</param> /// <param name="unsharedAt">Automatically stop sharing at this time</param> /// <param name="permissions">The </param> public SharedLink(Access access, DateTime? unsharedAt = null, Permissions permissions = null) : this() { Access = access; Permissions = permissions ?? new Permissions() {CanDownload = true, CanPreview = true}; if (unsharedAt.HasValue) { UnsharedAt = unsharedAt.Value; } }
public PermissionSet( Access accountNegative = Access.Unset, Access accountSpend = Access.Unset, Access accountModify = Access.Unset, Access dataModify = Access.Unset) { this.AccountNegative = accountNegative; this.AccountSpend = accountSpend; this.AccountModify = accountModify; this.DataModify = dataModify; }
public ActionResult Create(Access.DataModels.Post post) { try { //post.ClosedDate = DateTime.Now; post.CommentCount = 0; //post.CommunityOwnedDate = DateTime.Now; post.CreationDate = DateTime.Now; post.FavoriteCount = 0; //post.IsAnonymous = false; post.LastActivityDate = DateTime.Now; post.LastEditDate = DateTime.Now; Users u = _userDataAccess.GetUserInfo(Session["id"].ToString()); post.LastEditorDisplayname = u.DisplayName; post.LastEditorUserId = u.Id; post.OwnerDisplayName = u.DisplayName; post.OwnerUserId = u.Id; post.Score = 0; //post.Tags = "No Tags"; //post.Title = "No Title"; post.ViewCount = 0; var newPost = _postDataAccess.InsertPost(post); if (post.IsAnonymous==true) { return Json(new { Status = "ANONYMOUS_SUCCESS", Result = "" }); } return Json(new { Status = "SUCCESS", Result = Json(newPost) }); } catch (Exception) { return Json(new { Status = "FAILED", Result = "" }); } }
public static IDBAccess Create(DBType type) { IDBAccess IRet = null; switch (type) { case DBType.Access: IRet = new Access(type); break; case DBType.SQL: IRet = new SQL(type); break; default: break; } return IRet; }
public Access.DataModels.VoteType UpdateVote(Access.DataModels.VoteType voteType) { var dbVoteTypes = from v in _dataContext.VoteTypes where v.Id == voteType.Id select v; if (dbVoteTypes.Count() > 1) { throw new UniqueVoteTypeViolationXception("there exist more than one vote type with this post id"); } else if (!dbVoteTypes.Any()) throw new InvalidVoteTypeIdXception("no post exists with given vote type id for update"); else { if (voteType.Name != null) dbVoteTypes.ToArray()[0].Name = voteType.Name; _dataContext.SubmitChanges(); return Mapper.Map<VoteType, Access.DataModels.VoteType>(dbVoteTypes.ToArray()[0]); } }
public FieldTreeNode(FieldInfo definition, Access mAccess, bool Constant) : base(TreeNodeType.Field) { this.def = definition; acc = mAccess; sconst = Constant; this.Text = definition.Name; if (!Constant) { switch (acc) { case Access.Public: this.SelectedImageIndex = Constants.Field_Public; this.ImageIndex = Constants.Field_Public; break; case Access.Private: this.SelectedImageIndex = Constants.Field_Private; this.ImageIndex = Constants.Field_Private; break; case Access.Protected: this.SelectedImageIndex = Constants.Field_Protected; this.ImageIndex = Constants.Field_Protected; break; case Access.Internal: this.SelectedImageIndex = Constants.Field_Internal; this.ImageIndex = Constants.Field_Internal; break; } #if DebugTreeNodeLoading Log.WriteLine("Field '" + this.Text + "' was loaded."); #endif } else { this.SelectedImageIndex = Constants.ConstantIcon; this.ImageIndex = Constants.ConstantIcon; #if DebugTreeNodeLoading Log.WriteLine("Constant '" + this.Text + "' was loaded."); #endif } }
void SetAccess(string login) { switch (login) { case "administrator": UserAccess = Access.Администратор; break; case "book": UserAccess = Access.Бухгалтер; break; case "seller": UserAccess = Access.Продавец; break; case "printer": UserAccess = Access.Принтер; break; default: break; } }
public EvaluatePositions22(Map map) { this.map = map; this.maxLenPath = Math.Min(Math.Min(map.Width, map.Height)/3, 6); for (int y = 0; y < map.Height; ++y) { var emptyCellsInLine = new List<Cell>(); for (int x = 0; x < map.Width; ++x) { var cell = map[x, y]; if (!cell.filled) { emptyCellsInLine.Add(map[x, y]); freeInputsForCells[map[x, y]] = CountFreeInputs(map[x, y]); accessablityOfCell[cell] = new Access() { E = FindFreeLinearPath(cell, MoveType.E), W = FindFreeLinearPath(cell, MoveType.W), NE = FindFreeLinearPath(cell, MoveType.NE), NW = FindFreeLinearPath(cell, MoveType.NW) }; } } emptyCellsInLines.Add(emptyCellsInLine); int countLockedInLine = emptyCellsInLine.Count(c => freeInputsForCells[c] == 0); countLockedCellsInLines.Add(countLockedInLine); int countBadAccessedInLine = emptyCellsInLine.Count(c => accessablityOfCell[c].Accessability().Max() < maxLenPath); foreach (var c in emptyCellsInLine) { usabilityOfCells[c] = 0.1 + 1.0/emptyCellsInLine.Count - ((double)countLockedInLine) / map.Width; } } for (int y = 0; y < map.Height/3; ++y) for (int x = map.Width / 3; x <= map.Width * 3 / 4; ++x) usabilityOfCells[new Cell() { x = x, y = y }] = -map.Height/4 /(1.0 + Math.Min(y, x)); }
public Access.DataModels.Comment InsertComment(Access.DataModels.Comment comment) { comment.Id = null; var dbPost = Mapper.Map<Access.DataModels.Comment, Post>(comment); _dataContext.Posts.InsertOnSubmit(dbPost); _dataContext.SubmitChanges(); return Mapper.Map<Post, Access.DataModels.Comment>(dbPost); //if (comment.Body == "") //{ // throw new InvalidPostBodyXception("the comment body does not contain any text"); //} //else //{ // DataAccess.Post dbComment = new DataAccess.Post // { // Body = comment.Body, // }; // _dataContext.Posts.InsertOnSubmit(dbComment); // _dataContext.SubmitChanges(); // return Mapper.Map<DSH.DataAccess.Post, DSH.Access.DataModels.Comment>(dbComment); //} }
public ActionResult Index() { //info o prihlaseni Access access = new Access(); access.User = "******"; access.Password = "******"; //od ktereho data int Day = 1; int Month = 5; int Year = 2013; DateTime date = new DateTime(Year, Month, Day); AuthorizationServiceSoapClient client = new AuthorizationServiceSoapClient(); AuthorizedPersonData result = client.GetAuthorizations(access, date); ViewData["Persons"] = result.AuthorizedPersons; ViewData["Day"] = Day; ViewData["Month"] = Month; ViewData["Year"] = Year; return View(); }
public Type(Scopes.Scope scope, Access access, string name, object defaultValue) : this(scope, name, defaultValue) { Access = access; }
public static async Task <bool> IsGodownExistsAsync(string godown) { SqlParameter[] parameters = { new SqlParameter("@godown", godown) }; return(await Access.GetBooleanAsync("SELECT [dbo].[IsGodownExists](@godown)", parameters)); }
private void button2_Click(object sender, EventArgs e) { Access.UpdataOneCheck(TestMsg, Access.HaveCheck); UpOneMsgCheck(TestMsg, Access.HaveCheck); }
public async Task <IActionResult> OnGetAsync() { var username = HttpContext.Session.GetString("_username"); var usertype = HttpContext.Session.GetString("_usertype"); var access = new Access(username, "Student"); if (access.IsLogin()) { if (access.IsAuthorize(usertype)) { Student = await _context.Student .Where(s => s.DateDeleted == null) .FirstOrDefaultAsync(s => s.AssignedId == username); SubmissionType = await _context.SubmissionType .Where(s => s.DateDeleted == null) .Where(s => s.BatchId == Student.BatchId) .Where(s => s.StartDate <= DateTime.Now) .Where(s => s.GraceDate >= DateTime.Now) .FirstOrDefaultAsync(); // check if submitted HasSubmit = false; if (Student.ProjectId != null) { Project = await _context.Project .Where(p => p.DateDeleted == null) .FirstOrDefaultAsync(p => p.ProjectId == Student.ProjectId); Submissions = await _context.Submission .Where(s => s.DateDeleted == null) .Where(w => w.ProjectId == Project.ProjectId) .Include(w => w.Project) .ToListAsync(); if (Submissions.Count() > 0 && SubmissionType != null) { foreach (var submission in Submissions) { if (submission.SubmissionTypeId == SubmissionType.SubmissionTypeId) { HasSubmit = true; break; } } } } return(Page()); } else { ErrorMessage = "Access Denied"; return(RedirectToPage($"/{usertype}/Index")); } } else { ErrorMessage = "Login Required"; return(RedirectToPage("/Account/Login")); } }
private void btnImport_Click(object sender, EventArgs e) { try { int id = Access.SearchCurrentMonthData(new DateTime(dp.Value.Year, dp.Value.Month, 1)); if (id == -1) { Access.AddInSaveMonth(Properties.Settings.Default.id, new DateTime(dp.Value.Year, dp.Value.Month, 1)); foreach (DataGridViewRow row in dg.Rows) { foreach (DataGridViewCell cell in row.Cells) { if (cell.Value == null) { cell.Value = ""; } if (cell.OwningColumn.HeaderText == "Class" && (cell.Value == null || String.IsNullOrEmpty(cell.Value.ToString()))) { cell.Value = "XXX"; } } } for (int i = 0; i < dg.Rows.Count; i++) { Access.AddInDataBaseFile(Properties.Settings.Default.id, dg.Rows[i].Cells[0].Value.ToString(), dg.Rows[i].Cells[1].Value.ToString(), dg.Rows[i].Cells[2].Value.ToString(), dg.Rows[i].Cells[3].Value.ToString(), dg.Rows[i].Cells[4].Value.ToString(), dg.Rows[i].Cells[5].Value.ToString(), dg.Rows[i].Cells[6].Value.ToString(), dg.Rows[i].Cells[7].Value.ToString(), dg.Rows[i].Cells[8].Value.ToString(), dg.Rows[i].Cells[9].Value.ToString(), dg.Rows[i].Cells[10].Value.ToString(), dg.Rows[i].Cells[11].Value.ToString(), "Helloo"); } Access.GetNextId(); } else { bool IsDuplicate = Access.IdExistsInDatabaseFile(id); if (IsDuplicate) { if (MessageBox.Show("Database file already exists. Do you want to replace it?", Application.ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == System.Windows.Forms.DialogResult.Yes) { Access.DeletePreviousDatabaseRecord(id); foreach (DataGridViewRow row in dg.Rows) { foreach (DataGridViewCell cell in row.Cells) { if (cell.Value == null) { cell.Value = ""; } if (cell.OwningColumn.HeaderText == "Class" && (cell.Value == null || String.IsNullOrEmpty(cell.Value.ToString()))) { cell.Value = "XXX"; } } } for (int i = 0; i < dg.Rows.Count; i++) { Access.AddInDataBaseFile(id, dg.Rows[i].Cells[0].Value.ToString(), dg.Rows[i].Cells[1].Value.ToString(), dg.Rows[i].Cells[2].Value.ToString(), dg.Rows[i].Cells[3].Value.ToString(), dg.Rows[i].Cells[4].Value.ToString(), dg.Rows[i].Cells[5].Value.ToString(), dg.Rows[i].Cells[6].Value.ToString(), dg.Rows[i].Cells[7].Value.ToString(), dg.Rows[i].Cells[8].Value.ToString(), dg.Rows[i].Cells[9].Value.ToString(), dg.Rows[i].Cells[10].Value.ToString(), dg.Rows[i].Cells[11].Value.ToString(), "Helloo"); } } } else { foreach (DataGridViewRow row in dg.Rows) { foreach (DataGridViewCell cell in row.Cells) { if (cell.Value == null) { cell.Value = ""; } if (cell.OwningColumn.HeaderText == "Class" && (cell.Value == null || String.IsNullOrEmpty(cell.Value.ToString()))) { cell.Value = "XXX"; } } } for (int i = 0; i < dg.Rows.Count; i++) { Access.AddInDataBaseFile(id, dg.Rows[i].Cells[0].Value.ToString(), dg.Rows[i].Cells[1].Value.ToString(), dg.Rows[i].Cells[2].Value.ToString(), dg.Rows[i].Cells[3].Value.ToString(), dg.Rows[i].Cells[4].Value.ToString(), dg.Rows[i].Cells[5].Value.ToString(), dg.Rows[i].Cells[6].Value.ToString(), dg.Rows[i].Cells[7].Value.ToString(), dg.Rows[i].Cells[8].Value.ToString(), dg.Rows[i].Cells[9].Value.ToString(), dg.Rows[i].Cells[10].Value.ToString(), dg.Rows[i].Cells[11].Value.ToString(), "Helloo"); } } } Manager.Show("Import successfull", Notification.Type.Success); Properties.Settings.Default.DatabaseLastUpdated = DateTime.Now; Properties.Settings.Default.Save(); } catch (Exception ex) { Manager.Show("Import failed", Notification.Type.Error); if (MessageBox.Show("Couldn't import data from excel files due to:\n" + ex.Message, Application.ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.Yes) { btnImport_Click(sender, e); } } }
static SymbolDecl[] ParseSymbol(string[] tokens, ref int index) { while (index < tokens.Length && tokens[index].Length >= 3 && tokens[index].StartsWith("///")) { index++; } if (Parser.Token(tokens, ref index, "public") || Parser.Token(tokens, ref index, "protected") || Parser.Token(tokens, ref index, "private")) { index--; return(null); } TemplateDecl templateDecl = null; if (Parser.Token(tokens, ref index, "template")) { templateDecl = new TemplateDecl { TypeParameters = new List <string>(), Specialization = new List <TypeDecl>(), }; Parser.EnsureToken(tokens, ref index, "<"); if (!Parser.Token(tokens, ref index, ">")) { while (true) { string token = null; Parser.SkipUntilInTemplate(tokens, ref index, out token, ",", ">", "="); index -= 2; templateDecl.TypeParameters.Add(Parser.EnsureId(tokens, ref index)); index++; if (token == "=") { Parser.SkipUntilInTemplate(tokens, ref index, out token, ",", ">"); } if (token == ">") { break; } } } } if (Parser.Token(tokens, ref index, "friend")) { int oldIndex = index - 1; string token = null; Parser.SkipUntil(tokens, ref index, out token, ";", "{"); if (token == ";") { return(null); } else { index = oldIndex; tokens[index] = "static"; } } if (Parser.Token(tokens, ref index, "namespace")) { if (templateDecl != null) { throw new ArgumentException("Failed to parse."); } var decl = new NamespaceDecl(); decl.Name = Parser.EnsureId(tokens, ref index); Parser.EnsureToken(tokens, ref index, "{"); ParseSymbols(tokens, ref index, decl); Parser.EnsureToken(tokens, ref index, "}"); return(new SymbolDecl[] { decl }); } else if (Parser.Token(tokens, ref index, "using")) { if (Parser.Token(tokens, ref index, "namespace")) { if (templateDecl != null) { throw new ArgumentException("Failed to parse."); } var decl = new UsingNamespaceDecl(); decl.Path = new List <string>(); decl.Path.Add(Parser.EnsureId(tokens, ref index)); while (!Parser.Token(tokens, ref index, ";")) { Parser.EnsureToken(tokens, ref index, ":"); Parser.EnsureToken(tokens, ref index, ":"); decl.Path.Add(Parser.EnsureId(tokens, ref index)); } return(new SymbolDecl[] { decl }); } else { string name = null; if (Parser.Id(tokens, ref index, out name)) { if (templateDecl != null) { if (Parser.Token(tokens, ref index, "<")) { while (true) { templateDecl.Specialization.Add(TypeDecl.EnsureTypeWithoutName(tokens, ref index)); if (Parser.Token(tokens, ref index, ">")) { break; } Parser.EnsureToken(tokens, ref index, ","); } } } if (Parser.Token(tokens, ref index, "=")) { SymbolDecl decl = new TypedefDecl { Name = name, Type = TypeDecl.EnsureTypeWithoutName(tokens, ref index), }; Parser.EnsureToken(tokens, ref index, ";"); if (templateDecl != null) { templateDecl.Element = decl; decl = templateDecl; } return(new SymbolDecl[] { decl }); } } if (templateDecl != null) { throw new ArgumentException("Failed to parse."); } Parser.SkipUntil(tokens, ref index, ";"); } } else if (Parser.Token(tokens, ref index, "typedef")) { if (templateDecl != null) { throw new ArgumentException("Failed to parse."); } string name = null; var type = TypeDecl.EnsureTypeWithName(tokens, ref index, out name); Parser.EnsureToken(tokens, ref index, ";"); var decl = new TypedefDecl(); decl.Name = name; decl.Type = type; return(new SymbolDecl[] { decl }); } else if (Parser.Token(tokens, ref index, "enum")) { if (templateDecl != null) { throw new ArgumentException("Failed to parse."); } Parser.Token(tokens, ref index, "class"); string name = Parser.EnsureId(tokens, ref index); if (Parser.Token(tokens, ref index, ":")) { TypeDecl.EnsureTypeWithoutName(tokens, ref index); } if (!Parser.Token(tokens, ref index, ";")) { Parser.EnsureToken(tokens, ref index, "{"); var decl = new EnumDecl { Name = name, Children = new List <SymbolDecl>(), }; while (true) { if (Parser.Token(tokens, ref index, "}")) { break; } while (index < tokens.Length && tokens[index].Length >= 3 && tokens[index].StartsWith("///")) { index++; } decl.Children.Add(new EnumItemDecl { Name = Parser.EnsureId(tokens, ref index), }); string token = null; Parser.SkipUntil(tokens, ref index, out token, ",", "}"); if (token == "}") { break; } } if (Parser.Id(tokens, ref index, out name)) { var varDecl = new VarDecl { Static = false, Name = name, Type = new RefTypeDecl { Name = decl.Name, }, }; Parser.EnsureToken(tokens, ref index, ";"); return(new SymbolDecl[] { decl, varDecl }); } else { Parser.EnsureToken(tokens, ref index, ";"); return(new SymbolDecl[] { decl }); } } } else if (Parser.Token(tokens, ref index, "struct") || Parser.Token(tokens, ref index, "class") || Parser.Token(tokens, ref index, "union")) { if (Parser.Token(tokens, ref index, "{")) { if (tokens[index - 2] == "class") { throw new ArgumentException("Failed to parse."); } var decl = new GroupedFieldDecl { Grouping = tokens[index - 2] == "struct" ? Grouping.Struct : Grouping.Union, }; ParseSymbols(tokens, ref index, decl); Parser.EnsureToken(tokens, ref index, "}"); Parser.EnsureToken(tokens, ref index, ";"); return(new SymbolDecl[] { decl }); } else { string name = Parser.EnsureId(tokens, ref index); if (!Parser.Token(tokens, ref index, ";")) { var classDecl = new ClassDecl { ClassType = tokens[index - 2] == "struct" ? ClassType.Struct : tokens[index - 2] == "class" ? ClassType.Class : ClassType.Union, BaseTypes = new List <BaseTypeDecl>(), Name = name, }; if (templateDecl != null) { if (Parser.Token(tokens, ref index, "<")) { if (!Parser.Token(tokens, ref index, ">")) { while (true) { int oldIndex = index; try { templateDecl.Specialization.Add(TypeDecl.EnsureTypeWithoutName(tokens, ref index)); } catch (ArgumentException) { index = oldIndex; Parser.SkipUntilInTemplate(tokens, ref index, ",", ">"); index--; templateDecl.Specialization.Add(new ConstantTypeDecl { Value = tokens .Skip(oldIndex) .Take(index - oldIndex) .Aggregate((a, b) => a + " " + b), }); } if (Parser.Token(tokens, ref index, ">")) { break; } Parser.EnsureToken(tokens, ref index, ","); } } } } Parser.Token(tokens, ref index, "abstract"); if (Parser.Token(tokens, ref index, ":")) { while (true) { Access access = classDecl.ClassType == ClassType.Class ? Access.Private : Access.Public; Parser.Token(tokens, ref index, "virtual"); if (Parser.Token(tokens, ref index, "private")) { access = Access.Private; } else if (Parser.Token(tokens, ref index, "protected")) { access = Access.Protected; } else if (Parser.Token(tokens, ref index, "public")) { access = Access.Public; } Parser.Token(tokens, ref index, "virtual"); classDecl.BaseTypes.Add(new BaseTypeDecl { Access = access, Type = TypeDecl.EnsureTypeWithoutName(tokens, ref index), }); if (!Parser.Token(tokens, ref index, ",")) { break; } } } Parser.EnsureToken(tokens, ref index, "{"); while (true) { if (Parser.Token(tokens, ref index, "}")) { break; } Access access = classDecl.ClassType == ClassType.Class ? Access.Private : Access.Public; if (Parser.Token(tokens, ref index, "private")) { access = Access.Private; Parser.EnsureToken(tokens, ref index, ":"); } else if (Parser.Token(tokens, ref index, "protected")) { access = Access.Protected; Parser.EnsureToken(tokens, ref index, ":"); } else if (Parser.Token(tokens, ref index, "public")) { access = Access.Public; Parser.EnsureToken(tokens, ref index, ":"); } ParseSymbols(tokens, ref index, classDecl, access); } SymbolDecl decl = classDecl; if (templateDecl != null) { templateDecl.Element = decl; decl = templateDecl; } if (Parser.Id(tokens, ref index, out name)) { var varDecl = new VarDecl { Static = false, Name = name, Type = new RefTypeDecl { Name = classDecl.Name, }, }; Parser.EnsureToken(tokens, ref index, ";"); return(new SymbolDecl[] { decl, varDecl }); } else { Parser.EnsureToken(tokens, ref index, ";"); return(new SymbolDecl[] { decl }); } } } } else if (!Parser.Token(tokens, ref index, ";")) { Function function = Function.Function; { int oldIndex = index; string name = null; if (Parser.Id(tokens, ref index, out name)) { if (Parser.Token(tokens, ref index, "(")) { Parser.SkipUntil(tokens, ref index, ")"); if (Parser.Token(tokens, ref index, ";") || Parser.Token(tokens, ref index, "=") || Parser.Token(tokens, ref index, ":") || Parser.Token(tokens, ref index, "{")) { function = Function.Constructor; } } index = oldIndex; } else if (Parser.Token(tokens, ref index, "~")) { function = Function.Destructor; } } if (function == Function.Function) { Virtual virtualFunction = Virtual.Normal; Parser.Token(tokens, ref index, "extern"); Parser.Token(tokens, ref index, "mutable"); if (Parser.Token(tokens, ref index, "virtual")) { virtualFunction = Virtual.Virtual; } else if (Parser.Token(tokens, ref index, "static")) { virtualFunction = Virtual.Static; } Parser.Token(tokens, ref index, "inline"); Parser.Token(tokens, ref index, "__forceinline"); if (Parser.Token(tokens, ref index, "operator")) { TypeDecl returnType = null; { int oldIndex = index; Parser.SkipUntilInTemplate(tokens, ref index, "("); int modify = --index; tokens[modify] = "$"; index = oldIndex; returnType = TypeDecl.EnsureTypeWithoutName(tokens, ref index); if (index != modify) { throw new ArgumentException("Failed to parse."); } tokens[modify] = "("; } var decl = new FuncDecl { Virtual = global::Parser.Virtual.Normal, Name = "operator", Function = function, }; TypeDecl functionType = null; Action <TypeDecl> continuation = null; CallingConvention callingConvention = CallingConvention.Default; TypeDecl.ParseTypeContinueAfterName(tokens, ref index, ref callingConvention, out functionType, out continuation); continuation(returnType); decl.Type = functionType; if (!Parser.Token(tokens, ref index, ";")) { Parser.EnsureToken(tokens, ref index, "{"); Parser.SkipUntil(tokens, ref index, "}"); } if (templateDecl != null) { templateDecl.Element = decl; return(new SymbolDecl[] { templateDecl }); } else { return(new SymbolDecl[] { decl }); } } else { string name = null; TypeDecl type = null; if (TypeDecl.ParseType(tokens, ref index, out type, out name)) { if (name == null) { throw new ArgumentException("Failed to parse."); } if (type is FunctionTypeDecl) { if (Parser.Token(tokens, ref index, "=")) { if (Parser.Token(tokens, ref index, "0")) { virtualFunction = Virtual.Abstract; } else { Parser.EnsureToken(tokens, ref index, "default", "delete"); } } var decl = new FuncDecl { Virtual = virtualFunction, Name = name, Type = type, Function = Function.Function, }; if (!Parser.Token(tokens, ref index, ";")) { Parser.EnsureToken(tokens, ref index, "{"); Parser.SkipUntil(tokens, ref index, "}"); } if (templateDecl != null) { templateDecl.Element = decl; return(new SymbolDecl[] { templateDecl }); } else { return(new SymbolDecl[] { decl }); } } else { if (virtualFunction != Virtual.Normal && virtualFunction != Virtual.Static) { throw new ArgumentException("Failed to parse."); } if (Parser.Token(tokens, ref index, "=")) { Parser.SkipUntil(tokens, ref index, ";"); } else { Parser.EnsureToken(tokens, ref index, ";"); } var decl = new VarDecl { Static = virtualFunction == Virtual.Static, Name = name, Type = type, }; return(new SymbolDecl[] { decl }); } } } } else { var decl = new FuncDecl { Virtual = global::Parser.Virtual.Normal, Name = (function == Function.Constructor ? "" : "~") + Parser.EnsureId(tokens, ref index), Function = function, }; TypeDecl functionType = null; Action <TypeDecl> continuation = null; CallingConvention callingConvention = CallingConvention.Default; TypeDecl.ParseTypeContinueAfterName(tokens, ref index, ref callingConvention, out functionType, out continuation); continuation(new RefTypeDecl { Name = "void" }); decl.Type = functionType; if (Parser.Token(tokens, ref index, "=")) { Parser.EnsureToken(tokens, ref index, "default", "delete"); } if (!Parser.Token(tokens, ref index, ";")) { if (Parser.Token(tokens, ref index, ":")) { Parser.SkipUntil(tokens, ref index, "{"); } else { Parser.EnsureToken(tokens, ref index, "{"); } Parser.SkipUntil(tokens, ref index, "}"); } return(new SymbolDecl[] { decl }); } } return(null); }
public static void ParseSymbols(string[] tokens, ref int index, SymbolDecl parent, Access access = Access.Public) { if (parent.Children == null) { parent.Children = new List <SymbolDecl>(); } while (true) { int oldIndex = index; var decls = ParseSymbol(tokens, ref index); if (decls != null) { foreach (var decl in decls) { decl.Access = access; } parent.Children.AddRange(decls); } else if (index == oldIndex) { break; } } }
public MultipartUploadService(Access access) { _access = access; }
public IActionResult OnPost() { if (!ModelState.IsValid) { throw new Exception("Antiforgery check failed."); } InitPage(); if (App == null) { return(NotFound()); } var appServ = new AppService(); try { appServ.UpdateApplication(App.Id, Name, Label, Description, IconClass, Author, Color, Weight, Access.Select(x => Guid.Parse(x)).ToList()); if (!String.IsNullOrWhiteSpace(ReturnUrl)) { return(Redirect(ReturnUrl)); } else { return(Redirect($"/sdk/objects/application/r/{App.Id}/")); } } catch (ValidationException ex) { Validation.Message = ex.Message; Validation.Errors = ex.Errors; } ErpRequestContext.PageContext = PageContext; BeforeRender(); return(Page()); }
public MatchesActivity() { Access = new Access(); }
/// <summary> /// 读取数据参数回调 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ShowEPC(object sender, Command.ShowEPCEventArgs e) { try { string[] result = e.CommandRespond.Split(','); byte type = Convert.ToByte(result[1], 16); switch (type) { //读取标签 case Types.READ_TAGS_RESPOND: if (result[2] == "1" && result[3] == "000000000000000000000000") { string resultEPC = ReaderControllor.WriteTags(ReaderControllor.GetClientInfo()[0], "", 0x00, "", 0, 0, 4, txtKillPassword.Text + txtEPCpassWord.Text); RFIDWriteState.Operate = RFIDWriteState.WritePassword; } else if (result[2] == "1" && result[3] != "000000000000000000000000") { //检测二维码标签是否与RFID标签相同 if (result[3] == ComReciveData[0]) { //发送给PLC Access.UpdataOneCheck(result[3], Access.Havewrite); this.Invoke(UpDataTableWrite, new object[] { txtWriteData.Text, Access.Havewrite }); //发送写标成功信号,500毫秒的低电平,PLC电平触发任务 Sleep(500, 2); } else { Access.UpdataOneCheck(txtWriteData.Text, Access.FailCheck); this.Invoke(UpDataTableCheck, new object[] { result[3], Access.FailCheck }); } } //标签损坏 else if (result[2] != "1") { Access.UpdataOneWirte(txtWriteData.Text, Access.WriteFail); this.Invoke(UpDataTableWrite, new object[] { txtWriteData.Text, Access.WriteFail }); } break; //写标签 case Types.WRITE_TAGS_RESPOND: if (result[2] == "1" && RFIDWriteState.Operate == RFIDWriteState.WritePassword) { AsyncSocketState WorkingReader = ReaderControllor.GetClientInfo()[0]; //判断数据长度是否为24位,若不是24位自动补够24位 String Writedata = txtWriteData.Text; if (txtWriteData.Text.Length < 24) { Writedata = Writedata.PadRight(24, '0'); } string resultRPC = ReaderControllor.WriteTags(ReaderControllor.GetClientInfo()[0], "", 0x00, "", 1, 2, 6, Writedata); RFIDWriteState.Operate = RFIDWriteState.WriteEPC; } else if (result[2] == "1" && RFIDWriteState.Operate == RFIDWriteState.WriteEPC) { string resultEPCLock = ReaderControllor.LockTags(ReaderControllor.GetClientInfo()[0], txtEPCpassWord.Text, 254, "", new byte[] { 3, 192, 160 }); RFIDWriteState.Operate = RFIDWriteState.LockTags; } break; //锁标签 case Types.LOCK_TAGS_RESPOND: //锁RFID标签成功 if (result[2] == "1" && RFIDWriteState.Operate == RFIDWriteState.LockTags) { //跟新数据状态 Access.UpdataOneWirte(txtWriteData.Text, Access.Havewrite); this.Invoke(UpDataTableWrite, new object[] { txtWriteData.Text, Access.Havewrite }); //发送写标成功信号,500毫秒的低电平,PLC电平触发任务 Sleep(500, 1); //给激光喷码机发送数据 MarkingPort.Write(txtWriteData.Text); } break; } } catch (Exception ex) { Console.Write(ex.Message); } }
/// <summary> /// Удаление группы. /// </summary> /// <returns></returns> public ActionResult Delete(int id) { Access.CheckAccess("Team.Deleter"); _teamService.Delete(id); return(RedirectToAction("Index")); }
public ShipmentsManager() { _globalConfig = Repositorio.Read(); _connectionAccess = new Access(); Log.Process = "ShipmentsManager"; }
protected AccessControlledElement() { Access = Access.Public; Attributes = new List<Attribute>(); }
public User(string name, string level, AccessControl userAccessControl) { UserName = name; Level = level; AccessControl = userAccessControl.Access; }
public AccessRights GetAccessRights(ValueType objectType, ObjectInfoFlags flags) { AccessRights rights = new AccessRights(); Access[] access = rights.Access = new Access[17]; // these aliases should make the code more readable // for the magazine edition (we don't get much width!) AccessFlags G = AccessFlags.General; AccessFlags S = AccessFlags.Specific; // summary page permissions access[0] = new Access(SERVICE_ALL, "Full Control", G | S); access[1] = new Access(SERVICE_READ, "Read", G); access[2] = new Access(SERVICE_WRITE, "Write", G); access[3] = new Access(SERVICE_EXECUTE, "Execute", G); // advanced page permissions access[4] = new Access(0x0001, "Query Configuration", S); access[5] = new Access(0x0002, "Change Configuration", S); access[6] = new Access(0x0004, "Query Status", S); access[7] = new Access(0x0008, "Enumerate Dependents", S); access[8] = new Access(0x0010, "Start", S); access[9] = new Access(0x0020, "Stop", S); access[10] = new Access(0x0040, "Pause or Continue", S); access[11] = new Access(0x0080, "Interrogate", S); access[12] = new Access(0x0100, "Send User Defined Control", S); access[13] = new Access(0x00010000, "Delete", S); access[14] = new Access(0x00020000, "Read Permissions", S); access[15] = new Access(0x00040000, "Change Permissions", S); access[16] = new Access(0x00080000, "Take Ownership", S); // note how I refer to access[1] as the default ("Read") rights.DefaultIndex = 1; return rights; }
internal static RouteFilterRuleData DeserializeRouteFilterRuleData(JsonElement element) { Optional <string> name = default; Optional <string> location = default; Optional <string> etag = default; ResourceIdentifier id = default; Optional <Access> access = default; Optional <RouteFilterRuleType> routeFilterRuleType = default; Optional <IList <string> > communities = default; Optional <ProvisioningState> provisioningState = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name")) { name = property.Value.GetString(); continue; } if (property.NameEquals("location")) { location = property.Value.GetString(); continue; } if (property.NameEquals("etag")) { etag = property.Value.GetString(); continue; } if (property.NameEquals("id")) { id = property.Value.GetString(); continue; } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } foreach (var property0 in property.Value.EnumerateObject()) { if (property0.NameEquals("access")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } access = new Access(property0.Value.GetString()); continue; } if (property0.NameEquals("routeFilterRuleType")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } routeFilterRuleType = new RouteFilterRuleType(property0.Value.GetString()); continue; } if (property0.NameEquals("communities")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } List <string> array = new List <string>(); foreach (var item in property0.Value.EnumerateArray()) { array.Add(item.GetString()); } communities = array; continue; } if (property0.NameEquals("provisioningState")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } provisioningState = new ProvisioningState(property0.Value.GetString()); continue; } } continue; } } return(new RouteFilterRuleData(id, name.Value, location.Value, etag.Value, Optional.ToNullable(access), Optional.ToNullable(routeFilterRuleType), Optional.ToList(communities), Optional.ToNullable(provisioningState))); }
public static async Task <string[]> GetGodownsByItemAsync(string itemName) { SqlParameter[] parameters = { new SqlParameter("@item", itemName) }; return(await Access.GetStringArrayAsync("SELECT * FROM [dbo].[GetGodownsByItem](@item)", parameters)); }
public override bool doAccess(Access ac) { Access[] acs = new Access[1]; acs[0] = ac; return(doAccess(acs, 1)); }
public static async Task <DataTable> GetInventoryDetailsAsync() { return(await Access.GetDataTableAsync("SELECT * FROM [dbo].[GetLast30InventoryInTransactions]()")); }
public static async Task <AutoCompleteStringCollection> GetItemNames() { return(await Access.GetAutoCompleteStringCollectionAsync("SELECT * FROM [dbo].[GetItemNames]()")); }
public void Access_NewInstance_DefaultActiveIsFalse() { var access = new Access(); Assert.IsFalse(access.Active); }
private void button1_Click(object sender, EventArgs e) { TestMsg = txtWriteData.Text; Access.UpdataOneWirte(txtWriteData.Text, Access.Havewrite); UpOneMsgWrite(txtWriteData.Text, Access.Havewrite); }
public LoopVariableEntry(Access access, Types.Type type) : base(access, type) { }
public static async Task <string[]> GetGodownsAsync() { return(await Access.GetStringArrayAsync("SELECT * FROM [dbo].[GetGodowns]()")); }
public Type(Scopes.Scope scope, Access access, string name) : this(scope, access, name, null) { }
public static async Task <DataTable> GetLast30InventoryCheckoutsAsync() { return(await Access.GetDataTableAsync("SELECT * FROM [dbo].[GetLast30InventoryCheckouts]()")); }
public ActionResult Update(TeamItem team) { Access.CheckAccess("Team.Updater"); _teamService.Update(team); return(RedirectToAction("Index", new { id = team.Id })); }
public void Access_InternalAndExternal_ActiveIsTrue() { var access = new Access { ExternalAccess = true, InternalAccess = true }; Assert.IsTrue(access.Active); }
/// <summary> /// Creates a new object. /// </summary> public Options() { Access = new Access(); }
public VariableEntry(Access access, Types.Type type) { Access = access; Type = type; }
public Rule(IPAddress network, Access type) { this.Network = network; this.Type = type; }
/// <summary> /// Список групп. /// </summary> /// <returns></returns> public ActionResult List() { Access.CheckAccess("Team.Reader"); return(View("List", _teamService.GetList().OrderBy(x => x.Name).ToList())); }
public GroupACL(Access otherAccess, Access memberAccess) { Other = otherAccess; Member = memberAccess; }
public AccessAttribute(Access access) { Access = access; }
public ActionResult Create(TeamItem team) { Access.CheckAccess("Team.Creator"); return(RedirectToAction("Index", new { id = _teamService.Create(team) })); }
public AccessList(Access head, AccessList tail) { Head = head; Tail = tail; }
/// <summary> /// Интерфейс для создания группы. /// </summary> /// <returns></returns> public ActionResult New() { Access.CheckAccess("Team.Creator"); return(View()); }