/// <summary> /// Used to change the Batch Button Image on Batch Button Mode change. /// </summary> /// <param name="formBatchButtonMode">The form batch button mode.</param> private void SetBatchButton(BatchButtonStatusMode formBatchButtonMode) { switch (formBatchButtonMode) { case BatchButtonStatusMode.Pause: { this.RunBatchButton.Image = this.BatchButtonTypeImage.Images[2]; this.StopBatchButton.Image = this.BatchButtonTypeImage.Images[3]; this.GetBatchButtonToolTip(formBatchButtonMode); break; } case BatchButtonStatusMode.Run: { this.RunBatchButton.Image = this.BatchButtonTypeImage.Images[4]; this.StopBatchButton.Image = this.BatchButtonTypeImage.Images[3]; this.GetBatchButtonToolTip(formBatchButtonMode); break; } default: { this.RunBatchButton.Image = this.BatchButtonTypeImage.Images[0]; this.StopBatchButton.Image = this.BatchButtonTypeImage.Images[1]; this.GetBatchButtonToolTip(formBatchButtonMode); break; } } }
/// <summary> /// Handles the Click event of the StopBatchButton control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param> private void StopBatchButton_Click(object sender, EventArgs e) { try { if (!this.currentParentFormBatchButtonStatusMode.Equals(BatchButtonStatusMode.Load)) { this.currentParentFormBatchButtonStatusMode = BatchButtonStatusMode.Load; this.SetBatchButton(BatchButtonStatusMode.Load); } } catch (Exception ex) { ExceptionManager.ManageException(ex, ExceptionManager.ActionType.CloseCurrentForm, this.ParentForm); } }
/// <summary> /// Used to change the Batch Button ToolTip Text on Batch Button Mode change. /// </summary> /// <param name="currentBatchButtonMode">The form batch button mode.</param> private void GetBatchButtonToolTip(BatchButtonStatusMode currentBatchButtonMode) { switch (currentBatchButtonMode) { case BatchButtonStatusMode.Pause: { if (this.currentFormBatchItemCount > 0) { this.RunBatchButton.AccessibleName = SharedFunctions.GetResourceString("F1440PauseReceipt") + " " + this.currentFormBatchItemCount + SharedFunctions.GetResourceString("F1440ItemsinBatch"); this.StopBatchButton.AccessibleName = SharedFunctions.GetResourceString("F1440CloseReceipt") + " " + this.currentFormBatchItemCount + SharedFunctions.GetResourceString("F1440ItemsinBatch"); } else { this.RunBatchButton.AccessibleName = SharedFunctions.GetResourceString("F1440PauseReceipt"); this.StopBatchButton.AccessibleName = SharedFunctions.GetResourceString("F1440CloseReceipt"); } break; } case BatchButtonStatusMode.Run: { if (this.currentFormBatchItemCount > 0) { this.RunBatchButton.AccessibleName = SharedFunctions.GetResourceString("F1440StartReceipt") + " " + this.currentFormBatchItemCount + SharedFunctions.GetResourceString("F1440ItemsinBatch"); this.StopBatchButton.AccessibleName = SharedFunctions.GetResourceString("F1440CloseReceipt") + " " + this.currentFormBatchItemCount + SharedFunctions.GetResourceString("F1440ItemsinBatch"); } else { this.RunBatchButton.AccessibleName = SharedFunctions.GetResourceString("F1440StartReceipt"); this.StopBatchButton.AccessibleName = SharedFunctions.GetResourceString("F1440CloseReceipt"); } break; } default: { this.RunBatchButton.AccessibleName = SharedFunctions.GetResourceString("F1440StartNewReceipt"); this.StopBatchButton.AccessibleName = SharedFunctions.GetResourceString("F1440NoReceipt"); break; } } }
/// <summary> /// Handles the Click event of the RunBatchButton control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param> private void RunBatchButton_Click(object sender, EventArgs e) { try { switch (this.currentParentFormBatchButtonStatusMode) { ////when the BatchButtonStatusMode is Pause case BatchButtonStatusMode.Pause: { this.currentParentFormBatchButtonStatusMode = BatchButtonStatusMode.Run; this.SetBatchButton(BatchButtonStatusMode.Run); break; } ////when the BatchButtonStatusMode is Run case BatchButtonStatusMode.Run: { this.currentParentFormBatchButtonStatusMode = BatchButtonStatusMode.Pause; this.SetBatchButton(BatchButtonStatusMode.Pause); break; } ////when the BatchButtonStatusMode is load default: { object[] optionalParameter; optionalParameter = new object[] { this.formSliceFormNo, this.currentFormSlicePermission }; Form snapShotForm = new Form(); snapShotForm = TerraScanCommon.GetForm(9040, optionalParameter, this.parentWorkItem); if (snapShotForm != null) { DialogResult dialogResult = snapShotForm.ShowDialog(); if (dialogResult.Equals(DialogResult.OK)) { this.snapShotId = Convert.ToInt32(TerraScanCommon.GetValue(snapShotForm, "CurrentSnapShotId")); } else { ////if no record is select in the F9040 snapshot dialog form set it as zero this.snapShotId = 0; } } ////if the F9040 snapShot form returns snapshot id, chnage the Batch Button status if (this.snapShotId > 0) { ////db call is used get the no of count in snapshot item collection this.currentFormBatchItemCount = WSHelper.F1440_SaveRecieptinSnapShotBatchButtonControl(this.snapShotId, null, this.currentBatchButtonUserId); this.currentParentFormBatchButtonStatusMode = BatchButtonStatusMode.Pause; this.SetBatchButton(BatchButtonStatusMode.Pause); } break; } } } catch (SoapException soapException) { ExceptionManager.ManageException(soapException, ExceptionManager.ActionType.CloseCurrentForm, this.ParentForm); } catch (Exception ex) { ExceptionManager.ManageException(ex, ExceptionManager.ActionType.Display, this.ParentForm); } }