private void btnAddAction_Click(object sender, EventArgs e) { using (ActionForm af = new ActionForm()) { af.plug = plug; af.wmp = wmp; af.tts = tts; af.trvTrigger.ImageList = imgs; af.trvTrigger.Nodes.Add((TreeNode)trv.Nodes[0].Clone()); CloseTree(af.trvTrigger.Nodes[0]); af.trvFolder.ImageList = imgs; af.trvFolder.Nodes.Add((TreeNode)trv.Nodes[0].Clone()); RemoveTriggerNodesFromTree(af.trvFolder.Nodes[0]); CloseTree(af.trvFolder.Nodes[0]); af.SettingsFromAction(null); if (panel5.Visible == true) { af.SetReadOnly(); } af.Text = I18n.Translate("internal/TriggerForm/addnewaction", "Add new action"); af.btnOk.Text = I18n.Translate("internal/TriggerForm/add", "Add"); if (af.ShowDialog() == DialogResult.OK) { Action a = new Action(); af.SettingsToAction(a); a._Enabled = true; Actions.Add(a); a.OrderNumber = Actions.Count; dgvActions.RowCount = Actions.Count; dgvActions.ClearSelection(); dgvActions.Rows[dgvActions.RowCount - 1].Selected = true; } } }
private void loginButton_Click(object sender, EventArgs e) { string username = usernameTextBox.Text.Trim(); string password = passwordTextBox.Text.Trim(); //checking username if (username == "") { MessageBox.Show("Vui lòng nhập tên đăng nhập", "Thông Báo"); usernameTextBox.Focus(); return; } //checking password if (password == "") { MessageBox.Show("Vui lòng nhập Mật khẩu", "Thông Báo"); passwordTextBox.Focus(); return; } AccountModel accountModel = new AccountModel(); if (!accountModel.CheckUserExists(username, password)) { MessageBox.Show("Sai thông tin tài khoản", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } //checking username and password empty ActionForm actionForm = new ActionForm(); actionForm.ShowDialog(); }
private void btnEditAction_Click(object sender, EventArgs e) { Context ctx = new Context(); ctx.plug = plug; ctx.trig = fakectx.trig; using (ActionForm af = new ActionForm()) { Action a = Actions[dgvActions.SelectedRows[0].Index]; af.plug = plug; af.wmp = wmp; af.trvTrigger.ImageList = imgs; af.trvTrigger.Nodes.Add((TreeNode)trv.Nodes[0].Clone()); CloseTree(af.trvTrigger.Nodes[0]); af.trvFolder.ImageList = imgs; af.trvFolder.Nodes.Add((TreeNode)trv.Nodes[0].Clone()); RemoveTriggerNodesFromTree(af.trvFolder.Nodes[0]); CloseTree(af.trvFolder.Nodes[0]); af.SettingsFromAction(a); if (panel5.Visible == true) { af.SetReadOnly(); } af.tts = tts; af.Text = I18n.Translate("internal/TriggerForm/editaction", "Edit action '{0}'", a.GetDescription(ctx)); af.btnOk.Text = I18n.Translate("internal/TriggerForm/savechanges", "Save changes"); if (af.ShowDialog() == DialogResult.OK) { af.SettingsToAction(a); dgvActions.Refresh(); } } }
private ActionForm CreateForm(Entity entity, EntityAction action) { var form = new ActionForm(); form.Text = action.Title ?? action.Name?.ChangeCase(TextCase.PascalCase) ?? "Edição"; form.SubmitButton.Text = action.Title ?? "OK"; form.SubmitButton.Click += async(o, e) => await SubmitAsync(); form.ExitButton.Click += async(o, e) => await CancelAsync(); form.FormClosing += async(o, e) => { if (!complete) { e.Cancel = false; return; } var ret = await CancelAsync(); e.Cancel = !ret.Ok; }; var hasSelection = (Selection?.Any() == true); foreach (var field in action.Fields) { IFieldWidget widget; var hasSelfProvider = (field.Provider?.Rel.Has(RelNames.Self) == true); if (hasSelfProvider && hasSelection) { var selectedItems = Selection.Select(x => x.Properties); widget = new SelectRecordFieldWidget { ReadOnly = true }; widget.Window = Window; widget.Entity = entity; widget.Field = field; widget.Value = selectedItems; } else { var fieldType = (field.Type ?? FieldTypeNames.Text).Replace("__", ""); var prefix = fieldType.ChangeCase(TextCase.PascalCase); var typeName = $"Paper.Browser.Windows.Gui.Widgets.{prefix}FieldWidget"; var type = Type.GetType(typeName) ?? typeof(TextFieldWidget); widget = (IFieldWidget)Activator.CreateInstance(type); widget.Window = Window; widget.Entity = entity; widget.Field = field; } form.WidgetGrid.Controls.Add(widget.Host); } return(form); }
private void passwordTextBox_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { ActionForm actionForm = new ActionForm(); actionForm.ShowDialog(); this.Close(); } }
/// <summary> /// This method executes the insert operation after the insertion position has been set /// </summary> public void Do() { //If the operation is not precanceled and the mouse is within the workspace (when the temporary layer is visible) if ((!this.opPrecanceled) && (this.tempLayer.Visible)) { //It is checked if the position is valid for insertion if (this.ValidateLocation()) { //It checks if the action needs Inicilización if (this.graphElement.NeedInit) { ActionForm actionForm = ActionFactory.GetActionForm(this.graphElement.Element); if (DialogResult.OK != actionForm.ShowDialog()) { this.Cancel(); return; } } //The GraphElement is added to the diagram layer, and to the logical diagram this.diagramLayer.AddElement(this.graphElement); this.diagram.AddElement(this.graphElement.Element); //The temporary layer is cleaned and hidden this.tempLayer.ClearAndHide(); //The diagram layer is updated this.diagramLayer.UpdateSurface(); //It is indicated that the diagram has changed if (this.DiagramChanged != null) { this.DiagramChanged(this, new EventArgs()); } //The operation is terminated if (this.OperationFinished != null) { this.OperationFinished(this, new OperationEventArgs(Operation.Insert)); } } else { //If the position is invalid, it is precanceled to show notice to the user this.PreCancel(); if (GraphSettings.Default.InsertWarning == true) { bool showAgain = true; MowayMessageBox.Show(InsertElementMessages.DRAG_OBJECT, InsertElementMessages.INSERT_ELEMENT, MessageBoxButtons.OK, MessageBoxIcon.Error, ref showAgain); GraphSettings.Default.InsertWarning = showAgain; GraphSettings.Default.Save(); } this.Cancel(); } } else { this.Cancel(); } }
private void BtnAction_Click(object sender, EventArgs e) { if (Action.Equals("Reply")) { ActionForm.Reply(Sender.Text, _ID); } else if (Action.Equals("Draft") || Action.Equals("Forward")) { ActionForm.Draft(Recipient.Text, Subject.Text, Body.Text); } ActionForm.Visible = true; }
public frmAddRecipe(ActionForm actionForm, string idDiagnosticRepository, int recipeId, string protocolId, string serviceId, string categoryName, string LineId) { InitializeComponent(); _recipeId = recipeId; _idDiagnosticRepository = idDiagnosticRepository; _pobjOperationResult = new OperationResult(); _objRecetaBl = new RecetaBl(); _actionForm = actionForm; _protocolId = protocolId; Text = actionForm == ActionForm.Add ? "Agregar Nueva Receta" : "Editar Receta"; _serviceId = serviceId; _categoryName = categoryName; _LineId = LineId; }
public async Task <IActionResult> SendAction([FromBody] ActionForm action) { if (!ModelState.IsValid) { return(HttpResponseHelper.BadRequest(ModelState)); } var actionMatch = await _context.Actions.Where(a => a.Verb.Equals(action.Verb)).FirstOrDefaultAsync(); if (actionMatch == null) { return(HttpResponseHelper.NotFound("Invalid action verb.")); } Reward reward = null; var goals = await _context.Goals.Include(g => g.Actions) //.Where(g => g.Actions.Any(a => a.Verb.Equals(action.Verb))) .Include(g => g.Rewards.Select(r => r.AttributeType)) .ToListAsync(); foreach (var goal in goals) { reward = await goal.CalculateRewardFromAction(_context, action.Verb); if (reward != null) { break; } } var error = await SaveChangesAsync(); if (error != null) { return(error); } return(Ok(reward)); }
public void Tab_Control_Add(DataTable Access, MainProgram mainProgram, Action action, SummaryDetails summaryDetails, Admin admin, Data_Import ImportData) { Person = Access.Rows[0]; Users User = Users.Singleton(); // // Tab_Action // if (User.ActionTab) { TabPage tab_Action = new TabPage(); mainProgram.TabControl.Controls.Add(tab_Action); tab_Action.Location = new System.Drawing.Point(4, 22); tab_Action.Name = "tab_Action"; tab_Action.Padding = new Padding(3); tab_Action.Size = new System.Drawing.Size(1826, 877); tab_Action.TabIndex = 0; tab_Action.Text = "Action"; tab_Action.UseVisualStyleBackColor = true; //Tab_Action_Comp(); _ = new ActionForm(action); action.Action_NoChangeInAction(); } // // tab_SummaryDetail // if (User.SummaryTab) { TabPage tab_SummaryDetail = new TabPage { Location = new System.Drawing.Point(4, 22), Name = "tab_Summary", Size = new System.Drawing.Size(1826, 877), TabIndex = 1, Text = "Summary Detail", UseVisualStyleBackColor = true }; mainProgram.TabControl.Controls.Add(tab_SummaryDetail); TabPage tab_Summary = new TabPage { Location = new System.Drawing.Point(4, 22), Name = "tab_SummaryS", Size = new System.Drawing.Size(1826, 877), TabIndex = 2, Text = "Summary", UseVisualStyleBackColor = true }; mainProgram.TabControl.Controls.Add(tab_Summary); _ = new SummaryDetailsForm(Person, summaryDetails); } // // Tab Statistic- dane statystyczne // if (User.StatisticTab) { _ = new StatisticTabGenerator(); } // // Tab Platform Savings - dane statystyczne // if (User.PlatformTab) { _ = new PlatformTabGenerator(); } // // tab_STK // if (User.STKTab) { TabPage tab_STK = new TabPage { Location = new System.Drawing.Point(4, 22), Name = "tab_STK", Size = new System.Drawing.Size(1826, 877), TabIndex = 5, Text = "STK3", UseVisualStyleBackColor = true }; mainProgram.TabControl.Controls.Add(tab_STK); Tab_STK_Comp(); } // // tab_Quantity // if (User.QuantityTab) { TabPage tab_Quantity = new TabPage { Location = new System.Drawing.Point(4, 22), Name = "tab_Quantity", Size = new System.Drawing.Size(1826, 877), TabIndex = 6, Text = "Quantity", UseVisualStyleBackColor = true }; mainProgram.TabControl.Controls.Add(tab_Quantity); Tab_Quantity_Comp(); } // // tab_Admin // if (User.AdminTab) { TabPage tab_Admin = new TabPage { Location = new System.Drawing.Point(4, 22), Name = "tab_Admin", Size = new System.Drawing.Size(1826, 877), TabIndex = 7, Text = "Administration ", UseVisualStyleBackColor = true }; mainProgram.TabControl.Controls.Add(tab_Admin); _ = new AdminForm(mainProgram, action, admin, ImportData); TabPage tab_AdminAction = new TabPage { Location = new System.Drawing.Point(4, 22), Name = "tab_AdminAction", Size = new System.Drawing.Size(1826, 877), TabIndex = 8, Text = "Action Admin", UseVisualStyleBackColor = true, }; mainProgram.TabControl.Controls.Add(tab_AdminAction); _ = new ModifiActionForm(tab_AdminAction); } }