private async Task MessageReceivedAsync(IDialogContext context, IAwaitable <object> result) { var estimatorForm = new FormDialog <RegisterPatientForm>(new RegisterPatientForm(), RegisterPatientForm.BuildForm, FormOptions.PromptInStart, null); context.Call <RegisterPatientForm>(estimatorForm, FormCompleteCallbackAsync); //var activity = await result as Activity; //// calculate something for us to return //int length = (activity.Text ?? string.Empty).Length; //// return our reply to the user //await context.PostAsync($"You sent {activity.Text} which was {length} characters"); //context.Wait(MessageReceivedAsync); }
private async Task AfterAskAboutSurvey(IDialogContext context, IAwaitable <bool> result) { bool takeSurvey = await result; if (takeSurvey) { var survey = new FormDialog <SurveyFormFlowModel>(new SurveyFormFlowModel(), SurveyFormFlowModel.BuildForm, FormOptions.PromptInStart, null); context.Call <SurveyFormFlowModel>(survey, AfterSurvey); } else { context.Done(""); } }
private async Task ResumeAfterOptionSelected(IDialogContext context, IAwaitable <string> result) { try { var option = await result; if (option == null) { context.Done(person); return; } if (option.Equals(Resources.EditDetailsDialog_option_address, StringComparison.OrdinalIgnoreCase)) { var locationDialog = dialogFactory.Create <LocationDialog>( new Dictionary <string, object> { { "channelId", context.Activity.ChannelId } }); context.Call(locationDialog, OnAddressChanged); return; } if (option.Equals(Resources.EditDetailsDialog_option_name, StringComparison.OrdinalIgnoreCase)) { person.FirstName = null; person.LastName = null; } if (option.Equals(Resources.EditDetailsDialog_option_email, StringComparison.OrdinalIgnoreCase)) { person.Email = null; } if (option.Equals(Resources.EditDetailsDialog_option_phone, StringComparison.OrdinalIgnoreCase)) { person.Phone = null; } var form = new FormDialog <Person>(person, Person.BuildForm, FormOptions.PromptInStart); context.Call(form, OnPersonDetailsChanged); } catch (TooManyAttemptsException) { await StartAsync(context); } }
/// <summary> /// 条码故障 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnBarcodeScan_Click(object sender, EventArgs e) { try { object obj = ObjectUtil.GetObject(Context.ProcessDispatcher.WriteToService("StockPLC_01", "01_1_124")); if (obj == null || obj.ToString() == "0") { return; } string strBadFlag = ""; switch (obj.ToString()) { case "1": strBadFlag = "左边条码无法读取"; break; case "2": strBadFlag = "右边条码无法读取"; break; case "3": strBadFlag = "两边条码无法读取"; break; case "4": strBadFlag = "两边条码不一致"; break; } string strBarCode; string[] strMessage = new string[3]; strMessage[0] = "3"; strMessage[1] = strBadFlag; while ((strBarCode = FormDialog.ShowDialog(strMessage, null)) != "") { byte[] b = THOK.XC.Process.Common.ConvertStringChar.stringToByte(strBarCode, 40); Context.ProcessDispatcher.WriteToService("StockPLC_01", "01_2_124_1", b); //写入条码 Context.ProcessDispatcher.WriteToService("StockPLC_01", "01_2_124_2", 1); //写入标识。 Context.Processes["NotReadBarcodeProcess"].Resume(); break; } } catch (Exception ex) { Logger.Error("THOK.XC.Process.Process_01.NotReadBarcodeProcess:" + ex.Message); } }
public async Task InsurancePurchase(IDialogContext context, LuisResult result) { var entities = new List <EntityRecommendation>(); String insuranceType = String.Empty; MotorInsuranceModel motorInsurance = new MotorInsuranceModel(); foreach (var entity in result.Entities) { if (entity.Type == "InsuranceType") { insuranceType = entity.Entity.ToLower(); } else if (entity.Type == "VechileType") { var e = new EntityRecommendation(entity.Type); entities.Add(e); var a = entity.Resolution["values"]; var value = ((Newtonsoft.Json.Linq.JValue)((Newtonsoft.Json.Linq.JContainer)a).First).Value.ToString().ToLower(); if (value == "two wheeler") { e.Entity = "two wheeler"; motorInsurance.VechileType = MotorType.TwoWheeler; } else if (value == "four wheeler") { e.Entity = "four wheeler"; motorInsurance.VechileType = MotorType.FourWheeler; } } } if (insuranceType == "motor") { //var motorDialog = FormDialog.FromForm<MotorInsuranceModel>(MotorInsuranceModel.BuildForm, FormOptions.PromptInStart); //context.Call(motorDialog, this.ResumeAfterOptionDialog); //context.Forward(motorDialog, this.ResumeAfterOptionDialog, motorInsurance, CancellationToken.None); var motorDialog = new FormDialog <MotorInsuranceModel>(new MotorInsuranceModel(), MotorInsuranceModel.BuildForm, FormOptions.PromptInStart, entities.Count == 0 ? null : entities); //context.Call<MotorInsuranceModel>(motorDialog, ResumeAfterOptionDialog); context.Forward(motorDialog, this.ResumeAfterOptionDialog, motorInsurance, CancellationToken.None); /*var motorDialog = FormDialog.FromForm<MotorInsuranceModel>(MotorInsuranceModel.BuildForm, FormOptions.PromptInStart); * //context.Call(motorDialog, this.ResumeAfterOptionDialog); * context.Forward(motorDialog, this.ResumeAfterOptionDialog, motorInsurance, CancellationToken.None);*/ context.Wait(MessageReceived); } }
private static List <Tuple <string, int, int> > execDialog(string wrong, string c_object_ID) { FormDialog dlg = new FormDialog(wrong, true); dlg.c_ID = c_object_ID; DialogResult result = dlg.ShowDialog(null); List <Tuple <string, int, int> > list = new List <Tuple <string, int, int> >(); if (dlg.radioButton1.Checked) { if (result == DialogResult.OK) { list.Add(new Tuple <string, int, int>(dlg.GetGoodName(), dlg.GetGoodType(), dlg.GetGoodDesc())); return(list); } else if (result == DialogResult.Cancel) { throw new Exception("Przerwano przez użytkownika."); } else { return(null); } } else if (dlg.radioButton2.Checked) { if (result == DialogResult.OK) { string s = dlg.getGoodString(); string[] sarr = s.Split(';'); foreach (string elem in sarr) { string[] elemArr = elem.Split(':'); list.Add(new Tuple <string, int, int>(elemArr[0], int.Parse(elemArr[2]), int.Parse(elemArr[1]))); } return(list); } else if (result == DialogResult.Cancel) { throw new Exception("Przerwano przez użytkownika."); } else { return(null); } } return(null); }
private void InvoiceDetailDatecs_FormClosing(object sender, FormClosingEventArgs e) { _mainForm.RefreshData(_invmasterRow); //проверить если выход по ошибке if ((_invmasterRow.NumCheck == 0) & (_invmasterRow.GetInvoiceDetailRows().Length > 0)) { FormDialog _fdlg = new FormDialog(); TextBox _tb = new TextBox(); _fdlg.Text = "Аннуляция чека: "; if (this.causeError == null) { _tb.Text = "Ошибочный чек ..."; } else { _tb.Text = this.causeError; } _tb.Width = _fdlg.panel.Width; // _tb.Dock = DockStyle.Fill; _tb.SelectAll(); _fdlg.panel.Controls.Add(_tb); if (DialogResult.OK == _fdlg.ShowDialog(this)) { _invmasterRow.Note = _tb.Text; if (!_mainForm.SaveToBase(_invmasterRow)) { MessageBox.Show("Ошибка обновления!"); return; } _printer.CancelCheck("ОТМЕНА:" + _tb.Text); } else { e.Cancel = true; } } }
public async Task StartAsync(IDialogContext context) { await context.PostAsync("Alright I will help you create a temp password"); if (sendPassCode(context)) { var resetPasswordDialog = FormDialog.FromForm(this.BuildResetPasswordForm, FormOptions.PromptInStart); context.Call(resetPasswordDialog, this.ResumeAfterResetPasswordFormDialog); } else { //here we can simply fail the current dialog because we have root dialog handling all exceptions context.Fail(new Exception("Failed to send SMS. Make sure email & phone number has been added to database.")); } }
private async Task ProcessSentimentAnalysis(IDialogContext context, LuisResult luisResult) { var result = await TextAnalyticsService.AnalyseSentiment(luisResult.Query); if (result.Score.Value > 0.7) { await context.PostAsync("Merci d'apprecié nos services. Nous travaillons dur pour vous offrir un service de qualité"); context.Wait(MessageReceived); } else { var feedbackForm = new FormDialog <FeedbackForm>(new FeedbackForm(), FeedbackForm.BuildForm, FormOptions.PromptInStart); context.Call <FeedbackForm>(feedbackForm, ResumeAfterDialog); } }
public async Task BookRoom(IDialogContext context, LuisResult result) { IList <object> Values = new List <object>(); foreach (var e in result.Entities) { var entity = ChainOfCommand.Parse(e); if (entity != null) { Values.Add(entity); } } var form = new FormDialog <RoomReservationForm>(new RoomReservationForm(Values.ToArray()), RoomReservationForm.BuildForm); await context.Forward(form, RoomReservationCallBackAsync, null); }
private async Task AfterMenuItemSelected(IDialogContext context, IAwaitable <MenuItem> result) { var menuItem = await result; var tacoOrder = new TacoOrder(); try { tacoOrder.TacoSelection = (TacoType)Enum.Parse(typeof(TacoType), menuItem.ItemNumber.ToString()); var orderForm = new FormDialog <TacoOrder>(tacoOrder, TacoOrder.BuildForm, FormOptions.PromptInStart); context.Call(orderForm, this.AfterOrderForm); } catch (TooManyAttemptsException) { await this.StartOverAsync(context, Resources.RootDialog_Welcome_Error); } }
public async Task ComplaintWizard(IDialogContext context, LuisResult result) { try { await context.PostAsync("OK Let's add the Chief Complaint"); var complaintForm = new FormDialog <ComplaintForm>(new ComplaintForm(), ComplaintForm.BuildForm, FormOptions.PromptInStart); context.Call(complaintForm, ComplaintFormComplete); } catch (Exception) { await context.PostAsync("Something really bad happened. You can try again later meanwhile I'll check what went wrong."); context.Wait(MessageReceived); } }
public async Task getWeatherIntent(IDialogContext context, LuisResult result) { #if DEBUG await context.PostAsync(formatLuisResult(result)); #endif var weatherQuery = new WeatherQuery(); EntityRecommendation LocationRecommendation; if (result.TryFindEntity(ENTITY_LOCATION, out LocationRecommendation)) { weatherQuery.Location = LocationRecommendation.Entity; } var weatherFormDialog = new FormDialog <WeatherQuery>(weatherQuery, this.BuildWeatherForm, FormOptions.PromptInStart, result.Entities); context.Call(weatherFormDialog, this.ResumeAfterFormDialog); }
public async Task PrescriptionWizard(IDialogContext context, LuisResult result) { try { await context.PostAsync("OK Let's fill the Prescription"); var prescriptionForm = new FormDialog <PrescriptionForm>(new PrescriptionForm(), PrescriptionForm.BuildForm, FormOptions.PromptInStart); context.Call(prescriptionForm, PrescriptionFormComplete); } catch (Exception) { await context.PostAsync("Something really bad happened. You can try again later meanwhile I'll check what went wrong."); context.Wait(MessageReceived); } }
public async Task HotelWithDestination(IDialogContext context, IAwaitable <IMessageActivity> activity, LuisResult result) { var message = await activity; await context.PostAsync($"Welcome to the Hotels finder! We are analyzing your message: '{message.Text}'..."); EntityRecommendation cityEntityRecommendation; var hotelQuery = new HotelQuery(); if (result.TryFindEntity(EntityGeographyCity, out cityEntityRecommendation)) { cityEntityRecommendation.Type = "Destination"; } var HotelFormsDialog = new FormDialog <HotelQuery>(hotelQuery, this.BuildHotelsForm, FormOptions.PromptInStart, result.Entities); context.Call(HotelFormsDialog, this.ResumeAfterHotelsFormDialog); }
public async Task ConfirmedRoomReservation(IDialogContext context, IAwaitable <bool> argument) { bool isCorrect = await argument; if (isCorrect) { //new FormDialog<Models.Order>(this.order, Models.Order.BuildOrderForm, FormOptions.PromptInStart); var customerDialog = new FormDialog <Customer>(this.customer, Customer.BuildCustomerForm, FormOptions.PromptInStart); context.Call(customerDialog, this.ResumeAfterCustomerDialog); } else { var reservationDialog = new FormDialog <Reservation>(this.reservation, Reservation.BuildOrderForm, FormOptions.PromptInStart); context.Call(reservationDialog, this.ResumeAfterReservationDialog); } }
private async Task AfterPackageIdForAddressChange(IDialogContext context, IAwaitable <string> result) { var packageId = await result; if (string.IsNullOrEmpty(packageId)) { await context.PostAsync("Ok, no package Id, so I can't change the address"); context.Wait(MessageReceived); } else { var formDialog = FormDialog.FromForm(DeliveryAddress.BuildForm, FormOptions.PromptInStart); context.Call <DeliveryAddress>(formDialog, SetNewDeliveryAddressAsync); } }
public async Task ReserveATable(IDialogContext context, LuisResult result) { try { await context.PostAsync("Great, lets book a table for you. You will need to provide a few details."); var reservationForm = new FormDialog <ReservationDialog>(new ReservationDialog(), ReservationDialog.BuildForm, FormOptions.PromptInStart); context.Call(reservationForm, ReservationFormComplete); } catch (Exception) { await context.PostAsync("Something really bad happened. You can try again later meanwhile I'll check what went wrong."); context.Wait(MessageReceived); } }
public async Task NewBook(IDialogContext context, IAwaitable <IMessageActivity> message, LuisResult result) { var state = new BookMeetingRoomForm(); var entities = new List <EntityRecommendation>(result.Entities); if (entities.Count > 0) { FillEntityNewBookFromLuis(result, out state); entities = null; } var formDialog = new FormDialog <BookMeetingRoomForm>(state, BookMeetingRoomForm.BuildForm , FormOptions.PromptInStart, entities); context.Call(formDialog, Callback); }
private async Task LocationReceiveAsync(IDialogContext context, IAwaitable <object> result) { if (await result is Activity activity && activity.Entities.Count > 0) { var latitude = activity.Entities[0].Properties.Root["geo"]["latitude"].ToString(); var longitude = activity.Entities[0].Properties.Root["geo"]["longitude"].ToString(); var query = new SearchHospitalQuery { Latitude = latitude, Longitude = longitude }; var form = new FormDialog <SearchHospitalQuery>(query, BuildFormAskingMedicalSpecialty, FormOptions.PromptInStart); context.Call(form, AfterFormFilled); }
private async static Task <IDialog <string> > AfterGreetingContinuation(IBotContext context, IAwaitable <object> item) { var data = await item as OnlineTravel; return(Chain.PostToChain() .Select(msg => msg.Text) .Switch(new RegexCase <IDialog <string> >(new Regex("^Hotel", RegexOptions.IgnoreCase), (cnt, text) => { return Chain.ContinueWith(FormDialog.FromForm(HotelBooking.BuildForm, FormOptions.PromptInStart), AfterBookingContinuation); }) ) .Unwrap() .PostToUser()); //return Chain.Return($"You have selected: {data.options}"); }
public async Task Feedback(IDialogContext context, LuisResult result) { try { await context.PostAsync("That's great. You will need to provide few details about yourself before giving feedback."); var feedbackForm = new FormDialog <FeedbackForm>(new FeedbackForm(), FeedbackForm.BuildForm, FormOptions.PromptInStart); context.Call(feedbackForm, FeedbackFormComplete); } catch (Exception) { await context.PostAsync("Something really bad happened. You can try again later meanwhile I'll check what went wrong."); context.Wait(MessageReceived); } }
public async Task SLSServices(IDialogContext context, IAwaitable <IMessageActivity> activity, LuisResult result) { var message = await activity; await context.PostAsync($"Welcome to sls services!! we are analyzing your message: `{message.Text}`"); var query = new LoanSuspendQuery(); EntityRecommendation loanEntity; if (result.TryFindEntity(EntityLoanSuspension, out loanEntity)) { loanEntity.Type = "LoanNumber"; } var formDialog = new FormDialog <LoanSuspendQuery>(query, this.BuildForm, FormOptions.PromptInStart, result.Entities); context.Call(formDialog, this.ResumeAfterFormDialog); }
private async Task ResumeAfterForgotUserName(IDialogContext context, IAwaitable <bool> result) { var confirmation = await result; if (confirmation) { await context.PostAsync("UMassmemorial users will need a CMS account created. Due to a change in the Active Directory structure."); var myform = new FormDialog <CMSFormRequest>(new CMSFormRequest(), CMSFormRequest.BuildForm, FormOptions.PromptInStart, null); context.Call(myform, CMSFormComplete); } else { await context.PostAsync("Use your umassmed account, the one you were assigned and use to log onto your computer."); } }
private async Task MessageReceivedAsync(IDialogContext context, IAwaitable <IMessageActivity> result) { var message = await result; //remove "By " if value passed was button text instead of value switch (message.Text.ToLower().Replace("by ", "")) { case "quit": context.Fail(null); break; case "help": await context.PostAsync("Please select 'Show Help' button during the action selection step to see full help dialog."); await context.PostAsync(GetSuggestions(context)); break; case "latest": await ResumeAfterPrompt(context, result); break; case "name": var nameFormDialog = FormDialog.FromForm(this.BuildEncyclopediaForm, FormOptions.PromptInStart); context.Call(nameFormDialog, ResumeAfterPrompt); break; case "date": var dateFormDialog = FormDialog.FromForm(this.BuildDateForm, FormOptions.PromptInStart); context.Call(dateFormDialog, ResumeAfterPrompt); break; case "amount": var amountFormDialog = FormDialog.FromForm(this.BuildAmountForm, FormOptions.PromptInStart); context.Call(amountFormDialog, ResumeAfterPrompt); break; default: var suggestionMessage = GetSuggestions(context); suggestionMessage.Text = "Sorry, didn't get that"; await context.PostAsync(suggestionMessage); context.Wait(MessageReceivedAsync); break; } }
public async Task StartPlayAGameIntent(IDialogContext context, LuisResult result) { await context.PostAsync("Okay, let's play a gaaaaameeeeeeeee"); LuisResult luisResult = new LuisResult("Saw play a game", new List <EntityRecommendation>() { new EntityRecommendation { Entity = "Saw play a game" } }); await ImageIntent(context, luisResult); var formDialog = new FormDialog <MillionaireGame>(new MillionaireGame(), MillionaireGame.BuildForm, FormOptions.PromptInStart, result.Entities); context.Call(formDialog, ResumeAfterGameDialog); }
private async Task ConfirmationQuestion(IDialogContext context, IAwaitable <bool> result) { if (result != null) { if (await result) { await context.PostAsync("We will create a Ticket for our Insight"); var createUrlDialog = FormDialog.FromForm(Issues.BuildForm, FormOptions.PromptInStart); context.Call(createUrlDialog, AfterFormDialog); } else { PromptDialog.Confirm(context, this.CreateTicket, "Do you want to create a ticket?"); } } }
private async Task CreateTicket(IDialogContext context, IAwaitable <bool> result) { if (result != null) { if (await result) { await context.PostAsync("Ok lets create this ticket now ! "); var createUrlDialog = FormDialog.FromForm(Issues.BuildForm, FormOptions.PromptInStart); context.Call(createUrlDialog, AfterFormDialog); } else { await context.Forward(new MasterDialog(), null, null, CancellationToken.None); } } }
protected override async Task PostAsync(IActivity item, string state, CancellationToken token) { var message = item as IMessageActivity; if (message != null) { var ticketForm = new FormDialog <TicketModel>(new TicketModel(), TicketModel.BuildForm, FormOptions.PromptInStart); //var ticketForm = new RaiseDialog(); var interruption = ticketForm.Void <object, IMessageActivity>(); task.Call(interruption, null); await task.PollAsync(token); } }
private async Task ResumeAfterFormSelection(IDialogContext context, IAwaitable <Selection> result) { var selection = await result; if (selection.ToString().ToLower() == "cmsrequest") { await context.PostAsync("For setting up a CMS Account, I would need the following information: "); var myform = new FormDialog <CMSFormRequest>(new CMSFormRequest(), CMSFormRequest.BuildForm, FormOptions.PromptInStart, null); context.Call <CMSFormRequest>(myform, CMSFormComplete); } else if (selection.ToString().ToLower() == "newwebsiterequest") { var myform = new FormDialog <NewWebsiteRequest>(new NewWebsiteRequest(), NewWebsiteRequest.BuildForm, FormOptions.PromptInStart, null); context.Call <NewWebsiteRequest>(myform, AfterNewWebsiteRequest); } }
private void btAdd_Click(object sender, EventArgs e) { /*создать новую строку, указатель на нее в дл¤ редактировани¤*/ MDataSet.RemainsRow _rems = this.gridViewRemainsInvDetEdt.GetDataRow(this.gridViewRemainsInvDetEdt.FocusedRowHandle) as MDataSet.RemainsRow; if (_rems == null) return; FormDialog _formDialog = new FormDialog(); _formDialog.AcceptButton = _formDialog.btOk; _formDialog.Text = "ƒобавить строку"; MDataSet.InvoiceDetailRow sourceRow = ((this.invoiceDetailBindingSource.AddNew() as DataRowView).Row as MDataSet.InvoiceDetailRow); MDataSet.RemainsRow remainsRow = ((this.RemainsBindingSource.CurrencyManager.Current as DataRowView).Row as MDataSet.RemainsRow); MDataSet.ProductRow _productRow = (this.productBindingSource.DataSource as MDataSet.ProductDataTable).FindByID(remainsRow.ProductRef); if ((sourceRow != null) & (remainsRow != null)) { InvoiceDetailRowAdd _invoiceDetailRowAdd = new InvoiceDetailRowAdd(sourceRow, remainsRow,_productRow); _formDialog.panel.Controls.Add(_invoiceDetailRowAdd); if (DialogResult.OK == _formDialog.ShowDialog(this)) { remainsRow.AcceptChanges(); this.invoiceDetailBindingSource.EndEdit(); } else { this.invoiceDetailBindingSource.CancelEdit(); remainsRow.RejectChanges(); } } }
private void btReturnDoc_Click(object sender, EventArgs e) { _mainForm.RefreshData(_invmasterRow); if (_invmasterRow.GetInvoiceDetailRows().Length==0) return; FormDialog _fdlg = new FormDialog(); TextBox _tb = new TextBox(); _fdlg.Text = "Закрытие чека: "; _tb.Text = "Возврат : ..."; _tb.Width = _fdlg.panel.Width; // _tb.Dock = DockStyle.Fill; _tb.SelectAll(); _fdlg.panel.Controls.Add(_tb); if (DialogResult.OK == _fdlg.ShowDialog(this)) { _invmasterRow.Note = _tb.Text; if (!_mainForm.SaveToBase(_invmasterRow)) { MessageBox.Show("Ошибка обновления!"); return; } this._mainForm.MakeToReturn(_invmasterRow); _invmasterRow.SetModified(); if (!_mainForm.SaveToBase(_invmasterRow)) { MessageBox.Show("Ошибка обновления!"); return; } this.Close(); } }
private void gridViewInvRem_DoubleClick(object sender, EventArgs e) { MDataSet.RemainsRow _rem = this.gridViewInvRem.GetDataRow(this.gridViewInvRem.FocusedRowHandle) as MDataSet.RemainsRow; if (_rem != null) { MDataSet.InvoiceDetailRow _newRow = (this.invoiceDetailBindingSource.AddNew() as DataRowView).Row as MDataSet.InvoiceDetailRow; InvoiceDetailAdd _invoceDetailAdd = new InvoiceDetailAdd(_newRow, _rem,_mainForm); FormDialog formDialog = new FormDialog(); formDialog.Text = "Добавить строку"; formDialog.AcceptButton = null; formDialog.panel.Controls.Add(_invoceDetailAdd); if (DialogResult.OK == formDialog.ShowDialog(this)) { this.invoiceDetailBindingSource.EndEdit(); this.SaleInvoiceDetail(_newRow); } else { this.invoiceDetailBindingSource.CancelEdit(); this.mDataSet.ReceiptRemains.RejectChanges(); } } }
private void gridViewinvDet_DoubleClick(object sender, EventArgs e) { if (this.gridViewinvDet.IsValidRowHandle(this.gridViewinvDet.FocusedRowHandle) & this.gridViewinvDet.State == GridState.Normal & !this.gridViewinvDet.IsFilterRow(this.gridViewinvDet.FocusedRowHandle)) { FormDialog _formDialog = new FormDialog(); _formDialog.AcceptButton = null; _formDialog.Text = "»зменить строку"; MDataSet.InvoiceDetailRow sourceRow = ((this.invoiceDetailBindingSource.CurrencyManager.Current as DataRowView).Row as MDataSet.InvoiceDetailRow); if ((sourceRow != null) ) { MDataSet.ProductRow productRow = (this.productBindingSource.DataSource as MDataSet.ProductDataTable).FindByID(sourceRow.ProductRef); if (productRow == null) { MessageBox.Show("ќшибка поиска товара"); return; } InvoiceDetailRowAdd _invoiceDetailRowAdd = new InvoiceDetailRowAdd(sourceRow, sourceRow.RemainsRow,productRow); _formDialog.panel.Controls.Add(_invoiceDetailRowAdd); if (DialogResult.OK == _formDialog.ShowDialog(this)) this.invoiceDetailBindingSource.EndEdit(); else this.invoiceDetailBindingSource.CancelEdit(); } } }
private void InvoiceDetailDatecs_FormClosing(object sender, FormClosingEventArgs e) { _mainForm.RefreshData(_invmasterRow); //проверить если выход по ошибке if ((_invmasterRow.NumCheck == 0) & (_invmasterRow.GetInvoiceDetailRows().Length > 0)) { FormDialog _fdlg = new FormDialog(); TextBox _tb = new TextBox(); _fdlg.Text = "Аннуляция чека: "; if (this.causeError == null) _tb.Text = "Ошибочный чек ..."; else _tb.Text = this.causeError; _tb.Width = _fdlg.panel.Width; // _tb.Dock = DockStyle.Fill; _tb.SelectAll(); _fdlg.panel.Controls.Add(_tb); if (DialogResult.OK == _fdlg.ShowDialog(this)) { _invmasterRow.Note = _tb.Text; if (!_mainForm.SaveToBase(_invmasterRow)) { MessageBox.Show("Ошибка обновления!"); return; } _printer.CancelCheck("ОТМЕНА:" + _tb.Text); } else e.Cancel = true; } }
private void btEdit_Click(object sender, EventArgs e) { this.invoiceMasterBindingSource.EndEdit(); this.Save(); this.mainDataset.InvoiceDetail.Merge(this.mDataSet.InvoiceDetail); if (this.ValidateChildren()) { FormDialog _formDialog = new FormDialog(); _formDialog.Text = this.Tag.ToString(); // _formDialog.WindowState = FormWindowState.Maximized; _formDialog.AcceptButton = null; InvoiceDetailEdit _invoiceDetail = new InvoiceDetailEdit(_curentMasterRow, this.mainDataset.Product,(this.ParentForm as MainForm)); // _invoiceDetail.Dock = DockStyle.Fill; _formDialog.panel.Controls.Add(_invoiceDetail); if (DialogResult.OK == _formDialog.ShowDialog(this)) { this.invoiceMasterBindingSource.EndEdit(); btRefresh_Click(sender, e); this.mDataSet.Remains.Merge(this.mainDataset.Remains); } else { this.invoiceMasterBindingSource.CurrencyManager.CancelCurrentEdit(); btRefresh_Click(sender, e); } } }
private void btAddOrders_Click(object sender, EventArgs e) { int Ref; this.ordersBindingSource.EndEdit(); MDataSet.OrdersRow ordrow =(this.ordersBindingSource.Current as DataRowView).Row as MDataSet.OrdersRow; if (ordrow != null) Ref = ordrow.TradePupletRef; else Ref = 1; this.btSave_Click(sender, e); this.grid.EmbeddedNavigator.Buttons.Append.DoClick(); MDataSet.OrdersRow row = (this.ordersBindingSource.Current as DataRowView).Row as MDataSet.OrdersRow; row.TradePupletRef = Ref; row.Reserved = 0; FormDialog formDialog = new FormDialog(); formDialog.Text = "Добавить новый заказ "; formDialog.AcceptButton = null; OrderAdd orderAdd = new OrderAdd(row, this.ParentForm as MainForm); formDialog.panel.Controls.Add(orderAdd); if (formDialog.ShowDialog(this) == DialogResult.OK) { this.grid.EmbeddedNavigator.Buttons.EndEdit.DoClick(); this.ordersBindingSource.EndEdit(); this.btSave_Click(sender, e); } else { this.ordersBindingSource.CancelEdit(); this.mDataSet.Orders.RejectChanges(); } this.grid.Refresh(); }
private void btCloseByOrganization_Click(object sender, EventArgs e) { //***/ this.invoiceMasterBindingSource.EndEdit(); if (!this.Save()) return; if (_curentMasterRow.Sum == 0) return; foreach (DataRow detrow in this._curentMasterRow.GetInvoiceDetailRows()) { if ((detrow as MDataSet.InvoiceDetailRow).PriceRetailNDS == 0) { MessageBox.Show("Есть не установленные цены!!!"); return; } } SelectTradePutlet _selectTradePutlet = new SelectTradePutlet(); _selectTradePutlet.organizationBindingSource.DataSource = this.mainDataset.Organization; _selectTradePutlet.organizationBindingSource.ResetBindings(false); _selectTradePutlet.lookUpEdit.Properties.DataSource = _selectTradePutlet.organizationBindingSource; FormDialog _formDialog = new FormDialog(); _formDialog.panel.Controls.Add(_selectTradePutlet); try { int _OrganizationRef ; if (_formDialog.ShowDialog(this) == DialogResult.OK) { if (Convert.ToInt32(_selectTradePutlet.lookUpEdit.EditValue) == 0) return; _OrganizationRef = Convert.ToInt32(_selectTradePutlet.lookUpEdit.EditValue); (this.ParentForm as MainForm).invoiceMasterTableAdapter.InvoiceMasterMoveToOrg(_curentMasterRow.ID, _OrganizationRef); (this.ParentForm as MainForm).RefreshData(_curentMasterRow, false); } } catch { MessageBox.Show("Ошибка внутреннего перемещения!"); } finally { this.btClose.PerformClick(); } }
private void gridControl1_DoubleClick(object sender, EventArgs e) { try { int focused = this.gridViewInvRem.FocusedRowHandle; MDataSet.RemainsRow _rem = this.gridViewInvRem.GetDataRow(this.gridViewInvRem.FocusedRowHandle) as MDataSet.RemainsRow; _mainForm.RefreshData(_rem); if (_rem != null) { MDataSet.InvoiceDetailRow _newRow = (this.invoiceDetailBindingSource.AddNew() as DataRowView).Row as MDataSet.InvoiceDetailRow; InvoiceDetailAdd _invoceDetailAdd = new InvoiceDetailAdd(_newRow, _rem, _mainForm); FormDialog formDialog = new FormDialog(); formDialog.Text = "Добавить строку"; formDialog.panel.Controls.Add(_invoceDetailAdd); if (DialogResult.OK == formDialog.ShowDialog(this)) { this.invoiceDetailBindingSource.EndEdit(); this.SaleInvoiceDetail(_newRow); _mainForm.RefreshData(_newRow); } else { this.gridViewInvRem.BeginDataUpdate(); this.invoiceDetailBindingSource.CancelEdit(); _rem.RejectChanges(); this.gridViewInvRem.EndDataUpdate(); this.gridRem.Focus(); this.gridViewInvRem.FocusedRowHandle = focused; return; } _invoceDetailAdd.Dispose(); GC.Collect(); } } catch (Exception err) { MessageBox.Show(err.Message); MainForm.Log("gridControl1_DoubleClick " + err.Message); } }
private void btSetExtr_Click(object sender, EventArgs e) { this.invoiceDetailBindingSource.EndEdit(); this.invoiceMasterBindingSource.EndEdit(); // if (this._curentMasterRow.GetInvoiceDetailRows().Length == 0) return; FormDialog _FormDialog = new FormDialog(); _FormDialog.Text = "Установить наценку "; _FormDialog.btCancel.Visible = false; NumericUpDown _num = new NumericUpDown (); Label _lab = new Label(); _lab.Text = "Процент (%): "; _num.Value = 30; _num.Increment = 5; _FormDialog.panel.Controls.Add(_lab); _FormDialog.panel.Controls.Add(_num); _lab.Dock = DockStyle.Bottom; if (_FormDialog.ShowDialog(this.ParentForm) == DialogResult.OK) { try { int ext = Convert.ToInt16(_num.Value); this.invoiceMasterTableAdapter.InvoiceMasterSetExtrById(ext,_curentMasterRow.ID); (this.ParentForm as MainForm).RefreshData(_curentMasterRow,true); } catch (Exception err) { MessageBox.Show(err.Message); } /* foreach (DataRow _Row in _curentMasterRow.GetInvoiceDetailRows()) { MDataSet.InvoiceDetailRow _DetailRow = _Row as MDataSet.InvoiceDetailRow; _DetailRow.PriceRetailNDS = Decimal.Round(_DetailRow.PricePurchase * (1 + _num.Value / 100),2); } */ } }
private void HandlerOnLogin(object o) { BeginInvoke(new MethodInvoker(delegate() { setStatus("Онлайн"); if ( formDialog == null ) { formDialog = new FormDialog(); tabsDialog = new TabControl(); tabsDialog.Size = new System.Drawing.Size(500, 260); tabsDialog.Location = new Point(10, 10); tabsDialog.Anchor = AnchorStyles.Bottom | AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; tabsDialog.SelectedIndexChanged += tabsDialogSelectedIndexChangedOrFormDialogFocused; formDialog.Controls.AddRange(new Control[] { tabsDialog }); formDialog.GotFocus += tabsDialogSelectedIndexChangedOrFormDialogFocused; formDialog.FormClosing += formDialog_FormClosing; formDialog.Show();//this is formDialog.Hide();//КОООСТЫЫЫ formDialog.Close();//ЫЫЫЫЫЫЫЫЫЫЛЬ } buttonCreateConf.Show(); buttonJoinConf.Show(); buttonShowHideContacts.Show(); checkBoxConnected.Checked = true; })); }
private void HandlerOnLogin(object nil) { checkBoxConnected.Invoke(new MethodInvoker(delegate() { if (formDialog == null) { formDialog = new FormDialog(); tabsDialog = new TabControl(); tabsDialog.Size = new System.Drawing.Size(500, 260); tabsDialog.Location = new Point(10, 10); formDialog.Controls.AddRange(new Control[] { tabsDialog }); formDialog.Show();//this is formDialog.Hide();//КОООСТЫЫЫЫЫЛЬ } createConference.Show(); checkBoxConnected.Checked = true; })); }
private static async Task RunScriptAgainstForm(IEnumerable<EntityRecommendation> entities, params string[] script) { IFormTarget target = new FormTarget(); using (var container = Build(Options.ResolveDialogFromContainer, target)) { { var root = new FormDialog<IFormTarget>(target, entities: entities); var builder = new ContainerBuilder(); builder .RegisterInstance(root) .AsSelf() .As<IDialog<object>>(); builder.Update(container); } await AssertScriptAsync(container, script); { Assert.AreEqual(Input.Text, target.Text); Assert.AreEqual(Input.Integer, target.Integer); Assert.AreEqual(Input.Float, target.Float); } } }