public ProductsPresenter(Products view) { productDAO = new productDAO(); cached = new List<Product>(); this.view = view; this.state = FormState.UPDATE_OLD; }
public AddOrEditClassForm(DBManager dbManag) { InitializeComponent(); mDBManager = dbManag; this.Text = FormTitles.ClassForm.Add; mFormState = FormState.AddingNew; RadListDataItem dropDownItem = new RadListDataItem("1"); dropDownItem.Value = 1; dropDownItem.Selected = true; gradeDropdownlist.Items.Add(dropDownItem); for (int i = 2; i <= 12; ++i) { dropDownItem = new RadListDataItem(i.ToString()); dropDownItem.Value = i; gradeDropdownlist.Items.Add(dropDownItem); } importTeachersFromTheDatabase(); changingHeadteacherReadyButton.Visible = false; teachersDropdownlist.Visible = false; changeHeadTeacherButton.Visible = false; changingHeadteacherReadyButton.Visible = true; teachersDropdownlist.Visible = true; colorPanel.BackColor = RandomColor.GetRandomColor(); gradeDropdownlist.DropDownStyle = RadDropDownStyle.DropDownList; teachersDropdownlist.DropDownStyle = RadDropDownStyle.DropDownList; }
/// <summary> /// Constructor /// </summary> /// <param name="memoDetail">MemoDetail, memo to be displayed in form</param> /// <param name="formState">FormState, describing the current form state</param> public MemoDetailForm(MemoDetail memoDetail, FormState formState) : this() { this.MemoDetail = memoDetail; this.originalMemoXML = TestController.SerializeXML(memoDetail, false); this.SetFormState(formState); switch (formState) { case FormState.NewMemo: { this.ctrlMemoDetail.CurrentMemostate = MemoDetailControl.MemoState.NewMemo; break; } case FormState.ViewMemo: { this.ctrlMemoDetail.CurrentMemostate = MemoDetailControl.MemoState.ViewMemo; break; } case FormState.EditMemo: { this.ctrlMemoDetail.CurrentMemostate = MemoDetailControl.MemoState.EditMemo; break; } } }
public OptionsForm(FormState state) { // // Required for Windows Form Designer support // InitializeComponent(); // // TODO: Add any constructor code after InitializeComponent call // State = state; ShowParticipant(); if (State == FormState.create) { EnableOK(this, null); } if (Conference.VenueServiceWrapper.VenueService.PrivacyPolicyUrl() != null) { linkPrivacyPolicy.Visible = true; linkPrivacyPolicy.Links.Add(0, 14, Conference.VenueServiceWrapper.VenueService.PrivacyPolicyUrl()); } }
public TaskEditor(MainDataContexts dataContexts,FormState state=FormState.FormView,Guid? workId=null) { InitializeComponent(); _dataContexts = dataContexts; _state = state; _workId = workId.HasValue ? workId.Value : Guid.Empty; }
public void FormUpdate(FormState state) { Clients.Client(Context.ConnectionId).formUpdated(state); if(state == FormState.Done) { GetJobsData(); } }
public EditPerson(MainDataContexts dataContexts,FormState state) { InitializeComponent(); _dataContexts = dataContexts; _state = state; if (state != FormState.New) throw new Exception("Invalid use of edit form [EditPerson]"); }
public void SetStateForm(FormState state) { if (state == FormState.inicial) { gvwDatos.Enabled = true; txtIdItemITE.ReadOnly = true; txtDescripcionITE.ReadOnly = true; txtDescripcionWebITE.ReadOnly = true; chkActivoWebITE.Enabled = false; btnBuscar.Enabled = true; btnNuevo.Enabled = true; btnEditar.Enabled = true; btnBorrar.Enabled = true; btnGrabar.Enabled = false; btnCancelar.Enabled = false; btnSalir.Enabled = true; DelEventosValidacion(); insertando = false; editando = false; txtParametros.Focus(); } if (state == FormState.insercion) { gvwDatos.Enabled = false; txtDescripcionITE.ReadOnly = false; txtDescripcionWebITE.ReadOnly = false; txtDescripcionWebITE.Clear(); chkActivoWebITE.Enabled = true; txtDescripcionITE.Clear(); txtDescripcionITE.Focus(); btnBuscar.Enabled = false; btnNuevo.Enabled = false; btnEditar.Enabled = false; btnBorrar.Enabled = false; btnGrabar.Enabled = false; btnCancelar.Enabled = true; btnSalir.Enabled = false; AddEventosValidacion(); insertando = true; } if (state == FormState.edicion) { gvwDatos.Enabled = false; txtDescripcionITE.ReadOnly = false; txtDescripcionWebITE.ReadOnly = false; chkActivoWebITE.Enabled = true; txtDescripcionITE.Focus(); btnBuscar.Enabled = false; btnNuevo.Enabled = false; btnEditar.Enabled = false; btnBorrar.Enabled = false; btnGrabar.Enabled = false; btnCancelar.Enabled = true; btnSalir.Enabled = false; AddEventosValidacion(); editando = true; } }
public EditPerson(MainDataContexts dataContexts, FormState state,Guid editId) { InitializeComponent(); _dataContexts = dataContexts; if (state!=FormState.Edit) throw new Exception("Invalid use of edit form [EditPerson]"); _state = state; _editId = editId; }
public void loadProducts() { cached = productDAO.getList(); view.ClearFields(); view.displayProducts(cached); state = FormState.UPDATE_OLD; }
public void SetStateForm(FormState state) { if (state == FormState.inicial) { gvwDatos.Enabled = true; txtIdMovETIP.ReadOnly = true; txtIdMovETIP.BackColor = System.Drawing.SystemColors.ActiveCaptionText; txtDescripcionETIP.ReadOnly = true; txtDescripcionETIP.BackColor = System.Drawing.SystemColors.ActiveCaptionText; chkRemuneracionETIP.Enabled = false; if (tblEmpleadosMovTipos.Rows.Count == 0) { btnEditar.Enabled = false; btnBorrar.Enabled = false; } else { btnEditar.Enabled = true; btnBorrar.Enabled = true; } btnNuevo.Enabled = true; btnGrabar.Enabled = false; btnCancelar.Enabled = false; btnSalir.Enabled = true; DelEventosValidacion(); } if (state == FormState.insercion) { gvwDatos.Enabled = false; txtDescripcionETIP.ReadOnly = false; chkRemuneracionETIP.Enabled = true; chkRemuneracionETIP.CheckState = CheckState.Unchecked; txtDescripcionETIP.Clear(); txtDescripcionETIP.Focus(); btnNuevo.Enabled = false; btnEditar.Enabled = false; btnBorrar.Enabled = false; btnGrabar.Enabled = false; btnCancelar.Enabled = true; btnSalir.Enabled = false; AddEventosValidacion(); } if (state == FormState.edicion) { gvwDatos.Enabled = false; txtDescripcionETIP.ReadOnly = false; chkRemuneracionETIP.Enabled = true; txtDescripcionETIP.Focus(); btnNuevo.Enabled = false; btnEditar.Enabled = false; btnBorrar.Enabled = false; btnGrabar.Enabled = false; btnCancelar.Enabled = true; btnSalir.Enabled = false; AddEventosValidacion(); } }
public void SetState(FormState state) { this.cameraImage = state.Bitmap; this._path = state.Path; Image old = this.cameraView.Image; this.cameraView.Image = state.Bitmap; if (state.Path.Count > 0 || state.RightSide.HasValue || state.LeftSide.HasValue) { Graphics g = Graphics.FromImage(cameraImage); if (state.Path.Count > 0) { Point? last = null; for (int i = 0; i < state.Path.Count; i++) { var p = state.Path[state.Path.Count - i - 1]; if (last != null) { g.DrawLine(_pen, last.Value, p); } if (i == state.Path.Count - 1) { g.FillEllipse(_ptFirstBrush, p.X - 10, p.Y - 10, 20, 20); } else { g.FillEllipse(_ptBrush, p.X - 10, p.Y - 10, 20, 20); } last = p; } } if (state.RightSide.HasValue) { g.FillEllipse(_rightBrush, state.RightSide.Value.X - 10, state.RightSide.Value.Y - 10, 20, 20); } if (state.LeftSide.HasValue) { g.FillEllipse(_leftBrush, state.LeftSide.Value.X - 10, state.LeftSide.Value.Y - 10, 20, 20); } } frames++; TimeSpan ts = DateTime.Now - _lastSecond; if (ts.TotalMilliseconds >= 1000) { fpsLabel.Text = string.Format("FPS: {0}", frames); _lastSecond = DateTime.Now; frames = 0; } // Dispose of the old bitmap to save memory // (It will be garbage collected eventually, but this is faster) if (old != null) { old.Dispose(); } }
public AddOrEditLessonForm(DBManager aDBManager) { InitializeComponent(); mFormState = FormState.AddingNew; mDBManager = aDBManager; this.Text = FormTitles.LessonForm.Add; addDefaultControlsInformationWhenAddingNew(); }
public Form1() { InitializeComponent(); SetupForm(); SetupHotKey(); var formState = new FormState(this, "KhebbieKeys"); SetupKeys(); SetupTimer(); }
public AddOrEditTeacherForm(DBManager aDBManager) { InitializeComponent(); mDBManager = aDBManager; mFormState = FormState.AddingNew; this.Text = FormTitles.TacherForm.Add; radioButtonFemale.IsChecked = true; groupboxColorPanelColor.BackColor = RandomColor.GetRandomColor(); }
/// <summary> /// Configure form /// </summary> /// <param name="formState">FormState, state to configure form</param> public void SetFormState(FormState formState) { switch (formState) { case FormState.NewFee: this.btnSave.Visible = true; this.btnSave.Enabled = true; break; case FormState.ViewFee: this.btnSave.Visible = false; this.btnSave.Enabled = false; break; } }
public AddOrEditSubjectForm(DBManager aDBManager) { InitializeComponent(); mDBManager = aDBManager; mFormState = FormState.AddingNew; this.Text = FormTitles.SubjectForm.Add; barComplexity.Maximum = 3; barComplexity.Minimum = 1; barComplexity.TickFrequency = 1; groupboxColorPanelColor.BackColor = RandomColor.GetRandomColor(); }
/// <summary> /// Constructor /// </summary> /// <param name="nameDetail"></param> /// <param name="formState"></param> public DocumentInfoNamesForm(NameDetail nameDetail, FormState formState) : this() { this.NameDetail = nameDetail; this.SetFormState(formState); switch (formState) { case FormState.NewName: this.ctrlNameDetail.SetControlState(NameDetailControl.ControlState.NewName); break; case FormState.ViewName: this.ctrlNameDetail.SetControlState(NameDetailControl.ControlState.ViewName); break; } }
/// <summary> /// Constructor /// </summary> /// <param name="feeDetail"></param> /// <param name="formState"></param> public DocumentInfoFeesForm(FeeDetail feeDetail, FormState formState) : this() { this.FeeDetail = feeDetail; this.SetFormState(formState); switch (formState) { case FormState.NewFee: this.ctrlFeeDetail.SetControlState(FeeDetailControl.ControlState.NewFee); break; case FormState.ViewFee: this.ctrlFeeDetail.SetControlState(FeeDetailControl.ControlState.ViewFee); break; } }
private async void DoLogin() { if (_currentState == FormState.LoggedOut) { _currentState = FormState.LoggingIn; } else { _currentState = FormState.LoggedOut; _username = ""; _password = ""; PasswordVaultWrapper.Clear(); } NotifyStateChange(); if (_currentState == FormState.LoggingIn) { _errorMessage = ""; bool didSucceed = false; try { didSucceed = await _dataService.LoginAsync(_username, _password); if (!didSucceed) { _errorMessage = (string)Application.Current.Resources["Error_AuthFailed"]; _password = ""; } } catch (RedditApiException) { _errorMessage = (string)Application.Current.Resources["Error_ConnFailed"]; } if (didSucceed) { PasswordVaultWrapper.Store(_username, _password); _currentState = FormState.LoggedIn; } else { _currentState = FormState.LoggedOut; } NotifyStateChange(); } }
public void SetStateForm(FormState state) { if (state == FormState.inicial) { gvwDatos.Enabled = true; txtPorcentajeALI.ReadOnly = true; txtPorcentajeALI.BackColor = System.Drawing.SystemColors.ActiveCaptionText; btnNuevo.Enabled = true; btnEditar.Enabled = true; btnBorrar.Enabled = true; btnGrabar.Enabled = false; btnCancelar.Enabled = false; btnSalir.Enabled = true; DelEventosValidacion(); gvwDatos.Focus(); } if (state == FormState.insercion) { gvwDatos.Enabled = false; txtIdAlicuotaALI.ReadOnly = false; txtPorcentajeALI.ReadOnly = false; txtPorcentajeALI.Clear(); txtIdAlicuotaALI.Focus(); btnNuevo.Enabled = false; btnEditar.Enabled = false; btnBorrar.Enabled = false; btnGrabar.Enabled = false; btnCancelar.Enabled = true; btnSalir.Enabled = false; AddEventosValidacion(); } if (state == FormState.edicion) { gvwDatos.Enabled = false; txtIdAlicuotaALI.ReadOnly = false; txtPorcentajeALI.ReadOnly = false; txtIdAlicuotaALI.Focus(); btnNuevo.Enabled = false; btnEditar.Enabled = false; btnBorrar.Enabled = false; btnGrabar.Enabled = false; btnCancelar.Enabled = true; btnSalir.Enabled = false; AddEventosValidacion(); } }
public AddOrEditClassroomForm(DBManager dbManage, long aID) { InitializeComponent(); mDBManager = dbManage; mID = aID; this.Text = FormTitles.ClassroomForm.Edit; mFormState = FormState.Editing; var room = from r in mDBManager.Classrooms where r.ID == aID select r; mClassroom = room.FirstOrDefault(); nameTextbox.Text = mClassroom.Name; shortNameTextbox.Text = mClassroom.ShortName; if (mClassroom.Color != Color.Empty) { panelClassroomColor.BackColor = mClassroom.Color; } else { panelClassroomColor.BackColor = RandomColor.GetRandomColor(); } isHomeClassroomCheckbox.Checked = mClassroom.IsHomeClassroom; this.mHomeClassID = mClassroom.HomeClassID; isSpecializedRoomCheckbox.Checked = mClassroom.IsSpecialisated; specialisatedSubjectsIDs = mClassroom.SpecialisatedSubjectsIDs; if (isSpecializedRoomCheckbox.Checked == true) { chooseSubjectsToBeTaughtInThisRoomButton.Visible = true; } else { chooseSubjectsToBeTaughtInThisRoomButton.Visible = false; } if (isHomeClassroomCheckbox.Checked == true) { chooseHeadclassOfThisClassroom.Visible = true; } else { chooseHeadclassOfThisClassroom.Visible = false; } }
public void filterWith(String part) { state = FormState.UPDATE_OLD; part = part.ToLower(); List<Product> result = new List<Product>(); foreach (Product p in cached) { if (p.description.ToLower().Contains(part)) { result.Add(p); } } view.ClearFields(); view.displayProducts(result); }
public AddOrEditClassroomForm(DBManager dbManage) { InitializeComponent(); mDBManager = dbManage; this.Text = FormTitles.ClassroomForm.Add; mFormState = FormState.AddingNew; chooseHeadclassOfThisClassroom.Visible = false; chooseSubjectsToBeTaughtInThisRoomButton.Visible = false; isSpecializedRoomCheckbox.Checked = false; isHomeClassroomCheckbox.Checked = false; panelClassroomColor.BackColor = RandomColor.GetRandomColor(); }
public AddOrEditSubjectForm(DBManager aDBManager, long aID) { InitializeComponent(); mDBManager = aDBManager; mID = aID; mFormState = FormState.Editing; this.Text = FormTitles.SubjectForm.Edit; foreach (var subject in mDBManager.Subjects) { if (subject.ID == aID) { mSubject = subject; break; } } textboxName.Text = mSubject.Name; textboxShortName.Text = mSubject.ShortName; if (mSubject.Color != Color.Empty) { groupboxColorPanelColor.BackColor = mSubject.Color; } else { groupboxColorPanelColor.BackColor = RandomColor.GetRandomColor(); } switch (mSubject.Difficulty) { case RelativeSubjectDifficulty.Low: barComplexity.Value = 1; break; case RelativeSubjectDifficulty.Normal: barComplexity.Value = 2; break; case RelativeSubjectDifficulty.High: barComplexity.Value = 3; break; } barComplexity.Maximum = 3; barComplexity.Minimum = 1; barComplexity.TickFrequency = 1; }
public void SetStateForm(FormState state) { if (state == FormState.inicial) { gvwDatos.Enabled = true; txtIdCondicionIvaCIVA.ReadOnly = true; txtDescripcionCIVA.ReadOnly = true; btnNuevo.Enabled = true; btnEditar.Enabled = true; btnBorrar.Enabled = true; btnGrabar.Enabled = false; btnCancelar.Enabled = false; btnSalir.Enabled = true; DelEventosValidacion(); gvwDatos.Focus(); } if (state == FormState.insercion) { gvwDatos.Enabled = false; txtDescripcionCIVA.ReadOnly = false; txtDescripcionCIVA.Clear(); txtDescripcionCIVA.Focus(); btnNuevo.Enabled = false; btnEditar.Enabled = false; btnBorrar.Enabled = false; btnGrabar.Enabled = false; btnCancelar.Enabled = true; btnSalir.Enabled = false; AddEventosValidacion(); } if (state == FormState.edicion) { gvwDatos.Enabled = false; txtDescripcionCIVA.ReadOnly = false; txtDescripcionCIVA.Focus(); btnNuevo.Enabled = false; btnEditar.Enabled = false; btnBorrar.Enabled = false; btnGrabar.Enabled = false; btnCancelar.Enabled = true; btnSalir.Enabled = false; AddEventosValidacion(); } }
public void SetStateForm(FormState state) { if (state == FormState.inicial) { gvwDatos.Enabled = true; txtDescripcionART.ReadOnly = true; txtDescripcionART.BackColor = System.Drawing.SystemColors.ActiveCaptionText; btnBuscar.Enabled = true; btnNuevo.Enabled = true; btnEditar.Enabled = true; btnBorrar.Enabled = true; btnGrabar.Enabled = false; btnCancelar.Enabled = false; btnSalir.Enabled = true; txtParametros.Focus(); } if (state == FormState.insercion) { gvwDatos.Enabled = false; txtDescripcionART.ReadOnly = false; txtDescripcionART.Clear(); txtDescripcionART.Focus(); btnBuscar.Enabled = false; btnNuevo.Enabled = false; btnEditar.Enabled = false; btnBorrar.Enabled = false; btnGrabar.Enabled = false; btnCancelar.Enabled = true; btnSalir.Enabled = false; } if (state == FormState.edicion) { gvwDatos.Enabled = false; txtDescripcionART.ReadOnly = false; txtDescripcionART.Focus(); btnBuscar.Enabled = false; btnNuevo.Enabled = false; btnEditar.Enabled = false; btnBorrar.Enabled = false; btnGrabar.Enabled = false; btnCancelar.Enabled = true; btnSalir.Enabled = false; } }
private void formStateUpdate(FormState state) { switch (state) { case FormState.Wait: getButton.Text = "获取"; progressPanel.Visible = false; typeCheckedListBox.Enabled = true; quickSelect.Enabled = true; break; case FormState.Running: getButton.Text = "取消"; typeCheckedListBox.Enabled = false; progressPanel.Visible = true; quickSelect.Enabled = false; break; } }
public SettingsViewModel(IRedditApi dataService) { _dataService = dataService; if (PasswordVaultWrapper.IsStored()) { _currentState = FormState.LoggedIn; _username = PasswordVaultWrapper.GetUsername(); _password = PasswordVaultWrapper.GetPassword(); } else { _currentState = FormState.LoggedOut; _username = ""; _password = ""; } Login = new RelayCommand(DoLogin, () => { return _currentState != FormState.LoggingIn; }); }
public void SetStateForm(FormState state) { if (state == FormState.inicial) { txtIdRazonSocialRAZ.ReadOnly = true; txtRazonSocialRAZ.ReadOnly = true; txtPuntoVentaRAZ.ReadOnly = true; txtNombreFantasiaRAZ.ReadOnly = true; txtDomicilioRAZ.ReadOnly = true; txtLocalidadRAZ.ReadOnly = true; txtProvinciaRAZ.ReadOnly = true; cmbIdCondicionIvaRAZ.Enabled = false; txtCuitRAZ.ReadOnly = true; txtIngresosBrutosRAZ.ReadOnly = true; txtInicioActividadRAZ.ReadOnly = true; txtCorreoRAZ.ReadOnly = true; cmbIdCondicionIvaRAZ.BackColor = System.Drawing.SystemColors.ActiveCaptionText; btnEditar.Enabled = true; btnGrabar.Enabled = false; btnCancelar.Enabled = false; btnSalir.Enabled = true; } if (state == FormState.edicion) { txtRazonSocialRAZ.ReadOnly = false; txtNombreFantasiaRAZ.ReadOnly = false; txtPuntoVentaRAZ.ReadOnly = false; txtDomicilioRAZ.ReadOnly = false; txtLocalidadRAZ.ReadOnly = false; txtProvinciaRAZ.ReadOnly = false; cmbIdCondicionIvaRAZ.Enabled = true; txtCuitRAZ.ReadOnly = false; txtIngresosBrutosRAZ.ReadOnly = false; txtInicioActividadRAZ.ReadOnly = false; txtCorreoRAZ.ReadOnly = false; btnEditar.Enabled = false; btnGrabar.Enabled = false; btnCancelar.Enabled = true; btnSalir.Enabled = false; txtRazonSocialRAZ.Focus(); } }
void ControlTreeDataLoader.LoadData() { FormState.ExecuteWithDataModificationsAndDefaultAction( dataModifications, () => { var modifiedCaption = caption; // Display the caption and the sub caption. if (defaultDataRowLimit != DataRowLimit.Unlimited) { var formattedDataRowCount = dataRowCount.ToString("N0"); if (caption.Length > 0) { modifiedCaption += " (" + formattedDataRowCount + ")"; } else { modifiedCaption = formattedDataRowCount + " items"; } } if (modifiedCaption.Length > 0) { captionTable.Visible = true; captionStack.AddControls(new Label { Text = modifiedCaption, CssClass = "ewfCaption" }); } if (subCaption.Length > 0) { captionTable.Visible = true; captionStack.AddText(subCaption); } // Row limiting if (defaultDataRowLimit != DataRowLimit.Unlimited) { captionStack.AddControls( new ControlLine( new LiteralControl("Show:"), getDataRowLimitControl(DataRowLimit.Fifty), getDataRowLimitControl(DataRowLimit.FiveHundred), getDataRowLimitControl(DataRowLimit.Unlimited))); } // Excel export if (allowExportToExcel) { actionLinks.Add( new ActionButtonSetup( "Export to Excel", new PostBackButton(PostBack.CreateFull(id: PostBack.GetCompositeId(PostBackIdBase, "excel"), actionGetter: ExportToExcel)))); } // Action links foreach (var actionLink in actionLinks) { captionTable.Visible = true; actionLinkStack.AddControls(actionLink.BuildButton((text, icon) => new TextActionControlStyle(text, icon: icon), false)); } // Selected row actions foreach (var button in selectedRowActionButtonsToAdd) { captionTable.Visible = true; actionLinkStack.AddControls(button); } foreach (var buttonToMethod in selectedRowDataModificationsToMethods) { var dataModification = buttonToMethod.Key; var method = buttonToMethod.Value; dataModification.AddModificationMethod( () => { foreach (var rowSetup in rowSetups) { if (rowSetup.UniqueIdentifier != null && ((EwfCheckBox)rowSetup.UnderlyingTableRow.Cells[0].Controls[0]).IsCheckedInPostBack( AppRequestState.Instance.EwfPageRequestState.PostBackValues)) { method(rowSetup.UniqueIdentifier); } } }); } if (selectedRowDataModificationsToMethods.Any()) { foreach (var rowSetup in rowSetups) { var cell = new TableCell { Width = Unit.Percentage(5), CssClass = EwfTable.CssElementCreator.AllCellAlignmentsClass.ConcatenateWithSpace("ewfNotClickable") }; if (rowSetup.UniqueIdentifier != null) { var firstDm = selectedRowDataModificationsToMethods.First().Key; var pb = firstDm as PostBack; cell.Controls.Add(new EwfCheckBox(false, action: new PostBackFormAction(pb ?? EwfPage.Instance.DataUpdatePostBack))); } rowSetup.UnderlyingTableRow.Cells.AddAt(0, cell); } } // Reordering var filteredRowSetups = rowSetups.Where(rs => rs.RankId.HasValue).ToList(); for (var i = 0; i < filteredRowSetups.Count; i++) { var previousRowSetup = (i == 0 ? null : filteredRowSetups[i - 1]); var rowSetup = filteredRowSetups[i]; var nextRowSetup = ((i == filteredRowSetups.Count - 1) ? null : filteredRowSetups[i + 1]); var controlLine = new ControlLine(new Control[0]); if (previousRowSetup != null) { var upButton = new PostBackButton( new ButtonActionControlStyle(@"/\", ButtonSize.ShrinkWrap), usesSubmitBehavior: false, postBack: PostBack.CreateFull( id: PostBack.GetCompositeId(PostBackIdBase, rowSetup.RankId.Value.ToString(), "up"), firstModificationMethod: () => RankingMethods.SwapRanks(previousRowSetup.RankId.Value, rowSetup.RankId.Value))); controlLine.AddControls(upButton); } if (nextRowSetup != null) { var downButton = new PostBackButton( new ButtonActionControlStyle(@"\/", ButtonSize.ShrinkWrap), usesSubmitBehavior: false, postBack: PostBack.CreateFull( id: PostBack.GetCompositeId(PostBackIdBase, rowSetup.RankId.Value.ToString(), "down"), firstModificationMethod: () => RankingMethods.SwapRanks(rowSetup.RankId.Value, nextRowSetup.RankId.Value))); controlLine.AddControls(downButton); } // NOTE: What about rows that don't have a RankId? They need to have an empty cell so all rows have the same cell count. var cell = new TableCell { Width = Unit.Percentage(10), CssClass = EwfTable.CssElementCreator.AllCellAlignmentsClass.ConcatenateWithSpace("ewfNotClickable") }; cell.Controls.Add(controlLine); rowSetup.UnderlyingTableRow.Cells.Add(cell); } if (HideIfEmpty && !HasContentRows) { Visible = false; } }); }
public bool Back(IDialogContext context, T state, FormState form) { form.Next = null; return(false); }
public FormPrompt NotUnderstood(DialogContext context, T state, FormState form, IMessageActivity input) { throw new NotImplementedException(); }
public IEnumerable <TermMatch> Match(DialogContext context, T state, FormState form, IMessageActivity input) { return(_field.Prompt.Recognizer.Matches(input)); }
public TreeModule(FormState source) { this.source = source; this.source.PropertyChanged += Source_PropertyChanged; }
public async Task <StepResult> ProcessAsync(IDialogContext context, T state, FormState form, string input, IEnumerable <TermMatch> matches) { ValidateResult feedback = new ValidateResult(); feedback.IsValid = true; feedback.Feedback = null; feedback.FeedbackCard = null; feedback.Choices = null; FormPrompt prompt = null; FormPrompt feedbackPrompt = null; var iprompt = _field.Prompt; var fieldState = (FieldStepState)form.StepState; object response = null; if (fieldState.State == FieldStepStates.SentPrompt) { // Response to prompt var firstMatch = matches.FirstOrDefault(); if (matches.Count() == 1) { response = firstMatch.Value; if (_field.AllowsMultiple && response != null && (response.GetType() == typeof(string) || !response.GetType().IsIEnumerable())) { response = new List <object>() { response }; } feedback = await SetValueAsync(state, response, form); if (!feedback.IsValid && feedback.Choices != null) { var choices = new Ambiguous(input.Substring(firstMatch.Start, firstMatch.Length), feedback.Choices); fieldState.State = FieldStepStates.SentClarify; fieldState.Settled = new List <object>(); fieldState.Clarifications = new List <Ambiguous>() { choices }; response = SetValue(state, null); prompt = ClarifyPrompt((FieldStepState)form.StepState, iprompt.Recognizer, state); } } else if (matches.Count() > 1) { // Check multiple matches for ambiguity var groups = MatchAnalyzer.GroupedMatches(matches); // 1) Could be multiple match groups like for ingredients. // 2) Could be overlapping matches like "onion". // 3) Could be multiple matches where only one is expected. if (!_field.AllowsMultiple) { // Create a single group of all possibilities if only want one value var mergedGroup = groups.SelectMany((group) => group).ToList(); groups = new List <List <TermMatch> >() { mergedGroup }; } var ambiguous = new List <Ambiguous>(); var settled = new List <object>(); foreach (var choices in groups) { if (choices.Count > 1) { var unclearResponses = string.Join(" ", (from choice in choices select input.Substring(choice.Start, choice.Length)).Distinct()); var values = from match in choices select match.Value; ambiguous.Add(new Ambiguous(unclearResponses, values)); } else { var matchValue = choices.First().Value; if (matchValue != null && matchValue.GetType() != typeof(string) && matchValue.GetType().IsIEnumerable()) { foreach (var value in (System.Collections.IEnumerable)matchValue) { settled.Add(value); } } else { settled.Add(choices.First().Value); } } } if (settled.Count > 1) { // Remove no preference if present settled.Remove(null); } if (ambiguous.Count > 0) { // Need 1 or more clarifications fieldState.State = FieldStepStates.SentClarify; fieldState.Settled = settled; fieldState.Clarifications = ambiguous; response = SetValue(state, null); prompt = ClarifyPrompt((FieldStepState)form.StepState, iprompt.Recognizer, state); } else { if (_field.AllowsMultiple) { response = settled; feedback = await SetValueAsync(state, response, form); } else { Debug.Assert(settled.Count == 1); response = settled.First(); feedback = await SetValueAsync(state, response, form); } } } var unmatched = MatchAnalyzer.Unmatched(input, matches); var unmatchedWords = string.Join(" ", unmatched); var nonNoise = Language.NonNoiseWords(Language.WordBreak(unmatchedWords)).ToArray(); fieldState.Unmatched = null; if (_field.Prompt.Annotation.Feedback == FeedbackOptions.Always) { fieldState.Unmatched = string.Join(" ", nonNoise); } else if (_field.Prompt.Annotation.Feedback == FeedbackOptions.Auto && nonNoise.Any() && unmatched.Any()) { fieldState.Unmatched = string.Join(" ", nonNoise); } } else if (fieldState.State == FieldStepStates.SentClarify) { if (matches.Count() == 1) { // Clarified ambiguity var clarify = NeedsClarification(fieldState); fieldState.Settled.Add(matches.First().Value); fieldState.Clarifications.Remove(clarify); if (prompt == null) { // No clarification left, so set the field if (_field.AllowsMultiple) { response = fieldState.Settled; feedback = await SetValueAsync(state, response, form); } else { Debug.Assert(fieldState.Settled.Count == 1); response = fieldState.Settled.First(); feedback = await SetValueAsync(state, response, form); } form.SetPhase(StepPhase.Completed); } } } if (form.Phase() == StepPhase.Completed) { form.StepState = null; if (fieldState.Unmatched != null) { if (feedback.FeedbackCard != null) { feedbackPrompt = feedback.FeedbackCard; } else if (feedback.Feedback != null) { feedbackPrompt = new FormPrompt { Prompt = feedback.Feedback }; } else { if (fieldState.Unmatched != "") { feedbackPrompt = new Prompter <T>(_field.Template(TemplateUsage.Feedback), _field.Form, null).Prompt(state, _field, fieldState.Unmatched); } else { feedbackPrompt = new Prompter <T>(_field.Template(TemplateUsage.Feedback), _field.Form, null).Prompt(state, _field); } } } } var next = _field.Next(response, state); return(new StepResult(feedback.IsValid, next, feedbackPrompt ?? (feedback.FeedbackCard ?? new FormPrompt { Prompt = feedback.Feedback }), prompt)); }
public IEnumerable <TermMatch> Match(DialogContext context, T state, FormState form, IMessageActivity input) { throw new NotImplementedException(); }
public IEnumerable <TermMatch> Match(IDialogContext context, T state, FormState form, string input) { throw new NotImplementedException(); }
public bool InClarify(FormState form) { return(false); }
public bool Back(IDialogContext context, T state, FormState form) { return(false); }
public FormPrompt Help(T state, FormState form, string commandHelp) { return(null); }
public FormPrompt Start(IDialogContext context, T state, FormState form) { return(_field.Prompt.Prompt(state, _field)); }
public FormPrompt NotUnderstood(IDialogContext context, T state, FormState form, string input) { var template = _field.Template(TemplateUsage.NotUnderstood); return(new Prompter <T>(template, _field.Form, _field.Prompt.Recognizer, _fields).Prompt(state, _field, input)); }
public IEnumerable <TermMatch> Match(IDialogContext context, T state, FormState form, string input) { return(_field.Prompt.Recognizer.Matches(input)); }
public virtual bool IsVisible(FormState formState) { return(App.WebDriver.WaitUntilVisible( SeleniumFunctions.Selectors.GetXPathSeleniumSelector(SeleniumSelectorItems.Entity_FieldContainer, Control), TimeSpan.FromSeconds(5)) != null); }
public FormPrompt NotUnderstood(IDialogContext context, T state, FormState form, string input) { throw new NotImplementedException(); }
public FormPrompt Start(IDialogContext context, T state, FormState form) { form.SetPhase(StepPhase.Responding); form.StepState = new FieldStepState(FieldStepStates.SentPrompt); return(_field.Prompt.Prompt(state, _field, _field.Prompt.Recognizer.PromptArgs())); }
public Task <StepResult> ProcessAsync(IDialogContext context, T state, FormState form, string input, IEnumerable <TermMatch> matches) { throw new NotImplementedException(); }
public bool InClarify(FormState form) { var state = (FieldStepState)form.StepState; return(state.State == FieldStepStates.SentClarify); }
protected IQueryable <Xe> _SelectCars(LinQtoSQLDataContext context, FormState state) { IQueryable <Xe> cars = from car in context.Xes select car; if (state == null) { return(cars); } string name = state.Name; string _type = state.Type; //string _price = state.Price; var _from = default(DateTime); var _to = default(DateTime); //try to parse time range if (!string.IsNullOrEmpty(name)) { int maxe = int.Parse(name); if (!string.IsNullOrEmpty(name)) { int.TryParse(name, out maxe); } cars = cars.Where(c => c.Ma_Xe == maxe); } if (!string.IsNullOrEmpty(state.DateFrom)) { _from = _ParseDate(state.DateFrom, state.TimeFrom); _to = _ParseDate(state.DateTo, state.TimeTo); if (_from.CompareTo(default(DateTime)) != 0 && _to.CompareTo(default(DateTime)) == 0)//only start date set { _to = _from.AddHours(1); } } //filter by car type if (!string.IsNullOrEmpty(_type)) { int type = int.Parse(_type); if (!string.IsNullOrEmpty(_type)) { int.TryParse(_type, out type); } cars = cars.Where(c => c.Loai_Xe == type); } /* * //filter by price * if (!string.IsNullOrEmpty(_price)) * { * var price = _price.Split('-'); * int low = int.Parse(price[0]); * int top = int.Parse(price[1]); * cars = cars.Where(c => c.Price <= top && c.Price >= low); * } */ if (_from != default(DateTime) && _to != default(DateTime)) { //select cars, which are available in specified time range cars = from car in cars where car.Thue_Xes.Count == 0 || car.Thue_Xes.Where(o => o.end_date > _from && o.start_date < _to).Count() == 0 select car; } return(cars); }
public FormPrompt NotUnderstood(DialogContext context, T state, FormState form, IMessageActivity input) { var template = _field.Template(TemplateUsage.NotUnderstood); return(new Prompter <T>(template, _field.Form, _field.Prompt.Recognizer, _fields).Prompt(state, _field, MessageActivityHelper.GetSanitizedTextInput(input))); }
public FormPrompt Start(IDialogContext context, T state, FormState form) { form.SetPhase(StepPhase.Responding); return(_field.Prompt.Prompt(state, _field)); }
/// <summary> /// Sets the default values. /// </summary> private void SetToDefault() { MainFormState = new FormState(); ProjectDir = ScadaUtils.IsRunningOnWin ? @"C:\SCADA\Projects\" : ""; }
protected bool OnSaveData() { try { if (!OnBeforeSave()) { return(false); } SysDept sd = new SysDept(); sd.DeptID = txtDeptID.Text; if (!String.IsNullOrEmpty(txtDeptPID.Text)) { sd.DeptPID = txtDeptPID.Text; } else { sd.DeptPID = sd.DeptID; } sd.DeptName = txtDeptName.Text; sd.DeptAddress = txtDeptAddress.Text; sd.CoID = ddlCoID.SelectedValue.ToString(); sd.CrtDate = DateTime.Now; sd.DeptPost = txtDeptPost.Text; sd.DeptTele = txtDeptTele.Text; sd.DeptFax = txtDeptFax.Text; sd.DeptEMail = txtDeptEMail.Text; sd.DeptMan = txtDeptMan.CodeText; sd.DeptLevel = Convert.ToInt16(ddlDeptLevel.SelectedValue);; sd.DeptType = Convert.ToInt16(ddlDeptType.SelectedValue); sd.DeptStatus = Convert.ToInt16(ddlDeptStatus.SelectedValue); sd.DeptShort = txtDeptShort.Text; if (sd.DeptID == sd.DeptPID) { sd.DeptDepth = 1; } else { SysDept pid = SqlBaseProvider.GetSysDept(sd.DeptPID); sd.DeptDepth = Convert.ToInt16(pid.DeptDepth + 1); } sd.SortOrder = Convert.ToInt16(txtSortOrder.Text); sd.AuthDept = sd.DeptID; if (fState == FormState.New) { SqlBaseProvider.SaveSysDept(sd, DataProviderAction.Create); } else { SqlBaseProvider.SaveSysDept(sd, DataProviderAction.Update); } fState = FormState.List; isRefresh = true; OnBindData(); CtrlHelper.DisableCtrls(allCtrls); tsbSave.Visible = false; tsbCancel.Visible = false; return(true); } catch (Exception ex) { Global.ShowSysError(ex); } return(false); }
public void SetStateForm(FormState state) { if (state == FormState.inicial) { gvwDatos.Enabled = true; txtIdClienteCLI.ReadOnly = true; txtRazonSocialCLI.ReadOnly = true; txtNombreCLI.ReadOnly = true; txtApellidoCLI.ReadOnly = true; txtCUIT.ReadOnly = true; txtDireccionCLI.ReadOnly = true; txtLocalidadCLI.ReadOnly = true; txtProvinciaCLI.ReadOnly = true; txtTransporteCLI.ReadOnly = true; txtContactoCLI.ReadOnly = true; txtTelefonoCLI.ReadOnly = true; txtMovilCLI.ReadOnly = true; txtCorreoCLI.ReadOnly = true; txtFechaNacCLI.ReadOnly = true; btnBuscar.Enabled = true; btnNuevo.Enabled = true; btnEditar.Enabled = true; btnBorrar.Enabled = true; btnGrabar.Enabled = false; btnCancelar.Enabled = false; btnSalir.Enabled = true; DelEventosValidacion(); editando = false; insertando = false; txtParametros.Focus(); } if (state == FormState.insercion) { gvwDatos.Enabled = false; txtRazonSocialCLI.ReadOnly = false; txtNombreCLI.ReadOnly = false; txtApellidoCLI.ReadOnly = false; txtCUIT.ReadOnly = false; txtDireccionCLI.ReadOnly = false; txtLocalidadCLI.ReadOnly = false; txtProvinciaCLI.ReadOnly = false; txtTransporteCLI.ReadOnly = false; txtContactoCLI.ReadOnly = false; txtTelefonoCLI.ReadOnly = false; txtMovilCLI.ReadOnly = false; txtCorreoCLI.ReadOnly = false; txtFechaNacCLI.ReadOnly = false; txtIdClienteCLI.Clear(); txtRazonSocialCLI.Clear(); txtCUIT.Clear(); txtDireccionCLI.Clear(); txtLocalidadCLI.Clear(); txtProvinciaCLI.Clear(); txtTransporteCLI.Clear(); txtContactoCLI.Clear(); txtTelefonoCLI.Clear(); txtMovilCLI.Clear(); txtCorreoCLI.Clear(); txtFechaNacCLI.Clear(); btnBuscar.Enabled = false; btnNuevo.Enabled = false; btnEditar.Enabled = false; btnBorrar.Enabled = false; btnGrabar.Enabled = false; btnCancelar.Enabled = true; btnSalir.Enabled = false; txtNombreCLI.Focus(); AddEventosValidacion(); insertando = true; } if (state == FormState.edicion) { gvwDatos.Enabled = false; txtRazonSocialCLI.ReadOnly = false; txtNombreCLI.ReadOnly = false; txtApellidoCLI.ReadOnly = false; txtCUIT.ReadOnly = false; txtDireccionCLI.ReadOnly = false; txtLocalidadCLI.ReadOnly = false; txtProvinciaCLI.ReadOnly = false; txtTransporteCLI.ReadOnly = false; txtContactoCLI.ReadOnly = false; txtTelefonoCLI.ReadOnly = false; txtMovilCLI.ReadOnly = false; txtCorreoCLI.ReadOnly = false; txtFechaNacCLI.ReadOnly = false; btnBuscar.Enabled = false; btnNuevo.Enabled = false; btnEditar.Enabled = false; btnBorrar.Enabled = false; btnGrabar.Enabled = false; btnCancelar.Enabled = true; btnSalir.Enabled = false; txtNombreCLI.Focus(); AddEventosValidacion(); editando = true; } }
public override RequiredState GetRequiredState(FormState formState) { formState.ExpandTab(GetTabLabel()); return(base.GetRequiredState(formState)); }
public override bool IsVisible(FormState formState) { formState.ExpandTab(GetTabLabel()); return(base.IsVisible(formState)); }
protected override void DoSave() { Success = true; DoCheckData(); if (!Success) { return; } //Check Duplicate if (Success == true && tblUser.tbUser.Rows.Count > 0) { Success = Utilities.CheckDuplicateNotInOldValues(tblUser.tbUser.TableName, tblUser.tbUser.UserNameColumn.ColumnName, txtUserName.Text, tblUser.tbUser[0].UserName); if (!Success) { MessageBox.Show("UserName is Duplicate", "คำเตือน", MessageBoxButtons.OK); Success = false; return; } } else { Success = Utilities.CheckDuplicate(tblUser.tbUser.TableName, tblUser.tbUser.UserNameColumn.ColumnName, txtUserName.Text); if (!Success) { MessageBox.Show("UserName is Duplicate", "คำเตือน", MessageBoxButtons.OK); Success = false; return; } } if (MessageBox.Show("คุณต้องการบันทึกข้อมูล ใช่หรือไม่ ?", dbConString.xMessage, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.No) { return; } switch (FormState.ToLower()) { case "new": #region Save if (Success) { try { #region tbUser UserID = Guid.NewGuid().ToString(); dbConString.Transaction = dbConString.mySQLConn.BeginTransaction(); StringBuilder StringBd = new StringBuilder(); StringBd.Clear(); sqlTmp = string.Empty; StringBd.Append("INSERT INTO tbUser VALUES(@UserID,@UserName,@Password,@Detail,@CreatedBy,GETDATE())"); sqlTmp = ""; sqlTmp = StringBd.ToString(); dbConString.Com = new SqlCommand(); dbConString.Com.CommandText = sqlTmp; dbConString.Com.CommandType = CommandType.Text; dbConString.Com.Connection = dbConString.mySQLConn; dbConString.Com.Transaction = dbConString.Transaction; dbConString.Com.Parameters.Clear(); dbConString.Com.Parameters.Add("@UserID", SqlDbType.VarChar).Value = UserID; dbConString.Com.Parameters.Add("@UserName", SqlDbType.VarChar).Value = txtUserName.Text; dbConString.Com.Parameters.Add("@Password", SqlDbType.VarChar).Value = txtConfirm.Text; dbConString.Com.Parameters.Add("@Detail", SqlDbType.VarChar).Value = txtDetail.Text; dbConString.Com.Parameters.Add("@CreatedBy", SqlDbType.VarChar).Value = string.Empty; dbConString.Com.ExecuteNonQuery(); dbConString.Transaction.Commit(); #endregion MessageBox.Show("บันทึกค่าเรียบร้อย", "OK", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } catch { dbConString.Transaction.Rollback(); } } else { return; } #endregion break; case "edit": #region Edit if (Success) { try { #region tbUser dbConString.Transaction = dbConString.mySQLConn.BeginTransaction(); StringBuilder StringBd = new StringBuilder(); StringBd.Clear(); sqlTmp = string.Empty; StringBd.Append("UPDATE tbUser SET UserName = @UserName,Password = @Password,Detail = @Detail WHERE UserID = @UserID"); sqlTmp = ""; sqlTmp = StringBd.ToString(); dbConString.Com = new SqlCommand(); dbConString.Com.CommandText = sqlTmp; dbConString.Com.CommandType = CommandType.Text; dbConString.Com.Connection = dbConString.mySQLConn; dbConString.Com.Transaction = dbConString.Transaction; dbConString.Com.Parameters.Clear(); dbConString.Com.Parameters.Add("@UserID", SqlDbType.VarChar).Value = UserID; dbConString.Com.Parameters.Add("@UserName", SqlDbType.VarChar).Value = txtUserName.Text; dbConString.Com.Parameters.Add("@Password", SqlDbType.VarChar).Value = txtConfirm.Text; dbConString.Com.Parameters.Add("@Detail", SqlDbType.VarChar).Value = txtDetail.Text; dbConString.Com.ExecuteNonQuery(); dbConString.Transaction.Commit(); #endregion MessageBox.Show("บันทึกค่าเรียบร้อย", "OK", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } catch (Exception ex) { dbConString.Transaction.Rollback(); } } else { return; } #endregion break; } }
public NavigationField(string name, string startField, IForm <T> form, T state, FormState formState, Fields <T> fields) : base(name, FieldRole.Value) { Form = form; var field = form.Fields.Field(startField); SetFieldDescription(_form.Configuration.Navigation); SetOptional(); foreach (var value in formState.Next.Names) { var svalue = (string)value; var sfield = form.Fields.Field(svalue); var fieldPrompt = sfield.Template(TemplateUsage.NavigationFormat); var prompter = new Prompter <T>(fieldPrompt, form, sfield.Prompt.Recognizer); AddDescription(value, prompter.Prompt(state, sfield).Prompt, null, sfield.FieldDescription.Message ?? sfield.FieldDescription.Description); AddTerms(value, form.Fields.Field(svalue).FieldTerms.ToArray()); } var template = field.Template(TemplateUsage.Navigation); SetPrompt(new PromptAttribute(template)); SetRecognizer(new RecognizeEnumeration <T>(this)); _prompt = new Prompter <T>(template, form, _recognizer, fields); }
public override bool IsLocked(FormState formState) { formState.ExpandTab(GetTabLabel()); return(base.IsLocked(formState)); }