Esempio n. 1
0
 protected string Execute(ProcessStartInfo startInfo)
 {
     try
     {
         using (Process process = Process.Start(startInfo))
         {
             if (process != null)
             {
                 using (StreamReader reader = process.StandardOutput)
                 {
                     string result = reader.ReadToEnd();
                     if (result.StartsWith("DEBUG:"))
                     {
                         System.Windows.Forms.MessageBox.Show(new Form {
                             TopMost = true
                         }, result.Substring(6));
                         return("");
                     }
                     if (string.IsNullOrEmpty(result))
                     {
                         using (StreamReader errorReader = process.StandardError)
                         {
                             string error = errorReader.ReadToEnd();
                             if (!string.IsNullOrEmpty(error))
                             {
                                 ErrorReporting.TryShowErrorMessageBox(error, new WoxJsonPRCException(error));
                             }
                         }
                     }
                     return(result);
                 }
             }
         }
     }
     catch
     {
         return(null);
     }
     return(null);
 }
Esempio n. 2
0
        /// <summary>
        /// Shows a dialog to select a support file for the program.
        /// </summary>
        /// <param name="program">The program for which a support file is being selected.</param>
        /// <param name="kind">The kind of support file to browse for.</param>
        /// <returns>The selected support file.</returns>
        internal static string BrowseForSupportFile(ProgramViewModel program, ProgramFileKind kind)
        {
            string filter = null;
            string prompt = null;

            switch (kind)
            {
            case ProgramFileKind.ManualText:
                filter = RomListViewModel.SelectManualFilter;
                prompt = string.Format(System.Globalization.CultureInfo.CurrentCulture, RomListViewModel.SelectManualPromptFormat, program.ProgramDescription.Name);
                break;

            case ProgramFileKind.SaveData:
                filter = RomListViewModel.SelectJlpSaveDataFilter;
                prompt = string.Format(System.Globalization.CultureInfo.CurrentCulture, RomListViewModel.SelectJlpSavePromptFormat, program.ProgramDescription.Name);
                break;

            default:
                ErrorReporting.ReportNotImplementedError("ProgramViewModel.BrowseForSupportFile");
                break;
            }

            string supportFilePath = null;
            var    fileBrowser     = FileDialogHelpers.Create();

            fileBrowser.IsFolderBrowser = false;
            fileBrowser.AddFilter(filter, kind.FileExtensions());
            fileBrowser.AddFilter(FileDialogHelpers.AllFilesFilter, new string[] { ".*" });
            fileBrowser.Title            = prompt;
            fileBrowser.EnsureFileExists = true;
            fileBrowser.EnsurePathExists = true;
            fileBrowser.Multiselect      = false;
            var result = fileBrowser.ShowDialog();

            if (result == FileBrowserDialogResult.Ok)
            {
                supportFilePath = fileBrowser.FileNames.First();
            }
            return(supportFilePath);
        }
Esempio n. 3
0
        public static void Init(PhoneApplicationPage page)
        {
            if (!(page is SettingsPage))
            {
                var settingsMenuItem = new ApplicationBarMenuItem("Settings");
                settingsMenuItem.Click += delegate
                {
                    ErrorReporting.Log("OnSettingsClick");
                    page.NavigationService.Navigate(page.GetUri <SettingsPage>());
                };
                page.ApplicationBar.MenuItems.Add(settingsMenuItem);
            }

            var aboutMenuItem = new ApplicationBarMenuItem("About");

            aboutMenuItem.Click += delegate
            {
                ErrorReporting.Log("OnAboutClick");
                page.NavigationService.Navigate(page.GetUri <AboutPage>());
            };
            page.ApplicationBar.MenuItems.Add(aboutMenuItem);
        }
Esempio n. 4
0
        public PartsEditPageViewModel(App_WorkTicket workTicket, App_RepairPart partToEdit)
        {
            // dch rkl 12/07/2016 catch exception
            try
            {
                _workTicket = workTicket;
                _partToEdit = partToEdit;

                // dch rkl 12/01/2016 Get Warehouse List from IM_Warehouse instead of IM_ItemWarehouse BEGIN
                //_warehouseList = GetTechnicianWarehouses();
                //_warehouseList = new List<string>();
                // dch rkl 12/01/2016 Get Warehouse List from IM_Warehouse instead of IM_ItemWarehouse
                //List<IM_ItemWarehouse> lsItmWhse = GetItemWarehouses(partToEdit.PartItemCode);
                //foreach (IM_ItemWarehouse itemWhse in lsItmWhse)
                //{
                //    _warehouseList.Add(itemWhse.WarehouseCode);
                //}
                _warehouseList = GetWarehouses();
                foreach (IM_Warehouse whs in _warehouseList)
                {
                    whs.WarehouseDesc = string.Format("{0} - {1}", whs.WarehouseCode, whs.WarehouseDesc);
                }
                // dch rkl 12/01/2016 Get Warehouse List from IM_Warehouse instead of IM_ItemWarehouse END

                // dch rkl 01/23/2017 added Unit of Measure List
                _unitOfMeasureList = App.Database.GetCI_UnitOfMeasureFromDB();
                _unitOfMeasureList.Add(new CI_UnitOfMeasure()
                {
                    UnitOfMeasure = "EACH"
                });
                _unitOfMeasureList.Sort((x, y) => x.UnitOfMeasure.CompareTo(y.UnitOfMeasure));
            }
            catch (Exception ex)
            {
                // dch rkl 12/07/2016 Log Error
                ErrorReporting errorReporting = new ErrorReporting();
                errorReporting.sendException(ex, "TechDashboard.PartsEditPageViewModel(App_WorkTicket workTicket, App_RepairPart partToEdit");
            }
        }
Esempio n. 5
0
 public DataTable SubMenuPermission_IU(SubMenuBase subMenuBase)
 {
     dtContainer = new DataTable();
     try
     {
         MyParameter[] myParams =
         {
             new MyParameter("@RoleID",   subMenuBase.RoleID),
             new MyParameter("@ParentID", subMenuBase.ParentID),
             new MyParameter("@SubMenus", subMenuBase.Roles)
         };
         Common.Set_Procedures("SubMenuPermission_IU");
         Common.Set_ParameterLength(myParams.Length);
         Common.Set_Parameters(myParams);
         dtContainer = Common.Execute_Procedures_LoadData();
     }
     catch (Exception ex)
     {
         ErrorReporting.DataLayerError(ex);
     }
     return(dtContainer);
 }
Esempio n. 6
0
 public DataTable Menus_LoadByRoleId(RoleBase roleBase)
 {
     dtContainer = new DataTable();
     try
     {
         MyParameter[] myParams =
         {
             new MyParameter("@Id",     roleBase.ID),
             new MyParameter("@UserId", roleBase.UserId),
             new MyParameter("@MenuId", roleBase.MenuName),
         };
         Common.Set_Procedures("GetPermissions_ByRoleId");
         Common.Set_ParameterLength(myParams.Length);
         Common.Set_Parameters(myParams);
         dtContainer = Common.Execute_Procedures_LoadData();
     }
     catch (Exception ex)
     {
         ErrorReporting.DataLayerError(ex);
     }
     return(dtContainer);
 }
Esempio n. 7
0
 void Commit()
 {
     // In case of error, the popup can make the control lose focus; we don't want to commit twice.
     if (!this.isCommitting)
     {
         BindingExpression binding = this.GetBindingExpression(ComboBox.TextProperty);
         if (binding != null)
         {
             this.isCommitting = true;
             try
             {
                 binding.UpdateSource();
             }
             catch (ArgumentException exception)
             {
                 ErrorReporting.ShowErrorMessage(exception.Message);
                 binding.UpdateTarget();
             }
             this.isCommitting = false;
         }
     }
 }
Esempio n. 8
0
 public DataTable Login_Load(UserBase userBase)
 {
     dtContainer = new DataTable();
     try
     {
         MyParameter[] myParams =
         {
             new MyParameter("@UserName", userBase.UserName),
             new MyParameter("@Password", userBase.Password),
             new MyParameter("@RoleType", userBase.RoleType)
         };
         Common.Set_Procedures("Login_Load");
         Common.Set_ParameterLength(myParams.Length);
         Common.Set_Parameters(myParams);
         dtContainer = Common.Execute_Procedures_LoadData();
     }
     catch (Exception ex)
     {
         ErrorReporting.DataLayerError(ex);
     }
     return(dtContainer);
 }
        internal void ValidateKey(CorrelationDataWrapper wrapper, string oldKey)
        {
            string newKey = wrapper.Key;

            if (string.IsNullOrEmpty(newKey))
            {
                ErrorReporting.ShowErrorMessage(string.Format(CultureInfo.CurrentCulture, System.Activities.Core.Presentation.SR.NullOrEmptyKeyName));
                wrapper.Key = oldKey;
            }
            else
            {
                // At this point, the key of the entry has already been changed. If there are
                // entries with duplicate keys, the number of those entries is greater than 1.
                // Thus, we only need to check the entry count.
                int entryCount = this.CorrelationInitializeData.Count(entry => entry.Key == newKey);
                if (entryCount > 1)
                {
                    ErrorReporting.ShowErrorMessage(string.Format(CultureInfo.CurrentCulture, System.Activities.Core.Presentation.SR.DuplicateKeyName, newKey));
                    wrapper.Key = oldKey;
                }
            }
        }
Esempio n. 10
0
 public DataTable PicturesVideos_LoadAll(PictureVideosBase pictureVideosBase)
 {
     dtContainer = new DataTable();
     try
     {
         MyParameter[] myParams =
         {
             new MyParameter("@PictureType",   pictureVideosBase.PictureType),
             new MyParameter("@SubFeatureID",  pictureVideosBase.SubFeatureID),
             new MyParameter("@SubFeaturesid", pictureVideosBase.SubFeaturesid)
         };
         Common.Set_Procedures("PicturesVideos_LoadAll");
         Common.Set_ParameterLength(myParams.Length);
         Common.Set_Parameters(myParams);
         dtContainer = Common.Execute_Procedures_LoadData();
     }
     catch (Exception ex)
     {
         ErrorReporting.DataLayerError(ex);
     }
     return(dtContainer);
 }
Esempio n. 11
0
        private void SetException(Exception exception)
        {
            string path      = Log.CurrentLogDirectory;
            var    directory = new DirectoryInfo(path);
            var    log       = directory.GetFiles().OrderByDescending(f => f.LastWriteTime).First();

            var paragraph = Hyperlink("Please open new issue in: ", Constant.Issue);

            paragraph.Inlines.Add($"1. upload log file: {log.FullName}\n");
            paragraph.Inlines.Add($"2. copy below exception message");
            ErrorTextbox.Document.Blocks.Add(paragraph);

            StringBuilder content = new StringBuilder();

            content.AppendLine(ErrorReporting.RuntimeInfo());
            content.AppendLine($"Date: {DateTime.Now.ToString(CultureInfo.InvariantCulture)}");
            content.AppendLine("Exception:");
            content.AppendLine(exception.ToString());
            paragraph = new Paragraph();
            paragraph.Inlines.Add(content.ToString());
            ErrorTextbox.Document.Blocks.Add(paragraph);
        }
Esempio n. 12
0
        /// <summary>Native method for Grace ..</summary>
        /// <param name="ctx">Current interpreter</param>
        /// <param name="self">Receiver of the method</param>
        /// <param name="other">Argument to the method</param>
        private static GraceObject mDotDot(
            EvaluationContext ctx,
            GraceNumber self,
            GraceObject other
            )
        {
            var n = other.FindNativeParent <GraceNumber>();

            if (n == null)
            {
                ErrorReporting.RaiseError(ctx, "R2001",
                                          new Dictionary <string, string> {
                    { "method", ".." },
                    { "index", "1" },
                    { "part", ".." },
                    { "required", "Number" }
                },
                                          "ArgumentTypeError: .. requires a Number argument"
                                          );
            }
            return(new GraceRange(self.Value, n.Value, 1));
        }
Esempio n. 13
0
 private static void ApplicationThreadException(object sender, ThreadExceptionEventArgs e)
 {
     try
     {
         if (e.Exception.Message.IndexOf("NoDriver") != -1)
         {
             //USB audio plugged/ unplugged (typically the cause) - no other way to catch this exception in the volume level control due to limitation in NAudio
         }
         else
         {
             if (MainForm.Conf.Enable_Error_Reporting && _reportedExceptionCount == 0 &&
                 e.Exception != null && e.Exception.Message.Trim() != "")
             {
                 if (_er == null)
                 {
                     _er = new ErrorReporting {
                         UnhandledException = e.Exception
                     };
                     _er.ShowDialog();
                     _er.Dispose();
                     _er = null;
                     _reportedExceptionCount++;
                 }
             }
         }
         MainForm.LogExceptionToFile(e.Exception);
     }
     catch (Exception ex2)
     {
         try
         {
             MainForm.LogExceptionToFile(ex2);
         }
         catch
         {
         }
     }
 }
Esempio n. 14
0
        // [HttpPost]
        public JsonResult IncidentList_print(string type, string startDate, string endDate)
        {
            IncidentListModel        incidentListModel = new IncidentListModel();
            string                   jsonString        = string.Empty;
            List <IncidentListModel> incidentList      = new List <IncidentListModel>();

            try
            {
                IncidentListBase incidentListBase = new IncidentListBase();
                incidentListBase.Type      = type;
                incidentListBase.StartDate = startDate;
                incidentListBase.EndDate   = endDate;

                actionResult = incidentListAction.IncidentList_print(incidentListBase);

                if (actionResult.IsSuccess && actionResult.dtResult.Rows.Count > 0)
                {
                    for (int i = 0; i < actionResult.dtResult.Rows.Count; i++)
                    {
                        jsonString += "<tr><td class='td-border'>" + actionResult.dtResult.Rows[i]["IncidentDate"]
                                      + "</td><td class='td-border'>" + actionResult.dtResult.Rows[i]["Name"] + "</td><td class='td-border'>" + actionResult.dtResult.Rows[i]["NatureOfEvent"]
                                      + "</td><td class='td-border'>" + actionResult.dtResult.Rows[i]["ShortDescriptor"] + "</td><td class='td-border'>" + actionResult.dtResult.Rows[i]["Status"]
                                      + "</td><td class='td-border'>" + actionResult.dtResult.Rows[i]["Location"];
                        jsonString += "</tr>";
                    }
                }
                else
                {
                    jsonString = "fail";
                }
            }
            catch (Exception ex)
            {
                jsonString = "-1";
                ErrorReporting.WebApplicationError(ex);
            }
            return(Json(jsonString, JsonRequestBehavior.AllowGet));
        }
        public ExpensesEditPageViewModel(App_Expense expenseItem)
        {
            // dch rkl 12/07/2016 catch exception
            try
            {
                _expenseItem = expenseItem;

                _unitOfMeasureList = App.Database.GetCI_UnitOfMeasureFromDB();
                _unitOfMeasureList.Add(new CI_UnitOfMeasure()
                {
                    UnitOfMeasure = "EACH"
                });
                _unitOfMeasureList.Sort((x, y) => x.UnitOfMeasure.CompareTo(y.UnitOfMeasure));
                //_expenseItem.Category =
                Initialize();
            }
            catch (Exception ex)
            {
                // dch rkl 12/07/2016 Log Error
                ErrorReporting errorReporting = new ErrorReporting();
                errorReporting.sendException(ex, "TechDashboard.ExpensesEditPageViewModel(App_Expense expenseItem)");
            }
        }
Esempio n. 16
0
        private IEnumerable <ErrorReporting> GetErrorMessages(NumberToken numberToken, bool isSource)
        {
            var messages = new List <ErrorReporting>();

            foreach (var numberPart in numberToken.NumberParts.Where(a => a.Type == NumberPart.NumberType.Invalid))
            {
                var report = new ErrorReporting
                {
                    ErrorMessage         = numberPart.Message,
                    ExtendedErrorMessage = numberPart.Message,
                    ErrorLevel           = GetErrorLevel(),
                    IsHindiVerification  = false,
                    InitialSourceNumber  = isSource ? numberToken.Text : string.Empty,
                    InitialTargetNumber  = !isSource ? numberToken.Text : string.Empty,
                    SourceNumberIssues   = isSource ? numberToken.Text : string.Empty,
                    TargetNumberIssues   = !isSource ? numberToken.Text : string.Empty
                };

                messages.Add(report);
            }

            return(messages);
        }
Esempio n. 17
0
        public static void Run(
            [EventGridTrigger] EventGridEvent eventGridEvent, ILogger log,
            [SendGrid(ApiKey = "SendGridApiKey")] out SendGridMessage message)
        {
            var analysisCompletedEvent = EventGridService.MapToEventType <AnalysisCompletedEvent>(eventGridEvent);
            var userEmail = analysisCompletedEvent.PartitionKey;

            var loadAnalysisResult = AnalysisService.LoadImagaAnalysisData(analysisCompletedEvent.AnalysisResultsId, analysisCompletedEvent.PartitionKey).Result;

            if (!loadAnalysisResult.WasSuccessful)
            {
                ErrorReporting.ReportErrorToClient(loadAnalysisResult.Message);
            }

            var createMessageResult = ClientFeedbackService.CreateAnalysisCompletedEmail(userEmail, loadAnalysisResult.Content).Result;

            if (!createMessageResult.WasSuccessful)
            {
                ErrorReporting.ReportErrorToClient(createMessageResult.Message);
            }

            message = createMessageResult.Content;
        }
Esempio n. 18
0
 /// <inheritdoc/>
 public override GraceObject Respond(
     EvaluationContext ctx,
     GraceObject self,
     MethodRequest req
     )
 {
     checkAccessibility(ctx, req);
     MethodHelper.CheckNoInherits(ctx, req);
     MethodNode.CheckArgCount(ctx, req.Name, req.Name,
                              0, false,
                              req[0].Arguments.Count);
     if (cell.Value == GraceObject.Uninitialised)
     {
         ErrorReporting.RaiseError(ctx, "R2008",
                                   new Dictionary <string, string> {
             { "name", req.Name },
             { "receiver", self.ToString() }
         },
                                   "UninitialisedReadError: Cannot read from " + req.Name
                                   );
     }
     return(cell.Value);
 }
Esempio n. 19
0
        // dch rkl 01/13/2017 Return the ID of the Inserted Part
        //public void AddPartToPartsList()
        public int AddPartToPartsList()
        {
            // dch rkl 01/13/2017 Return the ID of the Inserted Part
            int iId = 0;

            // dch rkl 12/07/2016 catch exception
            try
            {
                // dch rkl 01/13/2017 Return the ID of the Inserted Part
                //App.Database.SaveRepairPart(_partToEdit, _workTicket, App.CurrentTechnician);
                JT_TransactionImportDetail jtDtl = App.Database.SaveRepairPart(_partToEdit, _workTicket, App.CurrentTechnician);
                iId = jtDtl.ID;
            }
            catch (Exception ex)
            {
                // dch rkl 12/07/2016 Log Error
                ErrorReporting errorReporting = new ErrorReporting();
                errorReporting.sendException(ex, "TechDashboard.PartsEditPageViewModel.AddPartToPartsList");
            }

            // dch rkl 01/13/2017 Return the ID of the Inserted Part
            return(iId);
        }
Esempio n. 20
0
        protected void SetPartsList()
        {
            // dch rkl 12/07/2016 catch exception
            try
            {
                List <App_RepairPart> parts = App.Database.RetrievePartsListFromWorkTicket(_workTicket);

                _observablePartsList.Clear();
                if (parts != null)
                {
                    foreach (App_RepairPart part in parts)
                    {
                        _observablePartsList.Add(part);
                    }
                }
            }
            catch (Exception ex)
            {
                // dch rkl 12/07/2016 Log Error
                ErrorReporting errorReporting = new ErrorReporting();
                errorReporting.sendException(ex, "TechDashboard.PartsListPageViewModel.SetPartsList");
            }
        }
Esempio n. 21
0
        private static GraceObject mConcat(EvaluationContext ctx,
                                           MethodRequest req,
                                           ByteString self)
        {
            MethodHelper.CheckArity(ctx, req, 1);
            var oth = req[0].Arguments[0].FindNativeParent <ByteString>();

            if (oth == null)
            {
                ErrorReporting.RaiseError(ctx, "R2001",
                                          new Dictionary <string, string> {
                    { "method", req.Name },
                    { "index", "1" },
                    { "part", req.Name },
                    { "required", "byte string" },
                }, "ArgumentTypeError: Needed byte string");
            }
            var d2 = new byte[self.data.Length + oth.data.Length];

            self.data.CopyTo(d2, 0);
            oth.data.CopyTo(d2, self.data.Length);
            return(new ByteString(d2));
        }
Esempio n. 22
0
        /// <inheritdoc/>
        /// <remarks>This method uses the indexer on the LocalScope
        /// object the method was requested on.</remarks>
        public override GraceObject Respond(EvaluationContext ctx, GraceObject self, MethodRequest req)
        {
            checkAccessibility(ctx, req);
            MethodHelper.CheckNoInherits(ctx, req);
            MethodNode.CheckArgCount(ctx, req.Name, req.Name,
                                     0, false,
                                     req[0].Arguments.Count);
            LocalScope s    = self as LocalScope;
            string     name = req.Name;

            if (s[name] == GraceObject.Uninitialised ||
                s[name] == null)
            {
                ErrorReporting.RaiseError(ctx, "R2008",
                                          new Dictionary <string, string> {
                    { "name", name },
                    { "receiver", ToString() }
                },
                                          "UninitialisedReadError: Cannot read from «" + name + "»"
                                          );
            }
            return(s[name]);
        }
Esempio n. 23
0
        private static bool CanDragStart(object parameter)
        {
            var canStartDrag = false;

#if WIN
            var mouseEventArgs = (System.Windows.Input.MouseEventArgs)parameter;
            var dragSource     = mouseEventArgs.Source as System.Windows.Controls.ItemsControl;
            if ((dragSource != null) && dragSource.IsMouseCaptured)
            {
                if (dragSource is System.Windows.Controls.ListView)
                {
                    var items = ((System.Windows.Controls.ListView)dragSource).SelectedItems;
                    canStartDrag = (items != null) && (items.Count > 0);
                }
                else if (dragSource is System.Windows.Controls.TreeView)
                {
                }
            }
#elif MAC
            ErrorReporting.ReportNotImplementedError("MultiSelectDragStartCommand.CanDragStart");
#endif // WIN
            return(canStartDrag);
        }
Esempio n. 24
0
        /// <inheritdoc />
        public Node Visit(BindParseNode bpn)
        {
            var ret   = bpn.Left.Visit(this);
            var right = bpn.Right.Visit(this);
            var lrrn  = ret as RequestNode;

            if (lrrn != null)
            {
                lrrn.MakeBind(right);
                if (bpn.Left is OperatorParseNode ||
                    bpn.Left is InterpolatedStringParseNode)
                {
                    lrrn = null;
                }
            }
            if (lrrn == null)
            {
                var name = ret.GetType().Name;
                name = name.Substring(0, name.Length - 4);
                if (bpn.Left is OperatorParseNode)
                {
                    name = "Operator";
                }
                if (bpn.Left is InterpolatedStringParseNode)
                {
                    name = "StringLiteral";
                }
                ErrorReporting.ReportStaticError(bpn.Token.Module,
                                                 bpn.Line, "P1044",
                                                 new Dictionary <string, string> {
                    { "lhs", name }
                },
                                                 "Cannot assign to " + name);
            }
            return(ret);
        }
        private int CheckConstraint([NotNull] ZRangeFeature minFeature,
                                    [NotNull] ZRangeFeature maxFeature,
                                    [NotNull] IntersectionGeometryProvider geometryProvider,
                                    double zDifference)
        {
            string conditionMessage;
            bool   fulFilled = IsZRelationConditionFulfilled(
                maxFeature.Feature, maxFeature.TableIndex,
                minFeature.Feature, minFeature.TableIndex,
                zDifference,
                out conditionMessage);

            if (fulFilled)
            {
                return(NoError);
            }

            IGeometry errorGeometry = geometryProvider.Geometry;

            return(ErrorReporting.Report(conditionMessage, errorGeometry,
                                         Codes[Code.ConstraintNotFulfilled], null,
                                         maxFeature.Feature,
                                         minFeature.Feature));
        }
Esempio n. 26
0
        public JsonResult MessageGroups_DeleteByGroup(string GroupName)
        {
            string json = string.Empty;

            try
            {
                messageGroupBase.GroupName = GroupName;
                actionResult = messagesAction.MessageGroups_DeleteByGroup(messageGroupBase);
                if (actionResult.IsSuccess)
                {
                    json = "success";
                }
                else
                {
                    json = "fail";
                }
            }
            catch (Exception ex)
            {
                json = "-1";
                ErrorReporting.WebApplicationError(ex);
            }
            return(Json(json, JsonRequestBehavior.AllowGet));
        }
Esempio n. 27
0
        /// <summary>Native method for Grace orElse</summary>
        /// <param name="ctx">Current interpreter</param>
        /// <param name="other">Block to apply if false</param>
        public GraceObject OrElse(EvaluationContext ctx, GraceObject other)
        {
            var oth = other as GraceBlock;

            if (oth == null)
            {
                ErrorReporting.RaiseError(ctx, "R2001",
                                          new Dictionary <string, string>()
                {
                    { "method", "orElse" },
                    { "index", "1" },
                    { "part", "ifFalse" },
                    { "required", "Block" }
                },
                                          "ArgumentTypeError: orElse requires a block argument"
                                          );
            }
            if (!Boolean)
            {
                var req = MethodRequest.Nullary("apply");
                return(other.Request(ctx, req));
            }
            return(True);
        }
Esempio n. 28
0
 void LoadBindings()
 {
     try
     {
         this.bindingElements.Add(new BindingDescriptor {
             BindingName = (string)(this.TryFindResource("bindingEditorEmptyBindingLabel") ?? "none"), Value = null
         });
         Configuration            machineConfig = ConfigurationManager.OpenMachineConfiguration();
         ServiceModelSectionGroup section       = ServiceModelSectionGroup.GetSectionGroup(machineConfig);
         if (null != section && null != section.Bindings)
         {
             this.bindingElements.AddRange(section.Bindings.BindingCollections
                                           .OrderBy(p => p.BindingName)
                                           .Select <BindingCollectionElement, BindingDescriptor>(p => new BindingDescriptor()
             {
                 BindingName = p.BindingName, Value = p
             }));
         }
     }
     catch (ConfigurationErrorsException err)
     {
         ErrorReporting.ShowErrorMessage(err.Message);
     }
 }
Esempio n. 29
0
        private void OnCancelOrDeleteClick(object sender, RoutedEventArgs e)
        {
            ErrorReporting.Log("OnCancelOrDeleteClick");

            var downloadInfo = (DownloadInfo)((Button)sender).DataContext;

            ErrorReporting.Log("Course = " + downloadInfo.CourseTopicName + " [" + downloadInfo.CourseId + "] Lecture = " + downloadInfo.LectureTitle + " [" + downloadInfo.LectureId + "]");

            var monitor = downloadInfo.Monitor;

            if (monitor != null)
            {
                ErrorReporting.Log("Cancelling Download");
                monitor.RequestCancel();
                inProgress.Remove(downloadInfo);
            }
            else
            {
                ErrorReporting.Log("Deleting Video");
                downloadInfo.DeleteVideo();
                completed.Remove(downloadInfo);
            }
            RefreshEmptyMessagesVisibility();
        }
Esempio n. 30
0
        // dch rkl 11/15/2016 Add clock out date
        // dch rkl 01/23/2017 Check value of CaptureTimeInTimeTracker to see if hours or timespan is entered
        // dch rkl 01/23/2017 Include Service Agreement Code
        // bk  rkl 01/26/2017 adjust to only include transaction date
        public void ClockOut(TimeSpan departTime, JT_TechnicianStatus technicianStatus, JT_MiscellaneousCodes serviceTicketStatus,
                             JT_ActivityCode activityCode, string departmentWorked, JT_EarningsCode earningsCode, double hoursBilled,
                             double meterReading, string workPerformedText, string clockOutDate, string captureTimeInTimeTracker,
                             double hoursWorked, string svcAgmtContractCode)
        {
            // dch rkl 12/07/2016 catch exception
            try
            {
                if (captureTimeInTimeTracker == "Y")
                {
                    // dch rkl 11/15/2016 Add clock out date
                    //DateTime clockOutTime = DateTime.Today;
                    DateTime clockOutTime = DateTime.Parse(clockOutDate);

                    clockOutTime = clockOutTime.Add(departTime);

                    // dch rkl 02/03/2017 Include clockOutDate
                    //App.Database.ClockOut(App.CurrentTechnician, _workTicket, clockOutTime, technicianStatus, serviceTicketStatus,
                    //    activityCode.ActivityCode, departmentWorked, earningsCode, hoursBilled, meterReading, workPerformedText, svcAgmtContractCode);
                    App.Database.ClockOut(App.CurrentTechnician, _workTicket, clockOutTime, technicianStatus, serviceTicketStatus,
                                          activityCode.ActivityCode, departmentWorked, earningsCode, hoursBilled, meterReading, workPerformedText,
                                          svcAgmtContractCode, clockOutDate);
                }
                else
                {
                    App.Database.ClockOut(App.CurrentTechnician, _workTicket, technicianStatus, serviceTicketStatus, activityCode.ActivityCode,
                                          departmentWorked, earningsCode, hoursBilled, meterReading, workPerformedText, hoursWorked, svcAgmtContractCode);
                }
            }
            catch (Exception ex)
            {
                // dch rkl 12/07/2016 Log Error
                ErrorReporting errorReporting = new ErrorReporting();
                errorReporting.sendException(ex, "TechDashboard.BlockOutPageViewModel.ClockOut()");
            }
        }