Esempio n. 1
0
 public AgreementException(StatusType status, FaultType fault, CommonOutputType commonOutput, RecordCommonOutputType recordCommonOutput)
     : base(status.Code == "200" || status.Code == "400" ? fault.Message.Value : status.Message.Single().Value)
 {
     this.status = status;
     this.fault = fault;
     this.commonOutput = commonOutput;
     this.recordCommonOutput = recordCommonOutput;
 }
Esempio n. 2
0
 public Fault(JsonObject fault)
 {
     JsonArray detail = (JsonArray)fault["detail"];
     m_details = String.Join("\n",(string[]) detail.ToArray());
     m_error_string = (string) fault["string"];
     m_fault_type = (string)fault["code"]=="server"?FaultType.ServerFault:FaultType.ClientFault;
     m_filename = (string)fault["filename"];
     m_lineno = ((JsonNumber)fault["lineno"]).ToInt32();
 }
Esempio n. 3
0
        public string CreateNewFault(string role,string address, FaultType faultType)
        {
            if (iFaulValidationService.FaultAlreadyCaptured(address, faultType))
                throw new DomainException("Fault has already been captured");
            var fault = Fault.CaptureFault(role, address, faultType);

            //Commit to database

            return fault.ReferenceNumber;
        }
Esempio n. 4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ErrorInfo"/> class.
        /// </summary>
        /// <param name="exception">The exception.</param>
        /// <param name="faultType">Type of the fault.</param>
        private ErrorInfo( Exception exception, FaultType faultType )
        {
            this.Message = exception.Message;
            this.StackTrace = exception.StackTrace;
            this.Type = exception.GetType().ToString();
            this.FaultType = faultType;

            if( exception.InnerException != null )
            {
                this.InnerError = new ErrorInfo( exception.InnerException, faultType );
            }
        }
Esempio n. 5
0
File: Fault.cs Progetto: Eyakem/RNM
        public static Fault CaptureFault(string role, string address, FaultType faultType)
        {
            if (role != "Agent")
                throw new DomainException("User is not supposed to create a new fault.");

            return new Fault()
            {
                FaultId = new Guid(),
                ReferenceNumber = GenerateReferenceNumber(),
                FaultType = faultType,
                Address = address
            };
        }
Esempio n. 6
0
        public FaultCell(FaultType faultType)
        {
            if (_imgNone == null)
            {
                _imgNone = Util.LoadImage("LEDgreenOn.png");
                _imgGrey = Util.LoadImage("LEDgreyOff.png");
                _imgRed = Util.LoadImage("LEDredOn.png");
            }
            HorizontalAlignment = HorizontalAlignment.Center;
            VerticalAlignment = VerticalAlignment.Center;
            Stretch = Stretch.None;//.Uniform;

            _faultType = faultType;
            UpdateImage();
        }
Esempio n. 7
0
        private ThermoClickSensorData ReadData()
        {
            var sensorBytes = new byte[4];

            Hardware.SPIBus.WriteRead(spiConfiguration, new Byte[] { 0xFF }, sensorBytes);

            // Check for sensor faults
            FaultType sensorFaults = CheckForSensorFaults(sensorBytes);
            var       fault        = FaultType.NoFault;

            if (sensorFaults == FaultType.NoFault)
            {
                return(new ThermoClickSensorData(sensorBytes));
            }

            switch (sensorFaults)
            {
            case FaultType.OpenFault:
                fault = FaultType.OpenFault;
                break;

            case FaultType.ShortToGround:
                fault = FaultType.ShortToGround;
                break;

            case FaultType.ShortToVcc:
                fault = FaultType.ShortToVcc;
                break;
            }

            // If we have a sensor fault raise the SensorFault Event and return nothing.
            SensorFaultEventHandler tempEvent = SensorFault;

            if (tempEvent != null)
            {
                tempEvent(this, fault);
            }
            return(new ThermoClickSensorData(new byte[] { 0xFF, 0xFF, 0xFF, 0xFF }));
        }
Esempio n. 8
0
        /// <summary>
        /// 更新access数据库中创单状态
        /// </summary>
        /// <param name="accessID"></param>
        /// <returns></returns>
        public static bool UpdateIsCreate(int accessID, FaultType _type)
        {
            string sql = "update CallLogTable set IsDisposed = @IsDisposed where ID = @ID";//and StartDate = @StartDate order by ID desc";

            OleDbParameter[] para =
            {
                new OleDbParameter("@IsDisposed", OleDbType.Integer),
                new OleDbParameter("@ID",         OleDbType.Integer),
            };
            para[0].Value = Convert.ToInt32(GetState(_type));;
            para[1].Value = accessID;

            int rows = AccessHelper.ExecuteNonQuery(sql, para);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 9
0
        public ActionResult CreateNew(string name, string explanation, string releated)
        {
            DatabaseContext db        = new DatabaseContext();
            FaultType       FaultType = new FaultType();
            int             Eid       = Convert.ToInt32(Session["EmployeeID"]);
            Employee        employee  = db.Employees.Where(x => x.EmployeeID == Eid).FirstOrDefault();

            if (employee != null)
            {
                FaultType.Explanation       = explanation;
                FaultType.CreateDate        = DateTime.Now;
                FaultType.CreateEmployee    = employee;
                FaultType.RelatedDepartment = releated;
                FaultType.Status            = "Active";
                FaultType.Name = name;
                db.FaultTypes.Add(FaultType);
                db.SaveChanges();
            }
            else
            {
                return(RedirectToAction("Login", "Employee"));
            }
            return(RedirectToAction("FaultTypes", "FaultType"));
        }
Esempio n. 10
0
        static public SoapException GetSoapException(FaultType faultType, string message)
        {
            SoapException res = null;

            switch (faultType)
            {
            case FaultType.General:
            {
                System.Xml.XmlQualifiedName code    = SoapException.ClientFaultCode;
                SoapFaultSubCode            subCode = null;
                res = new SoapException(message, code, subCode);
                break;
            }

            case FaultType.Custom:
            {
                System.Xml.XmlQualifiedName code    = SoapException.ClientFaultCode;
                SoapFaultSubCode            subCode = null;
                res = new SoapException(message, code, subCode);
                break;
            }
            }
            return(res);
        }
Esempio n. 11
0
        /// <summary>
        /// 创建故障单
        /// </summary>
        /// <param name="fdm"></param>
        /// <returns></returns>
        public static bool CreateOrder(FaultDataModel fdm, FaultType _type, bool _IsInsert)
        {
            string sql  = string.Empty;
            int    rows = 0;

            //只有当未接听的时候才插入,否则都是更新
            #region postgreSQL

            /*
             * if (_IsInsert)
             * {
             *  sql = "insert into call_log(date,start_time,during_time,phone,note,file_path,line_no,chan_id,user_id,asset_type_id,breakdown_categ,company_id,address,state,work_property,department_id,knowledge_id,note_result,source_id)" +
             *  " values(@date,@start_time,@during_time,@phone,@note,@file_path,@line_no,@chan_id,@user_id,@asset_type_id,@breakdown_categ,@company_id,@address,@state,@work_property,@department_id,@knowledge_id,@note_result,@source_id)";
             *  NpgsqlParameter[] para = {
             *                           new NpgsqlParameter("@date",  NpgsqlDbType.Date),
             *                           new NpgsqlParameter("@start_time",NpgsqlDbType.Varchar),
             *                           new NpgsqlParameter("@during_time",  NpgsqlDbType.Varchar),
             *                           new NpgsqlParameter("@phone",NpgsqlDbType.Varchar),
             *                           new NpgsqlParameter("@note",  NpgsqlDbType.Varchar),
             *                           new NpgsqlParameter("@file_path",  NpgsqlDbType.Varchar),
             *                           new NpgsqlParameter("@line_no",  NpgsqlDbType.Varchar),
             *                           new NpgsqlParameter("@chan_id",NpgsqlDbType.Integer),
             *                           new NpgsqlParameter("@user_id",  NpgsqlDbType.Integer),
             *                           new NpgsqlParameter("@asset_type_id",NpgsqlDbType.Integer),
             *                           new NpgsqlParameter("@breakdown_categ",NpgsqlDbType.Varchar),
             *                           new NpgsqlParameter("@company_id",NpgsqlDbType.Integer),
             *                           new NpgsqlParameter("@address",NpgsqlDbType.Varchar),
             *                           new NpgsqlParameter("@state",NpgsqlDbType.Varchar),
             *                           new NpgsqlParameter("@work_property",NpgsqlDbType.Varchar),
             *                           new NpgsqlParameter("@department_id",NpgsqlDbType.Integer),
             *                           new NpgsqlParameter("@knowledge_id",NpgsqlDbType.Integer),
             *                           new NpgsqlParameter("@note_result",NpgsqlDbType.Varchar),
             *                           new NpgsqlParameter("@source_id",NpgsqlDbType.Integer),
             *                      };
             *  para[0].Value = fdm.StartDate;
             *  para[1].Value = fdm.StartTime;
             *  para[2].Value = fdm.DuringTime;
             *  para[3].Value = fdm.CallerID;
             *  para[4].Value = fdm.note;
             *  para[5].Value = fdm.WaveFilePath;
             *  para[6].Value = fdm.LineID;
             *  para[7].Value = fdm.Chan;
             *  para[8].Value = fdm.user_id;
             *  para[9].Value = fdm.asset_type_id;
             *  para[10].Value = fdm.breakdown_categ;
             *  para[11].Value = fdm.company_id;
             *  para[12].Value = fdm.address;
             *  para[13].Value = GetState(_type);
             *  para[14].Value = fdm.work_property;
             *  para[15].Value = fdm.department_id;
             *  para[16].Value = fdm.knowledge_id;
             *  para[17].Value = fdm.note_result;
             *  para[18].Value = fdm.ID;
             *
             *  rows = PostgresqlHelper.ExecuteNonQuery(sql, para);
             * }
             * else
             * {
             *  sql = "update call_log set note=@note,user_id=@user_id,asset_type_id=@asset_type_id,breakdown_categ=@breakdown_categ,company_id=@company_id,address=@address,state=@state,"
             + "work_property=@work_property,department_id=@department_id,knowledge_id=@knowledge_id,note_result=@note_result where source_id=@source_id and phone=@phone";
             +  NpgsqlParameter[] para = {
             +
             +                           new NpgsqlParameter("@phone",NpgsqlDbType.Varchar),
             +                           new NpgsqlParameter("@note",  NpgsqlDbType.Varchar),
             +                           new NpgsqlParameter("@user_id",  NpgsqlDbType.Integer),
             +                           new NpgsqlParameter("@asset_type_id",NpgsqlDbType.Integer),
             +                           new NpgsqlParameter("@breakdown_categ",NpgsqlDbType.Varchar),
             +                           new NpgsqlParameter("@company_id",NpgsqlDbType.Integer),
             +                           new NpgsqlParameter("@address",NpgsqlDbType.Varchar),
             +                           new NpgsqlParameter("@state",NpgsqlDbType.Varchar),
             +                           new NpgsqlParameter("@work_property",NpgsqlDbType.Varchar),
             +                           new NpgsqlParameter("@department_id",NpgsqlDbType.Integer),
             +                           new NpgsqlParameter("@knowledge_id",NpgsqlDbType.Integer),
             +                           new NpgsqlParameter("@note_result",NpgsqlDbType.Varchar),
             +                           new NpgsqlParameter("@source_id",NpgsqlDbType.Integer),
             +                      };
             +  para[0].Value = fdm.CallerID;
             +  para[1].Value = fdm.note;
             +  para[2].Value = fdm.user_id;
             +  para[3].Value = fdm.asset_type_id;
             +  para[4].Value = fdm.breakdown_categ;
             +  para[5].Value = fdm.company_id;
             +  para[6].Value = fdm.address;
             +  para[7].Value = GetState(_type);
             +  para[8].Value = fdm.work_property;
             +  para[9].Value = fdm.department_id;
             +  para[10].Value = fdm.knowledge_id;
             +  para[11].Value = fdm.note_result;
             +  para[12].Value = fdm.ID;
             +
             +  rows = PostgresqlHelper.ExecuteNonQuery(sql, para);
             + }*/
            #endregion

            //sqlserver
            if (_IsInsert)
            {
                sql = "insert into call_log(date,start_time,during_time,phone,note,file_path,line_no,chan_id,user_id,asset_type_id,breakdown_categ,company_id,address,state,work_property,department_id,knowledge_id,note_result,source_id)" +
                      " values(@date,@start_time,@during_time,@phone,@note,@file_path,@line_no,@chan_id,@user_id,@asset_type_id,@breakdown_categ,@company_id,@address,@state,@work_property,@department_id,@knowledge_id,@note_result,@source_id)";
                MySqlParameter[] para =
                {
                    new MySqlParameter("@date",            MySqlDbType.Date),
                    new MySqlParameter("@start_time",      MySqlDbType.VarChar),
                    new MySqlParameter("@during_time",     MySqlDbType.VarChar),
                    new MySqlParameter("@phone",           MySqlDbType.VarChar),
                    new MySqlParameter("@note",            MySqlDbType.VarChar),
                    new MySqlParameter("@file_path",       MySqlDbType.VarChar),
                    new MySqlParameter("@line_no",         MySqlDbType.VarChar),
                    new MySqlParameter("@chan_id",         MySqlDbType.Int32),
                    new MySqlParameter("@user_id",         MySqlDbType.Int32),
                    new MySqlParameter("@asset_type_id",   MySqlDbType.Int32),
                    new MySqlParameter("@breakdown_categ", MySqlDbType.VarChar),
                    new MySqlParameter("@company_id",      MySqlDbType.Int32),
                    new MySqlParameter("@address",         MySqlDbType.VarChar),
                    new MySqlParameter("@state",           MySqlDbType.VarChar),
                    new MySqlParameter("@work_property",   MySqlDbType.VarChar),
                    new MySqlParameter("@department_id",   MySqlDbType.Int32),
                    new MySqlParameter("@knowledge_id",    MySqlDbType.Int32),
                    new MySqlParameter("@note_result",     MySqlDbType.VarChar),
                    new MySqlParameter("@source_id",       MySqlDbType.Int32),
                };
                para[0].Value  = fdm.StartDate;
                para[1].Value  = fdm.StartTime;
                para[2].Value  = fdm.DuringTime;
                para[3].Value  = fdm.CallerID;
                para[4].Value  = fdm.note;
                para[5].Value  = fdm.WaveFilePath;
                para[6].Value  = fdm.LineID;
                para[7].Value  = fdm.Chan;
                para[8].Value  = fdm.user_id;
                para[9].Value  = fdm.asset_type_id;
                para[10].Value = fdm.breakdown_categ;
                para[11].Value = fdm.company_id;
                para[12].Value = fdm.address;
                para[13].Value = GetState(_type);
                para[14].Value = fdm.work_property;
                para[15].Value = fdm.department_id;
                para[16].Value = fdm.knowledge_id;
                para[17].Value = fdm.note_result;
                para[18].Value = fdm.ID;

                rows = MySqlHelperClass.ExecuteNonQuery(MySqlHelperClass.GetConn(), System.Data.CommandType.Text, sql, para);
            }
            else
            {
                sql = "update call_log set note=@note,user_id=@user_id,asset_type_id=@asset_type_id,breakdown_categ=@breakdown_categ,company_id=@company_id,address=@address,state=@state,"
                      + "work_property=@work_property,department_id=@department_id,knowledge_id=@knowledge_id,note_result=@note_result where source_id=@source_id and phone=@phone";
                MySqlParameter[] para =
                {
                    new MySqlParameter("@phone",           MySqlDbType.VarChar),
                    new MySqlParameter("@note",            MySqlDbType.VarChar),
                    new MySqlParameter("@user_id",         MySqlDbType.Int32),
                    new MySqlParameter("@asset_type_id",   MySqlDbType.Int32),
                    new MySqlParameter("@breakdown_categ", MySqlDbType.VarChar),
                    new MySqlParameter("@company_id",      MySqlDbType.Int32),
                    new MySqlParameter("@address",         MySqlDbType.VarChar),
                    new MySqlParameter("@state",           MySqlDbType.VarChar),
                    new MySqlParameter("@work_property",   MySqlDbType.VarChar),
                    new MySqlParameter("@department_id",   MySqlDbType.Int32),
                    new MySqlParameter("@knowledge_id",    MySqlDbType.Int32),
                    new MySqlParameter("@note_result",     MySqlDbType.VarChar),
                    new MySqlParameter("@source_id",       MySqlDbType.Int32),
                };
                para[0].Value  = fdm.CallerID;
                para[1].Value  = fdm.note;
                para[2].Value  = fdm.user_id;
                para[3].Value  = fdm.asset_type_id;
                para[4].Value  = fdm.breakdown_categ;
                para[5].Value  = fdm.company_id;
                para[6].Value  = fdm.address;
                para[7].Value  = GetState(_type);
                para[8].Value  = fdm.work_property;
                para[9].Value  = fdm.department_id;
                para[10].Value = fdm.knowledge_id;
                para[11].Value = fdm.note_result;
                para[12].Value = fdm.ID;

                rows = MySqlHelperClass.ExecuteNonQuery(MySqlHelperClass.GetConn(), System.Data.CommandType.Text, sql, para);
            }



            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 12
0
        public async Task QueueItemAsync(RequestedModel request, string id, RequestType type, FaultType faultType, string description = null)
        {
            //Ensure there is not a duplicate queued item
            var existingItem = await RequestQueue.CustomAsync(async connection =>
            {
                connection.Open();
                var result = await connection.QueryAsync <RequestQueue>("select * from RequestFaultQueue where PrimaryIdentifier = @ProviderId", new { ProviderId = id });

                return(result);
            });

            if (existingItem.FirstOrDefault() != null)
            {
                // It's already in the queue
                return;
            }

            var queue = new RequestQueue
            {
                Type              = type,
                Content           = ByteConverterHelper.ReturnBytes(request),
                PrimaryIdentifier = id,
                FaultType         = faultType,
                Message           = description ?? string.Empty
            };
            await RequestQueue.InsertAsync(queue);
        }
Esempio n. 13
0
        /// <summary>
        /// Create fault message with fault xlang message and request xlang message
        /// </summary>
        /// <param name="faultMsg"></param>
        /// <param name="requestMsg"></param>
        /// <param name="faultType"></param>
        /// <returns></returns>
        public static XLANGMessage CreateFaultMessage(XLANGMessage faultMsg, XLANGMessage requestMsg, FaultType faultType)
        {
            string faultXml = faultMsg != null ? ((XmlDocument)faultMsg[0].RetrieveAs(typeof(XmlDocument))).OuterXml.ToString() : string.Empty;
            string reqXml   = requestMsg != null ? ((XmlDocument)requestMsg[0].RetrieveAs(typeof(XmlDocument))).OuterXml.ToString() : string.Empty;

            XLANGMessage result = GetFaultMessage(faultXml, reqXml, faultType);

            object obj = GetMsgProperty(faultMsg, typeof(BTS.SPName));

            if (obj != null)
            {
                SetMsgProperty(result, typeof(BTS.SPName), obj.ToString());
            }

            obj = GetMsgProperty(faultMsg, typeof(BTS.InboundTransportLocation));
            if (obj != null)
            {
                SetMsgProperty(result, typeof(BTS.InboundTransportLocation), obj.ToString());
            }

            return(result);
        }
Esempio n. 14
0
        /// <summary>
        /// Handle fault
        /// </summary>
        /// <param name="xlangMsg"></param>
        /// <param name="faultType"></param>
        public static void HandleFault(XLANGMessage xlangMsg, string btsMsgType, FaultType faultType)
        {
            string eventMessage       = string.Empty;
            string serviceName        = string.Empty;
            string serviceType        = string.Empty;
            string transportLocation  = string.Empty;
            string transportDirection = string.Empty;
            string description        = string.Empty;
            Stream faultStream        = null;;

            try
            {
                faultStream = (Stream)xlangMsg[0].RetrieveAs(typeof(Stream));

                if (faultType == FaultType.DeliveryException)
                {
                    serviceName = GetMsgProperty(xlangMsg, typeof(ErrorReport.SendPortName));
                    description = GetMsgProperty(xlangMsg, typeof(ErrorReport.Description));
                    if (!string.IsNullOrEmpty(serviceName))
                    {
                        serviceType        = "Send";
                        transportLocation  = GetMsgProperty(xlangMsg, typeof(ErrorReport.OutboundTransportLocation)).ToString();
                        transportDirection = "Outbound";
                    }
                    else
                    {
                        serviceName        = GetMsgProperty(xlangMsg, typeof(ErrorReport.ReceivePortName));
                        serviceType        = "Receive";
                        transportLocation  = GetMsgProperty(xlangMsg, typeof(ErrorReport.InboundTransportLocation));
                        transportDirection = "Inbound";
                    }

                    eventMessage = String.Format("A message of type '{0}' could not be routed by BizTalk.", btsMsgType) + Environment.NewLine +
                                   String.Format("{0} Port = {1}", serviceType, serviceName) + Environment.NewLine +
                                   String.Format("{0} Transport Location = {1}", transportDirection, transportLocation) + Environment.NewLine +
                                   description;
                }
                else if (faultType == FaultType.SoapException)
                {
                    serviceName       = GetMsgProperty(xlangMsg, typeof(BTS.SPName));
                    transportLocation = GetMsgProperty(xlangMsg, typeof(BTS.InboundTransportLocation));

                    eventMessage = "A SOAP Fault message was encountered by BizTalk." + Environment.NewLine +
                                   String.Format("Send Port = {0}", serviceName) + Environment.NewLine +
                                   String.Format("Outbound Transport Location = {0}", transportLocation) + Environment.NewLine + Environment.NewLine +
                                   "Refer 'FaultMsgBody' node in the archived message for more details.";
                }
                else
                {
                    serviceName = GetMsgProperty(xlangMsg, typeof(Microsoft.BizTalk.XLANGs.BTXEngine.SendingOrchestrationType));
                    serviceName = serviceName.Contains(",") ? serviceName.Substring(0, serviceName.IndexOf(",")) : serviceName;

                    eventMessage = "A System Exception was encountered by BizTalk " + Environment.NewLine +
                                   String.Format("Orchestration Name = {0}", serviceName) + Environment.NewLine + Environment.NewLine +
                                   "Refer 'FaultMsgBody' node in the archived message for more details.";
                }

                eventMessage += Environment.NewLine + Environment.NewLine + "================= Archived Message =================" + Environment.NewLine + Environment.NewLine;

                StreamReader reader = new StreamReader(faultStream);
                eventMessage += reader.ReadToEnd() + Environment.NewLine;

                eventMessage += Environment.NewLine + "================= Context Properties =================" + Environment.NewLine;

                foreach (DictionaryEntry dictionary in GetContext(xlangMsg))
                {
                    XmlQName qName = (XmlQName)dictionary.Key;
                    eventMessage += qName.Namespace + "#" + qName.Name + " : " + dictionary.Value.ToString() + Environment.NewLine;
                }

                EsbFaultEvent faultEvent = ExceptionEventDetails.Instance.ExceptionEvents.FirstOrDefault <EsbFaultEvent>
                                               (e => e.FaultSvcName.Equals(serviceName, StringComparison.OrdinalIgnoreCase) &&
                                               e.FaultType.Equals(faultType.ToString(), StringComparison.OrdinalIgnoreCase));

                if (faultEvent != null)
                {
                    Logger.WriteEvent(faultEvent.EventSource, eventMessage, (EventLogEntryType)Enum.Parse(typeof(EventLogEntryType), faultEvent.EventType), faultEvent.EventId);
                }
                else
                {
                    throw new Exception(string.Format("'{0}' fault is not configured for the service '{1}' in [AvistaESBLookup].[dbo].[EsbFaultEvents] table", faultType.ToString(), serviceName));
                }
            }
            catch (Exception ex)
            {
                eventMessage = "A Fault was encountered by BizTalk and a further error occurred while handling the message. " + Environment.NewLine + "Error Details: " + ex.ToString()
                               + Environment.NewLine + Environment.NewLine + "Original Fault Details: " + Environment.NewLine + eventMessage;

                Logger.WriteError(eventMessage, 14004);
            }
            finally
            {
                if (xlangMsg != null)
                {
                    xlangMsg.Dispose();
                    xlangMsg = null;
                }
                if (faultStream != null)
                {
                    faultStream = null;
                }
            }
        }
Esempio n. 15
0
 public FaultsForm(FaultType ft)
 {
     this.ft = ft;
     InitializeComponent();
 }
Esempio n. 16
0
 /// <summary>
 /// Builds a new ErrorInfo instance from the given exception.
 /// </summary>
 /// <param name="source">The source excection.</param>
 /// <param name="type">The type of fault.</param>
 /// <returns>
 /// The ErrorInfo instance that represents the given source exception.
 /// </returns>
 public static ErrorInfo FromException( Exception source, FaultType type )
 {
     return new ErrorInfo( source, type );
 }
Esempio n. 17
0
 public void OnUserHideOrClosing()
 {
     ChildTreeLeftItems.Clear();
     FaultType.Clear();
 }
        // Get the voltage used in double-ended fault calculations for this cycle, based on the fault type.
        private static ComplexNumber GetDoubleEndedFaultVoltage(CycleData cycle, FaultType faultType)
        {
            ComplexNumber[] sequenceComponents;

            sequenceComponents = CycleData.CalculateSequenceComponents(cycle.AN.V, cycle.BN.V, cycle.CN.V);

            if (faultType == FaultType.ABC)
                return sequenceComponents[1];

            return sequenceComponents[2];
        }
Esempio n. 19
0
 public FaultException(FaultType fType)
 {
     this.Type = fType;
 }
Esempio n. 20
0
        public ActionResult Detail(int?FaultID, string IamWorking, string Passive, string Denied, string DifferentCompanyWorking, string SuccessfullyCompleted, string SituationCouldnotBeResolved, Fault model, string edit)
        {
            DatabaseContext db       = new DatabaseContext();
            Fault           Fault    = db.Faults.Where(x => x.FaultID == FaultID).FirstOrDefault();
            int             Eid      = Convert.ToInt32(Session["EmployeeID"]);
            Employee        employee = db.Employees.Where(x => x.EmployeeID == Eid).FirstOrDefault();

            if ((Fault != null) && (employee != null))
            {
                string controlClicked = string.Empty;
                if (!string.IsNullOrEmpty(Passive))
                {
                    Fault.FaultStatus = "Passive";
                    db.SaveChanges();
                    return(RedirectToAction("Faults", "Fault"));
                }
                if (!string.IsNullOrEmpty(edit))
                {
                    FaultType FaultType = db.FaultTypes.Where(x => x.FaultTypeID == model.FaultTypeID).FirstOrDefault();
                    Location  Location  = db.Locations.Where(x => x.LocationID == model.LocationID).FirstOrDefault();
                    Fault.FaultType               = FaultType;
                    Fault.Explanation             = model.Explanation;
                    Fault.Location                = Location;
                    Fault.IntendedMaintenanceTime = model.IntendedMaintenanceTime;
                    db.SaveChanges();
                    return(RedirectToAction("Detail", "Fault", new { Fault.FaultID }));
                }
                if (!string.IsNullOrEmpty(Denied))
                {
                    controlClicked = "Manager is denied.";
                    Fault.AppliedMaintenanceDate = DateTime.Now;
                    Fault.MaintenanceExplanation = model.MaintenanceExplanation;
                    Fault.MaintenanceEmployee    = employee.NameSurname;
                    Fault.FaultStatus            = "Denied";
                    db.SaveChanges();
                    return(RedirectToAction("Detail", "Fault", new { Fault.FaultID }));
                }
                if (!string.IsNullOrEmpty(IamWorking))
                {
                    Fault.FaultStatus            = "I am working";
                    Fault.MaintenanceExplanation = model.MaintenanceExplanation;
                    Fault.MaintenanceEmployee    = employee.NameSurname;
                    db.SaveChanges();
                    return(RedirectToAction("Detail", "Fault", new { Fault.FaultID }));
                }
                if (!string.IsNullOrEmpty(DifferentCompanyWorking))
                {
                    Fault.FaultStatus            = "Different company working";
                    Fault.MaintenanceExplanation = model.MaintenanceExplanation + " working in this fault.";
                    Fault.MaintenanceEmployee    = employee.NameSurname;
                    db.SaveChanges();
                    return(RedirectToAction("Detail", "Fault", new { Fault.FaultID }));
                }
                if (!string.IsNullOrEmpty(SuccessfullyCompleted))
                {
                    Fault.FaultStatus            = "Successfully completed";
                    Fault.MaintenanceEmployee    = employee.NameSurname;
                    Fault.MaintenanceExplanation = model.MaintenanceExplanation;
                    Fault.AppliedMaintenanceDate = DateTime.Now;
                    db.SaveChanges();
                    return(RedirectToAction("Detail", "Fault", new { Fault.FaultID }));
                }
                if (!string.IsNullOrEmpty(SituationCouldnotBeResolved))
                {
                    Fault.FaultStatus            = "Situation could not be resolved";
                    Fault.MaintenanceEmployee    = employee.NameSurname;
                    Fault.AppliedMaintenanceDate = DateTime.Now;
                    Fault.MaintenanceExplanation = model.MaintenanceExplanation;
                    db.SaveChanges();
                    return(RedirectToAction("Detail", "Fault", new { Fault.FaultID }));
                }
            }
            else
            {
                return(RedirectToAction("Login", "Employee"));
            }
            return(View());
        }
Esempio n. 21
0
        private double GetFaultCurrentLag(VICycleDataGroup viCycleDataGroup, FaultType faultType, int cycle)
        {
            FaultType viFaultType;

            double anError;
            double bnError;
            double cnError;

            ComplexNumber van;
            ComplexNumber vbn;
            ComplexNumber vcn;

            ComplexNumber ian;
            ComplexNumber ibn;
            ComplexNumber icn;

            viFaultType = faultType;

            if (viFaultType == FaultType.ABC)
            {
                anError = viCycleDataGroup.IA.Error[cycle].Value;
                bnError = viCycleDataGroup.IB.Error[cycle].Value;
                cnError = viCycleDataGroup.IC.Error[cycle].Value;

                if (anError < bnError && anError < cnError)
                {
                    viFaultType = FaultType.AN;
                }
                else if (bnError < anError && bnError < cnError)
                {
                    viFaultType = FaultType.BN;
                }
                else
                {
                    viFaultType = FaultType.CN;
                }
            }

            switch (viFaultType)
            {
            case FaultType.AN:
                return(new Angle(viCycleDataGroup.VA.Phase[cycle].Value - viCycleDataGroup.IA.Phase[cycle].Value).ToRange(-Math.PI, false));

            case FaultType.BN:
                return(new Angle(viCycleDataGroup.VB.Phase[cycle].Value - viCycleDataGroup.IB.Phase[cycle].Value).ToRange(-Math.PI, false));

            case FaultType.CN:
                return(new Angle(viCycleDataGroup.VC.Phase[cycle].Value - viCycleDataGroup.IC.Phase[cycle].Value).ToRange(-Math.PI, false));

            case FaultType.AB:
            case FaultType.ABG:
                van = ToComplexNumber(viCycleDataGroup.VA, cycle);
                vbn = ToComplexNumber(viCycleDataGroup.VB, cycle);
                ian = ToComplexNumber(viCycleDataGroup.IA, cycle);
                ibn = ToComplexNumber(viCycleDataGroup.IB, cycle);
                return(((van - vbn).Angle - (ian - ibn).Angle).ToRange(-Math.PI, false));

            case FaultType.BC:
            case FaultType.BCG:
                vbn = ToComplexNumber(viCycleDataGroup.VB, cycle);
                vcn = ToComplexNumber(viCycleDataGroup.VC, cycle);
                ibn = ToComplexNumber(viCycleDataGroup.IB, cycle);
                icn = ToComplexNumber(viCycleDataGroup.IC, cycle);
                return(((vbn - vcn).Angle - (ibn - icn).Angle).ToRange(-Math.PI, false));

            case FaultType.CA:
            case FaultType.CAG:
                vcn = ToComplexNumber(viCycleDataGroup.VC, cycle);
                van = ToComplexNumber(viCycleDataGroup.VA, cycle);
                icn = ToComplexNumber(viCycleDataGroup.IC, cycle);
                ian = ToComplexNumber(viCycleDataGroup.IA, cycle);
                return(((vcn - van).Angle - (icn - ian).Angle).ToRange(-Math.PI, false));

            default:
                return(double.NaN);
            }
        }
Esempio n. 22
0
        private double GetFaultCurrentMagnitude(VICycleDataGroup viCycleDataGroup, FaultType faultType, int cycle)
        {
            FaultType viFaultType;

            double anError;
            double bnError;
            double cnError;

            ComplexNumber an;
            ComplexNumber bn;
            ComplexNumber cn;

            viFaultType = faultType;

            if (viFaultType == FaultType.ABC)
            {
                anError = viCycleDataGroup.IA.Error[cycle].Value;
                bnError = viCycleDataGroup.IB.Error[cycle].Value;
                cnError = viCycleDataGroup.IC.Error[cycle].Value;

                if (anError < bnError && anError < cnError)
                {
                    viFaultType = FaultType.AN;
                }
                else if (bnError < anError && bnError < cnError)
                {
                    viFaultType = FaultType.BN;
                }
                else
                {
                    viFaultType = FaultType.CN;
                }
            }

            switch (viFaultType)
            {
            case FaultType.AN:
                return(viCycleDataGroup.IA.RMS[cycle].Value);

            case FaultType.BN:
                return(viCycleDataGroup.IB.RMS[cycle].Value);

            case FaultType.CN:
                return(viCycleDataGroup.IC.RMS[cycle].Value);

            case FaultType.AB:
            case FaultType.ABG:
                an = ToComplexNumber(viCycleDataGroup.IA, cycle);
                bn = ToComplexNumber(viCycleDataGroup.IB, cycle);
                return((an - bn).Magnitude);

            case FaultType.BC:
            case FaultType.BCG:
                bn = ToComplexNumber(viCycleDataGroup.IB, cycle);
                cn = ToComplexNumber(viCycleDataGroup.IC, cycle);
                return((bn - cn).Magnitude);

            case FaultType.CA:
            case FaultType.CAG:
                cn = ToComplexNumber(viCycleDataGroup.IC, cycle);
                an = ToComplexNumber(viCycleDataGroup.IA, cycle);
                return((cn - an).Magnitude);

            default:
                return(double.NaN);
            }
        }
Esempio n. 23
0
 public FaultType AddFaultType(FaultType faultType)
 {
     _dataBaseContext.FaultTypes.AddObject(faultType);
     SaveChangesToDataBase();
     return faultType;
 }
Esempio n. 24
0
        //private void GenerateJSON()
        //{
        //    List<FunctionalArea> functionalAreas = _functionalAreaRepository.GetAll().ToList();
        //    foreach (string language in new string[] { "ENG", "ARA" })
        //    {
        //        StringBuilder json = new StringBuilder("[" + Environment.NewLine);
        //        foreach (FunctionalArea functionalArea in functionalAreas)
        //        {
        //            json.Append(GenerateJSON(functionalArea, language));
        //        }
        //        json.AppendLine("]");

        //        System.IO.File.WriteAllText(Path.Combine(string.Format(@"C:\Temp\FunctionalAreas-{0}.json", language)), json.ToString());
        //    }
        //}

        //private string GenerateJSON(FunctionalArea functionalArea, string language)
        //{
        //    Char quotes = '\"';
        //    StringBuilder json = new StringBuilder("\t{" + Environment.NewLine);
        //    json.AppendLine(string.Format("\t\t{0}{1}{0}: ", quotes, functionalArea.Id.ToString()) + "{" + Environment.NewLine +
        //                    string.Format("\t\t\t{0}description{0}: {0}{1}{0},", quotes, functionalArea.Description[language]) + Environment.NewLine +
        //                    string.Format("\t\t\t{0}items{0}: ", quotes) + "{");

        //    foreach(FaultType faultType in functionalArea.FaultTypes)
        //    {
        //        json.Append(string.Format("\t\t\t\t{0}{1}{0}: {0}{2}{0}", quotes, faultType.Id, faultType.Description[language]));
        //        if (faultType != functionalArea.FaultTypes.Last())
        //        {
        //            json.Append(",");
        //        }
        //        json.Append(Environment.NewLine);
        //    }
        //    json.AppendLine("\t\t\t}");
        //    json.AppendLine("\t\t}");
        //    json.AppendLine("\t},");

        //    /*
        //    {
        //        “cbbba5e3 - 298c - 49a7 - b384 - 35a6f9a8f1d0”: {
        //        “description”: “Campaign Requirement”,
        //        “items”: {
        //            “1”: “Outside Campaign Strike Weights”,
        //            “2”: “Programme not in Requirement”
        //          }
        //        }
        //    }
        //    */
        //    return json.ToString();
        //}

        /// <summary>
        /// Loads functional area data to repository from CSV
        /// </summary>
        /// <param name="inputFile"></param>
        /// <param name="languages"></param>
        /// <param name="funtionalAreaRepository"></param>
        private void LoadFunctionalAreasFromCSV(string inputFile, string[] languages, IFunctionalAreaRepository funtionalAreaRepository)
        {
            if (!File.Exists(inputFile))
            {
                return;
            }

            List <FunctionalArea> functionalAreas = new List <FunctionalArea>();
            Char delimiter = (Char)9;

            using (StreamReader reader = new StreamReader(inputFile))
            {
                int rowCount = 0;
                while (!reader.EndOfStream)
                {
                    rowCount++;
                    if (rowCount > 1)       // Ignore header
                    {
                        string[]  values    = reader.ReadLine().Split(delimiter);
                        FaultType faultType = new FaultType()
                        {
                            Id = Convert.ToInt32(values[0])
                        };
                        foreach (string language in languages)
                        {
                            faultType.Description.Add(language, values[1].Trim());
                        }
                        string functionalAreaDescription = values[2].Trim();

                        FunctionalArea functionalArea = null;
                        foreach (FunctionalArea currentFunctionalArea in functionalAreas)
                        {
                            if (currentFunctionalArea.Description[languages[0]].ToUpper() == functionalAreaDescription.ToUpper())
                            {
                                functionalArea = currentFunctionalArea;
                                break;
                            }
                        }

                        if (functionalArea == null)    // New functional area
                        {
                            functionalArea = new FunctionalArea()
                            {
                                Id = Guid.NewGuid()
                            };
                            foreach (string language in languages)
                            {
                                functionalArea.Description.Add(language, functionalAreaDescription);
                            }
                            functionalAreas.Add(functionalArea);
                        }
                        functionalArea.FaultTypes.Add(faultType);
                    }
                }
                reader.Close();
            }

            // Save
            foreach (FunctionalArea functionalArea in functionalAreas)
            {
                funtionalAreaRepository.Add(functionalArea);
            }
        }
 public DsqApiException(string message, int? code, FaultType fault)
     : base(message)
 {
     this.Code = code;
     this.Fault = fault;
 }
Esempio n. 26
0
 public void RemoveFaultType(FaultType thisFaultType)
 {
     _dataBaseContext.FaultTypes.DeleteObject(thisFaultType);
     SaveChangesToDataBase();
 }
Esempio n. 27
0
File: Fault.cs Progetto: sam159/SVM
 public Fault(FaultType type) : base()
 {
     Type = type;
 }
        // Get the voltage to use in fault calculations for this cycle, based on the fault type.
        private static ComplexNumber GetFaultVoltage(CycleData cycle, FaultType viFaultType)
        {
            switch (viFaultType)
            {
                case FaultType.AN:
                    return cycle.AN.V.Complex;

                case FaultType.BN:
                    return cycle.BN.V.Complex;

                case FaultType.CN:
                    return cycle.CN.V.Complex;

                case FaultType.AB:
                case FaultType.ABG:
                    return cycle.AN.V.Complex - cycle.BN.V.Complex;

                case FaultType.BC:
                case FaultType.BCG:
                    return cycle.BN.V.Complex - cycle.CN.V.Complex;

                case FaultType.CA:
                case FaultType.CAG:
                    return cycle.CN.V.Complex - cycle.AN.V.Complex;

                case FaultType.ABC:
                    if (cycle.AN.I.Error < cycle.BN.I.Error && cycle.AN.I.Error < cycle.CN.I.Error)
                        return cycle.AN.V.Complex;

                    if (cycle.BN.I.Error < cycle.CN.I.Error)
                        return cycle.BN.V.Complex;

                    return cycle.CN.V.Complex;

                default:
                    throw new ArgumentOutOfRangeException("viFaultType");
            }
        }
 private void ReportFaultHelper(FaultType faultType)
 {
     this.nativePartition.ReportFault((NativeTypes.FABRIC_FAULT_TYPE)faultType);
 }
Esempio n. 30
0
 public ComponentFault(ComponentFault fault)
 {
     this.faultName = fault.faultName;
     this.nodes     = fault.nodes;
     this.type      = fault.type;
 }
 public void ReportFault(FaultType faultType)
 {
     Utility.WrapNativeSyncInvoke(() => this.ReportFaultHelper(faultType), "StatelessPartition.ReportFault");
 }
Esempio n. 32
0
        /// <summary>
        /// Create fault message with Exception object and request xlang message
        /// </summary>
        /// <param name="exception"></param>
        /// <param name="requestMsg"></param>
        /// <param name="faultType"></param>
        /// <returns></returns>
        public static XLANGMessage CreateFaultMessage(Exception exception, XLANGMessage requestMsg, FaultType faultType)
        {
            string faultXml = SerializeExceptionObject(exception);
            string reqXml   = string.Empty;

            try
            {
                Stream reqStream = requestMsg != null ? ((Stream)requestMsg[0].RetrieveAs(typeof(Stream))) : null;
                using (StreamReader reader = new StreamReader(reqStream))
                {
                    reqXml = reader.ReadToEnd();
                }
            }
            catch (Exception) { }

            XLANGMessage result = GetFaultMessage(faultXml, reqXml, faultType);

            return(result);
        }
Esempio n. 33
0
 //Sets the fault as a connection type
 public void SetAsMain()
 {
     if (faultType != FaultType.Main) {
         faultType = FaultType.Main;
         mainFaultSprite.enabled = true;
     }
 }
Esempio n. 34
0
        /// <summary>
        /// Builds Fault Message
        /// </summary>
        /// <param name="faultXml"></param>
        /// <param name="requestXml"></param>
        /// <param name="faultType"></param>
        /// <returns></returns>
        private static XLANGMessage GetFaultMessage(string faultXml, string requestXml, FaultType faultType)
        {
            XmlDocument           xmlDocument = new XmlDocument();
            string                appName     = string.Empty;
            XlangServiceInfo      serviceXlangInfo;
            BizTalkServerRegistry bizTalkServerRegistry = default(BizTalkServerRegistry);
            XLANGMessage          result;

            string xmlSafe = System.Net.WebUtility.HtmlEncode(requestXml);

            if (xmlSafe != requestXml)
            {
                requestXml = "Contents have been HTML Encoded: " + xmlSafe;
            }

            try
            {
                serviceXlangInfo      = GetServiceXlangInfo();
                bizTalkServerRegistry = Utility.GetMgmtServerInfo();

                appName = Utility.GetApplication(Utility.ServiceType.Orchestration, bizTalkServerRegistry.BizTalkMgmtDb, bizTalkServerRegistry.BizTalkMgmtDbName, Context.RootService.ServiceId.ToString(), string.Empty);
                xmlDocument.LoadXml(GetMessage(new object[]
                {
                    appName,
                    serviceXlangInfo.ServiceInstanceID,
                    serviceXlangInfo.ServiceName,
                    faultType,
                    "", //ArchiveTag for future use
                    "", //FaultEventId  for future use
                    "", //FaultDetails  for any additional info
                    "", //FaultSeverity  for future use
                    faultXml,
                    requestXml
                }));

                XmlDocumentSerializationProxy xmlDocumentSerializationProxy = (XmlDocumentSerializationProxy)xmlDocument;
                BTXMessage bTXMessage = new AvistaEsbInternalMsg("FaultMessage", Service.RootService.XlangStore.OwningContext);
                bTXMessage.AddPart("", "Body");
                bTXMessage[0].LoadFrom(xmlDocumentSerializationProxy.UnderlyingXmlDocument);

                SetMsgProperty(bTXMessage, typeof(ErrorReport.ErrorType), faultType.ToString());

                XLANGMessage messageWrapperForUserCode = bTXMessage.GetMessageWrapperForUserCode();
                result = messageWrapperForUserCode;
            }
            catch (Exception ex)
            {
                Logger.WriteWarning(ex.ToString(), 14000);
                throw ex;
            }
            finally
            {
                if (xmlDocument != null)
                {
                    xmlDocument = null;
                }
            }
            return(result);
        }
Esempio n. 35
0
 public Segment(FaultType faultType)
 {
     m_faultType = faultType;
 }
Esempio n. 36
0
 public AccountingException(FaultType fault) : base(fault.ToString())
 {
     this.Cause = fault;
 }
 public void ReportFault(FaultType faultType)
 {
     throw new NotImplementedException();
 }
Esempio n. 38
0
 public AccountingException(FaultType ft) : base(ft.ToString())
 {
     Cause = ft;
 }
Esempio n. 39
0
 public void ReportFault(
     FaultType faultType)
 {
 }
Esempio n. 40
0
        public bool CreateFaultOrder(FaultType _type)
        {
            var fdm = new FaultDataModel();

            if (User == null)
            {
                //不能创建
                Prompt = "报修人员未选择!";
                return(false);
            }
            else
            {
                fdm.user_id = User.Key;
            }

            if (Department == null)
            {
                //不能创建
                Prompt = "请选择部门!";
                return(false);
            }
            else
            {
                fdm.department_id = Department.Key;
            }

            if (AssetType == null)
            {
                //不能创建
                Prompt = "资产类型未选择!";
                return(false);
            }
            else
            {
                fdm.asset_type_id = AssetType.Key;
            }

            if (Company == null)
            {
                //不能创建
                Prompt = "请选择区域!";
                return(false);
            }
            else
            {
                fdm.company_id = Company.Key;
            }

            if (OrderType == null)
            {
                //不能创建
                Prompt = "请选择工单类型!";
                return(false);
            }
            else
            {
                fdm.work_property = OrderType.Text;
            }

            //故障类型
            if (BreakDownCate == null)
            {
                fdm.breakdown_categ = FaultDict[2].Text;
            }
            else
            {
                fdm.breakdown_categ = BreakDownCate.Text;
            }

            //故障主题------------(-1可能导致外键错误)
            if (KnowLedge == null)
            {
                fdm.knowledge_id = 0;
            }
            else
            {
                fdm.knowledge_id = KnowLedge.Key;
            }

            //去除换行符
            Regex reg = new Regex(@"\b\r\n");

            fdm.note        = reg.Replace(Note, ";");
            fdm.address     = reg.Replace(Address, ";");
            fdm.note_result = reg.Replace(Note_Result, ";");


            //设置录音记录信息
            fdm.SetData(_DataModel);


            //这里地址需要加上ip地址(目前不需要加IP了)
            //string ipStr = Provider.getIPAddress();
            //if (ipStr == Properties.Settings.Default.ServerIP)
            //{
            fdm.WaveFilePath = WaveFilePath;
            //}
            //else
            //{
            //    fdm.WaveFilePath = ipStr + "\\" + WaveFilePath;
            //}


            //插入服务器

            if (CreteFaultList.CreateOrder(fdm, _type, IsInsert))
            {
                CreteFaultList.UpdateIsCreate(AccessID, _type);
                return(true);
            }
            return(false);
        }
Esempio n. 41
0
 //inject repository here
 public bool FaultAlreadyCaptured(string address, FaultType faultType)
 {
     return false;
 }
Esempio n. 42
0
 public ComponentFault(string faultName, Tuple <TNode, TNode> nodes, FaultType type)
 {
     this.faultName = faultName;
     this.nodes     = nodes;
     this.type      = type;
 }
Esempio n. 43
0
        public SqliteConnection(IFileSystem fileSystem) : base(Path.Combine(fileSystem.AppData.FullName, "bike.db"))
        {
            var conn = this.GetConnection();

            conn.CreateTable <AnswerQuestion>();
            conn.CreateTable <AppStateEvent>();

            conn.CreateTable <GpsData>();

            conn.CreateTable <Building>();
            conn.CreateTable <FaultType>();
            conn.CreateTable <Diagnostic>();

            conn.CreateTable <Trip>();
            conn.CreateTable <TripDetail>();


            if (AnswerQuestions.CountAsync().Result == 0)
            {
                GetConnection().InsertAll(new[] {
                    new AnswerQuestion()
                    {
                        Category = "Primary Question",
                        Question = "How to work with this program?",
                        Answer   = "You can Work this program what you want to do.",
                        Detail   = "Its Easy to use, use must first read Instruction before use it. have fun."
                    },
                    new AnswerQuestion()
                    {
                        Category = "Thecnical Question",
                        Question = "how can we Repair my bicycle?",
                        Answer   = "You should bring your bicycle to repair workshop that specified in web site .",
                        Detail   = "You must dont open hardware yourself by own."
                    },
                    new AnswerQuestion()
                    {
                        Category = "Primary Question",
                        Question = "How to buy Electrical Bicycle?",
                        Answer   = "You can contact us to help you where place you must go to buy one Electrical bicycle .",
                        Detail   = "We have many store on the city that you can go there to buy a Electrical bicycle, if you want know where are these watch company web site or contact us"
                    },
                });
            }

            if (FaultType.CountAsync().Result == 0)
            {
                GetConnection().InsertAll(new[] {
                    new FaultType()
                    {
                        Id = (int)Fault.Kind.OverCurrent, Name = "OverCurrent", Description = "Current exceeded from value that cause damage to bike"
                    },
                    new FaultType()
                    {
                        Id = (int)Fault.Kind.OverTemprature, Name = "OverTemprature", Description = "Temprature exceeded from value that cause damage to bike"
                    },
                    new FaultType()
                    {
                        Id = (int)Fault.Kind.PedalSensor, Name = "PedalSensor", Description = "Pedal sensor doesn't work properly"
                    },
                    new FaultType()
                    {
                        Id = (int)Fault.Kind.Throttle, Name = "Throttle", Description = "Throttle doesn't work properly"
                    },
                    new FaultType()
                    {
                        Id = (int)Fault.Kind.OverVoltage, Name = "OverVoltage", Description = "Voltage exceeded from value that cause damage to bike"
                    },
                    new FaultType()
                    {
                        Id = (int)Fault.Kind.UnderVoltage, Name = "UnderVoltage", Description = "Power Drop Down from value that cause damage to bike"
                    },
                    new FaultType()
                    {
                        Id = (int)Fault.Kind.Motor, Name = "Motor", Description = "Motor sensor doesn't work properly"
                    },
                    new FaultType()
                    {
                        Id = (int)Fault.Kind.Drive, Name = "Drive", Description = "Drive doesn't work properly"
                    }
                });
            }


            if (Buildings.CountAsync().Result == 0)
            {
                GetConnection().InsertAll(new[] {
                    new Building()
                    {
                        Header      = "Central Office",
                        Type        = BuildingType.Office,
                        Latitude    = 35.715298,
                        Longitude   = 51.404343,
                        Address     = "Tehran, Towhid Sqaure, Sattar Khan Avenue, Kokab Street, No.28",
                        PhoneNumber = "021-66932063",
                        Email       = "*****@*****.**"
                    },
                    new Building()
                    {
                        Header      = "Workshop1",
                        Type        = BuildingType.Office,
                        Latitude    = 35.915298,
                        Longitude   = 51.304343,
                        Address     = "Tehran, Towhid Sqaure, Sattar Khan Avenue, Kokab Street, No.28",
                        PhoneNumber = "021-66932063",
                        Email       = "*****@*****.**"
                    },
                });
            }
        }
Esempio n. 44
0
 public Segment(FaultType faultType)
 {
     m_faultType = faultType;
 }
Esempio n. 45
0
 /// <summary>
 /// Builds a new ErrorInfo instance from the given exception.
 /// </summary>
 /// <param name="source">The source excection.</param>
 /// <param name="type">The type of fault.</param>
 /// <returns>
 /// The ErrorInfo instance that represents the given source exception.
 /// </returns>
 public static ErrorInfo FromException(Exception source, FaultType type)
 {
     return(new ErrorInfo(source, type));
 }