コード例 #1
0
        public void ErrorEntity_Write_Test()
        {
            //No assertion for this test case, needs enhancements

            var           csvConfig = new CSVConfiguration();
            List <string> columns   = new List <string>();

            columns.Add("Shipment Origin");
            columns.Add("Shipment Destination");
            columns.Add("Pickup Date");
            columns.Add("Description");

            csvConfig.Columns = columns.ToArray();

            using (var csvFile = new CSVFile <ErrorEntity>("Shipment_Error_Output.csv", csvConfig))
            {
                for (int i = 0; i < 10; i++)
                {
                    var errorEntity = new ErrorEntity();
                    errorEntity.Description      = "test error" + i;
                    errorEntity.EntityProperties = new EntityPropertyCollection();
                    errorEntity.EntityProperties.Add(new EntityProperty {
                        PropertyName = "ShipmentOrigin", PropertyType = typeof(string), PropertyValue = "Origin_" + i
                    });
                    errorEntity.EntityProperties.Add(new EntityProperty {
                        PropertyName = "ShipmentDestination", PropertyType = typeof(string), PropertyValue = "Destination_" + i
                    });
                    errorEntity.EntityProperties.Add(new EntityProperty {
                        PropertyName = "PickupDate", PropertyType = typeof(DateTime), PropertyValue = DateTime.Now
                    });

                    csvFile.Append(errorEntity);
                }
            }
        }
コード例 #2
0
ファイル: OEQuestionBiz.cs プロジェクト: hqsoftmac/HQDEV1-1
 public int Delete(NameValueCollection where, out ErrorEntity ErrInfo)
 {
     OEQuestionDA da = new OEQuestionDA();
     NameValueCollection parameters = new NameValueCollection();
     parameters.Add("FQuestionStatus", "0");
     return Update(parameters, where, out ErrInfo);
 }
コード例 #3
0
 public Int64 Insert(PortalProduct item, out ErrorEntity ErrInfo)
 {
     if (item.FProductListID == 0)
     {
         ErrInfo = new ErrorEntity(RespCode.Pp01003);
         return -1;
     }
     if (string.IsNullOrEmpty(item.FProductName))
     {
         ErrInfo = new ErrorEntity(RespCode.Pp01004);
         return -1;
     }
     NameValueCollection parameters = new NameValueCollection();
     parameters.Add("FProductListID", item.FProductListID.ToString());
     parameters.Add("FProductName", item.FProductName);
     parameters.Add("FProductModule", item.FProductModule);
     parameters.Add("FProductDesc", item.FProductDesc);
     parameters.Add("FProductPic", item.FProductPic);
     parameters.Add("FBriefPic", item.FBriefPic);
     parameters.Add("FSEOTitle", item.FSEOTitle);
     parameters.Add("FSEOKeyWord", item.FSEOKeyWord);
     parameters.Add("FSEODesc", item.FSEODesc);
     parameters.Add("FProductBrief", item.FProductBrief);
     parameters.Add("FProductContent", item.FProductContent);
     return Insert(parameters, out ErrInfo);
 }
コード例 #4
0
ファイル: PmOrgInfoBiz.cs プロジェクト: hqsoftware/HQDEV1-1
 public Int64 Insert(PmOrgInfo item, out ErrorEntity ErrInfo)
 {
     if (string.IsNullOrEmpty(item.FOrgName))
     {
         ErrInfo = new ErrorEntity("OI010001", "组织名称不能为空!");
         return -1;
     }
     if (string.IsNullOrEmpty(item.FOrgType))
     {
         ErrInfo = new ErrorEntity("OI010002", "组织类型不能为空!");
         return -1;
     }
     if (item.FDepartmentID == 0)
     {
         ErrInfo = new ErrorEntity("OI010003", "所属部门不能为空!");
         return -1;
     }
     if (item.FOrgOrder == 0)
     {
         ErrInfo = new ErrorEntity("OI010004", "组织显示顺序不能为空!");
         return -1;
     }
     NameValueCollection parameters = new NameValueCollection();
     parameters.Add("FDepartmentID", item.FDepartmentID.ToString());
     parameters.Add("FOrgName", item.FOrgName);
     parameters.Add("FParentOrgId", item.FParentOrgId.ToString());
     parameters.Add("FOrgType", item.FOrgType);
     parameters.Add("FOrgNewDate", item.FOrgNewDate.ToString());
     parameters.Add("FOrgOrder", item.FOrgOrder.ToString());
     return Insert(parameters, out ErrInfo);
 }
コード例 #5
0
ファイル: ErrorController.cs プロジェクト: fangliu520/Beeant
 public virtual ActionResult Add(string message, string address, string device, string ip, string detail)
 {
     try
     {
         var info = new ErrorEntity
         {
             Address  = string.IsNullOrWhiteSpace(address) ? Request.Url.ToString(): address,
             Device   = string.IsNullOrWhiteSpace(device) ? Request.UserAgent: device,
             Ip       = string.IsNullOrWhiteSpace(ip) ? Request.UserHostAddress : ip,
             Message  = message,
             Detail   = string.IsNullOrWhiteSpace(detail) ? "": detail,
             SaveType = SaveType.Add
         };
         var rev = Ioc.Resolve <IApplicationService, ErrorEntity>().Save(info);
         return(rev
             ? ReturnSuccessResult("添加成功")
             : ReturnFailureResult(info.Errors != null && info.Errors.Count > 0
                 ? string.Join(",", info.Errors.Select(it => it.Message).ToArray())
                 : "添加失败"));
     }
     catch (Exception ex)
     {
         return(ReturnExceptionResult(ex));
     }
 }
コード例 #6
0
 public void SaveProduct()
 {
     string _productname = Parameters["pproductname"];
     string _productlist = Parameters["pproductlist"];
     string _productmodule = Parameters["pproductmodule"];
     string _productdesc = Parameters["pproductdesc"];
     string _briefpath = Parameters["pbriefpath"];
     string _path = Parameters["ppath"];
     string _briefcontent = Parameters["pbriefcontent"];
     string _content = Parameters["pcontent"];
     string _seotitle = Parameters["pseotitle"];
     string _seokeyword = Parameters["pseokeyword"];
     string _seodesc = Parameters["pseodesc"];
     PortalProduct item = new PortalProduct();
     item.FProductId = 0;
     item.FProductListID = Convert.ToInt64(_productlist);
     item.FProductName = _productname;
     item.FProductModule = _productmodule;
     item.FProductDesc = _productdesc;
     item.FProductPic = _path;
     item.FBriefPic = _briefpath;
     item.FSEOTitle = _seotitle;
     item.FSEOKeyWord = _seokeyword;
     item.FSEODesc = _seodesc;
     item.FProductBrief = _briefcontent;
     item.FProductContent = _content;
     PortalProductBiz biz = new PortalProductBiz();
     ErrorEntity ErrInfo = new ErrorEntity();
     biz.Insert(item, out ErrInfo);
     Response.Write(ErrInfo.ToJson());
 }
コード例 #7
0
ファイル: PmOrgLeaderBiz.cs プロジェクト: hqsoftware/HQDEV1-1
        public Int64 Insert(PmOrgLeader item, out ErrorEntity ErrInfo)
        {
            if (string.IsNullOrEmpty(item.FLeaderName))
            {
                ErrInfo = new ErrorEntity("PL010001", "领导姓名不能为空!");
                return -1;
            }
            if(string.IsNullOrEmpty(item.FLeaderPostion))
            {
                ErrInfo = new ErrorEntity("PL010002","领导职务不能为空!");
                return -1;
            }
            if (item.FLeaderOrder == 0)
            {
                ErrInfo = new ErrorEntity("PL010003", "领导显示顺序不能为空!");
                return -1;
            }

            NameValueCollection parameters = new NameValueCollection();
            parameters.Add("FOrgId", item.FOrgId.ToString());
            parameters.Add("FLeaderName", item.FLeaderName);
            parameters.Add("FLeaderPostion", item.FLeaderPostion);
            parameters.Add("FLeaderOrder", item.FLeaderOrder.ToString());
            return Insert(parameters, out ErrInfo);
        }
コード例 #8
0
 public Int32 Save(PortalChildColumnContent item, out ErrorEntity ErrInfo)
 {
     NameValueCollection where = new NameValueCollection();
     where.Add("FChildColumnId", item.FChildColumnId.ToString());
     Delete(where, out ErrInfo);
     if (ErrInfo.ErrorCode == RespCode.Success)
     {
         NameValueCollection parameters = new NameValueCollection();
         parameters.Add("FChildColumnId", item.FChildColumnId.ToString());
         parameters.Add("FCCContentText", item.FCCContentText);
         parameters.Add("FSEOTitle", item.FSEOTitle);
         parameters.Add("FSEOKeyWord", item.FSEOKeyWord);
         parameters.Add("FSEODescription", item.FSEODescription);
         Insert(parameters, out ErrInfo);
         if (ErrInfo.ErrorCode == RespCode.Success)
         {
             return 1;
         }
         else
         {
             return -1;
         }
     }
     else
     {
         return -1;
     }
 }
コード例 #9
0
 public void SaveItem()
 {
     string _positionname = Parameters["ppositionname"];
     string _positiondept = Parameters["ppositiondept"];
     string _positiontype = Parameters["ppositiontype"];
     string _positiongendor = Parameters["ppositiongendor"];
     string _positionnumber = Parameters["ppositionnumber"];
     string _positionbegindate = Parameters["pbegindate"];
     string _positionenddate = Parameters["penddate"];
     string _backcontent = Parameters["pbackcontent"];
     string _content = Parameters["pcontent"];
     string _order = Parameters["porder"];
     string positionid = Parameters["id"];
     PortalPosition item = new PortalPosition();
     PortalPositionBiz biz = new PortalPositionBiz();
     item.FPositionId = Convert.ToInt64(positionid);
     item.FPositionName = _positionname;
     item.FPositionDept = _positiondept;
     item.FPositionType = _positiontype;
     item.FPositionGendor = _positiongendor;
     item.FPositionNum = Convert.ToInt32(_positionnumber);
     item.FBeginDate = Convert.ToDateTime(_positionbegindate);
     item.FEndDate = Convert.ToDateTime(_positionenddate);
     item.FBackContent = _backcontent;
     item.FPositionContent = _content;
     item.FPositionOrder = Convert.ToInt32(_order);
     ErrorEntity ErrInfo = new ErrorEntity();
     biz.Update(item, out ErrInfo);
     Response.Write(ErrInfo.ToJson());
 }
コード例 #10
0
 public int Insert(string _userid, string _deptlistid, out ErrorEntity ErrInfo)
 {
     NameValueCollection where = new NameValueCollection();
     where.Add("FUserId", _userid);
     if (Delete(where, out ErrInfo) >= 0)
     {
         string[] deptidarray;
         deptidarray = _deptlistid.Split(',');
         for (int i = 0; i < deptidarray.Length; i++)
         {
             NameValueCollection parameters = new NameValueCollection();
             parameters.Add("FUserId", _userid);
             parameters.Add("FDepartmentId", deptidarray[i]);
             Insert(parameters, out ErrInfo);
             if (ErrInfo.ErrorCode != RespCode.Success)
             {
                 return -1;
             }
         }
         return 1;
     }
     else
     {
         return -1;
     }
 }
コード例 #11
0
 public async Task <ActionResult <UploadData> > Post([FromForm] UploadDataRequest uploadDataRequest)
 {
     if (uploadDataRequest.File.Length > 0)
     {
         try
         {
             return(Ok(await _uploadFile.UploadFile(uploadDataRequest)));
         }
         catch (Exception ex)
         {
             ErrorEntity error = new ErrorEntity
             {
                 Type    = "Exception",
                 Message = ex.Message,
                 Code    = 500,
                 Name    = "Error-Utilitarios-Api"
             };
             return(BadRequest(error));
         }
     }
     else
     {
         ErrorEntity error = new ErrorEntity
         {
             Type    = "Exception",
             Message = "Error-Verificar el Archivo",
             Code    = 500,
             Name    = "Error-Verificar el Archivo"
         };
         return(BadRequest(error));
     }
 }
コード例 #12
0
        public static void InsertMessage(string tableName, string message)
        {
            try
            {
                CloudStorageAccount storageAccount   = CreateConexion();
                CloudTableClient    cloudTableClient = storageAccount.CreateCloudTableClient();

                // Retrieve a reference to the table.
                CloudTable table = cloudTableClient.GetTableReference(tableName);

                // Create the table if it doesn't exist.
                table.CreateIfNotExists();

                // Create a new customer entity.
                ErrorEntity error = new ErrorEntity(Guid.NewGuid().ToString(), Guid.NewGuid().ToString());
                error.Excepcion = message;

                // Create the TableOperation object that inserts the customer entity.
                TableOperation insertOperation = TableOperation.Insert(error);

                // Execute the insert operation.
                table.Execute(insertOperation);
            }
            catch (Exception e)
            {
                //Todo
            }
        }
コード例 #13
0
        public static WebProtocolException ToWebProtocolException(this Exception ex)
        {
            ex.AddDbgMsg("Exception converted to WebProtocolException.");
            ex.Trace();

            Reason reason = new Reason {
                Message = ex.ToUserString(), Code = ex.GetErrorCode()
            };
            ErrorEntity errorEntity = new ErrorEntity {
                Reason = reason
            };

            HttpStatusCode statusCode = ex.GetStatusCode();

            if (WebOperationContext.Current != null && WebOperationContext.Current.OutgoingResponse != null)
            {
                // -- if comes from web
                WebOperationContext.Current.OutgoingResponse.ContentType = Utils.FaultContentType;
                WebOperationContext.Current.OutgoingResponse.StatusCode  = statusCode;
            }

            WebProtocolException webProtocolException = new WebProtocolException(statusCode, ex.ToUserString(), errorEntity, ex, true);

            return(webProtocolException);
        }
コード例 #14
0
ファイル: OEStudentBiz.cs プロジェクト: hqsoftmac/HQDEV1-1
 public int Delete(string idlist, out ErrorEntity ErrInfo)
 {
     NameValueCollection where = new NameValueCollection();
     idlist = idlist.Replace(",", "','");
     where.Add("condition", "FStudentId in ('" + idlist + "')");
     return Delete(where, out ErrInfo);
 }
コード例 #15
0
        /// <summary>
        /// 添加错误信息
        /// </summary>
        private static void AddErrorEntity(Exception ex)
        {
            ex = ex == null && HttpContext.Current != null?HttpContext.Current.Server.GetLastError() : ex;

            if (!CheckSave(ex))
            {
                return;
            }
            var info = new ErrorEntity
            {
                Address  = HttpContext.Current.Request.Url.ToString(),
                Device   = HttpContext.Current.Request.UserAgent,
                Ip       = GetClientIp(),
                SaveType = SaveType.Add
            };

            info.SetEntity(ex);
            FillIdentity(info);
            Ioc.Resolve <IApplicationService, ErrorEntity>().Save(info);
            if (ConfigurationManager.GetSetting <bool>("IsDebug"))
            {
                throw ex;
            }
            var url = UrlExtension.GetUrl(null, "PresentationAdminHomeUrl");

            HttpContext.Current.Response.Redirect(string.Format("{0}/Errors/Generic.htm", url));
        }
コード例 #16
0
        public async static Task <ArgType> CheckUploadImageFile <ArgType>(StorageFile file)
        {
            ArgType result    = default(ArgType);
            bool    qualified = await ApiHelper.IsUploadQualifiedImage(file);

            if (false == qualified)
            {
                // try to use the localized error string
                string error = string.Empty;
                try
                {
                    error = new ResourceLoader().GetString("UploadPhotoFileCheckErrorMessage");
                }
                catch (Exception)
                {
                    error = "图片参数错误,支持JPG、JPEG、GIF和PNG文件,图片最大支持8MB";
                }

                var errEntity = new ErrorEntity()
                {
                    Error_msg = error, Error_code = 0, Error_Type = RemoteErrorMsgTranslator.ErrorType.AlbumRelevantError
                };
                result = (ArgType)Activator.CreateInstance(typeof(ArgType), errEntity);
            }

            return(result);
        }
コード例 #17
0
        public Int64 Insert(OEQuestionBank item, out ErrorEntity ErrInfo)
        {
            //Error Judge Define
            if (item.FContentClassId == 0)
            {
                ErrInfo = new ErrorEntity("QB010001", "内容类别不能为空!");
                return -1;
            }
            if (string.IsNullOrEmpty(item.FQBankCode))
            {
                ErrInfo = new ErrorEntity("QB010002", "题库编号不能为空!");
                return -1;
            }
            if (string.IsNullOrEmpty(item.FQBankName))
            {
                ErrInfo = new ErrorEntity("QB010003", "题库名称不能为空!");
                return -1;
            }

            if (!ChkCodeDuplicate(item.FQBankId.ToString(), item.FQBankCode))
            {
                ErrInfo = new ErrorEntity("QB010004", "题库编号重复,不能保存!");
                return -1;
            }
            NameValueCollection parameters = new NameValueCollection();
            parameters.Add("FContentClassId", item.FContentClassId.ToString());
            parameters.Add("FQBankCode", item.FQBankCode);
            parameters.Add("FQBankName", item.FQBankName);
            parameters.Add("FQBankContent", item.FQBankContent);
            return Insert(parameters, out ErrInfo);
        }
コード例 #18
0
ファイル: navdefine.aspx.cs プロジェクト: hqsoftware/HQDEV1-1
 public void SaveItem()
 {
     string _columnid = Parameters["colid"];
     string _navid = Parameters["pnavid"];
     string _navname = Parameters["pnavname"];
     string _navtype = Parameters["pnavtype"];
     string _navposition = Parameters["pnavposition"];
     string _navvisible = Parameters["pnavvisible"];
     string _order = Parameters["porder"];
     PortalColumnNavBiz biz = new PortalColumnNavBiz();
     PortalColumnNav item = new PortalColumnNav();
     item.FColumnId = Convert.ToInt64(_columnid);
     item.FNavId = Convert.ToInt64(_navid);
     item.FNavName = _navname;
     item.FNavOrder = Convert.ToInt32(_order);
     item.FNavPosition = _navposition;
     item.FNavType = _navtype;
     item.FNavVisible = _navvisible;
     ErrorEntity ErrInfo = new ErrorEntity();
     if (item.FNavId == 0)
     {
         biz.Insert(item, out ErrInfo);
     }
     else
     {
         biz.Update(item, out ErrInfo);
     }
     Response.Write(ErrInfo.ToJson());
 }
コード例 #19
0
 public Int64 Insert(PortalArticleList item, out ErrorEntity ErrInfo)
 {
     if(string.IsNullOrEmpty(item.FListName))
     {
         ErrInfo = new ErrorEntity("999999","目录名称不能为空!");
         return -1;
     }
     if(item.FListOrder == 0)
     {
         ErrInfo = new ErrorEntity("999999","目录顺序不能为空!");
         return -1;
     }
     if (ChkNameExist(item.FListId, item.FParentListId, item.FListName))
     {
         NameValueCollection parameters = new NameValueCollection();
         parameters.Add("FListName", item.FListName);
         parameters.Add("FListOrder", item.FListOrder.ToString());
         if (item.FParentListId > 0)
         {
             parameters.Add("FParentListId", item.FParentListId.ToString());
         }
         Int64 result = Insert(parameters, out ErrInfo);
         return result;
     }
     else
     {
         ErrInfo = new ErrorEntity("999999", "目录名称重复,无法保存!");
         return -1;
     }
 }
コード例 #20
0
ファイル: BaseCurd.cs プロジェクト: wzk64657534/CorePlus.NET
        private ErrorEntity GetErrorChineseMessage(ErrorEntity entity)
        {
            var query = (from x in XmlHelper.GetErrorFromXML()
                         where x.errcode == entity.errcode
                         select x).FirstOrDefault();

            return(query ?? entity);
        }
コード例 #21
0
 public void DelArticle()
 {
     string _parm = Parameters["pparm"];
     PortalArticleBiz biz = new PortalArticleBiz();
     ErrorEntity ErrInfo = new ErrorEntity();
     biz.Delete(_parm, out ErrInfo);
     Response.Write(ErrInfo.ToJson());
 }
コード例 #22
0
 public void DelNation()
 {
     string _parm = Parameters["pparm"];
     SysNationBiz biz = new SysNationBiz();
     ErrorEntity ErrInfo = new ErrorEntity();
     biz.Delete(_parm, out ErrInfo);
     Response.Write(ErrInfo.ToJson());
 }
コード例 #23
0
 public void DelList()
 {
     string idlist = Parameters["pparm"];
     PortalArticleListBiz biz = new PortalArticleListBiz();
     ErrorEntity ErrInfo = new ErrorEntity();
     biz.Delete(idlist, out ErrInfo);
     Response.Write(ErrInfo.ToJson());
 }
コード例 #24
0
 private static void Log(ErrorEntity errorEntity)
 {
     System.Diagnostics.Debug.WriteLine(errorEntity.ToString());
     if (RGHSettings.LogLevel >= errorEntity.ErrorLevel)
     {
         LiteDBHelper.Save(errorEntity);
     }
 }
コード例 #25
0
 public void DelDepartment()
 {
     string idlist = Parameters["pparm"];
     SysDepartmentBiz biz = new SysDepartmentBiz();
     ErrorEntity ErrInfo = new ErrorEntity();
     biz.Delete(idlist, out ErrInfo);
     Response.Write(ErrInfo.ToJson());
 }
コード例 #26
0
 public void DeleteUser()
 {
     string _idstr = Parameters["pparm"];
     SysUserBiz biz = new SysUserBiz();
     ErrorEntity ErrInfo = new ErrorEntity();
     biz.Delete(_idstr, out ErrInfo);
     Response.Write(ErrInfo.ToJson());
 }
コード例 #27
0
ファイル: usemodule.aspx.cs プロジェクト: hqsoftware/HQDEV1-1
 public void StopModule()
 {
     string _moduleflag = Parameters["pmoduleflag"];
     SysModuleBiz biz = new SysModuleBiz();
     ErrorEntity ErrInfo = new ErrorEntity();
     biz.UpdateStatus(_moduleflag, "0", out ErrInfo);
     Response.Write(ErrInfo.ToJson());
 }
コード例 #28
0
ファイル: orgmanage.aspx.cs プロジェクト: hqsoftware/HQDEV1-1
 public void DelData()
 {
     string idlist = Parameters["pparm"];
     PmOrgInfoBiz biz = new PmOrgInfoBiz();
     ErrorEntity ErrInfo = new ErrorEntity();
     biz.Delete(idlist, out ErrInfo);
     Response.Write(ErrInfo.ToJson());
 }
コード例 #29
0
        private async Task IterateItem()
        {
            bool isErroredOut = false;

            await this.ReadNextLineAsync().ContinueWith(async(t) =>
            {
                if (this.line == null && (this.line = this.textReader.ReadLine()) == null)
                {
                    this.record = default(T);
                }
                else
                {
                    this.record         = new T();
                    this.record.RowText = this.line;
                    Type recordType     = typeof(T);
                    List <Action <T, String> > setters;
                    if (!this.allSetters.TryGetValue(recordType, out setters))
                    {
                        setters = this.CreateSetters();
                        this.allSetters[recordType] = setters;
                    }

                    var fieldValues = new string[setters.Count];
                    for (int i = 0; i < setters.Count; i++)
                    {
                        fieldValues[i] = this.ParseField();
                        if (this.curChar == this.fieldSeparator)
                        {
                            this.NextChar();
                        }
                        else
                        {
                            break;
                        }
                    }
                    for (int i = 0; i < setters.Count; i++)
                    {
                        try
                        {
                            setters[i]?.Invoke(this.record, fieldValues[i]);
                        }
                        catch
                        {
                            isErroredOut                = true;
                            ErrorEntity errorEntiy      = new ErrorEntity();
                            errorEntiy.EntityProperties = GetEntityProperties(fieldValues);
                            this._invalidEntities.Add(errorEntiy);

                            break;
                        }
                    }
                    if (isErroredOut)
                    {
                        await IterateItem();
                    }
                }
            }).Result;
        }
コード例 #30
0
        public Int32 Insert(OEStudentChoose item, out ErrorEntity ErrInfo)
        {
            //Error Judge Define

            NameValueCollection parameters = new NameValueCollection();
            parameters.Add("FStudentId", item.FStudentId.ToString());
            parameters.Add("FContentClassId", item.FContentClassId.ToString());
            return Insert(parameters, out ErrInfo);
        }
コード例 #31
0
        public static GovTalkMessageEntity CreateBaseRequest(String serviceName, BaseMessageEntity message)
        {
            var auth = new AuthenticationEntity
            {
                Method = "clear",
                Value  = ConfigurationManager.AppSettings["GovTalkPassword"]
            };

            var idAuth = new IDAuthenticationEntity
            {
                SenderID       = ConfigurationManager.AppSettings["GovTalkUserName"],
                Authentication = auth,
            };

            var senderDetails = new SenderDetailsEntity
            {
                EmailAddress     = "nomail",
                IDAuthentication = idAuth,
            };

            var messageDetails = new MessageDetailsEntity
            {
                Class         = serviceName,
                Function      = "submit",
                Qualifier     = "request",
                CorrelationID = "cor",
            };

            var header = new HeaderEntity
            {
                SenderDetails  = senderDetails,
                MessageDetails = messageDetails,
            };

            var body = new BodyEntity
            {
                Entity = message,
            };

            var error = new ErrorEntity
            {
                EnvelopeVersion = "369.25",
                Number          = 2695,
                RaisedBy        = "me",
                Text            = "Exception",
                Type            = "TypedError"
            };

            var govTalkMessage = new GovTalkMessageEntity
            {
                EnvelopeVersion = 2.0M,
                Header          = header,
                Body            = body,
            };

            return(govTalkMessage);
        }
コード例 #32
0
        public Int32 Insert(学员在线状态 item, out ErrorEntity ErrInfo)
        {
            //Error Judge Define

            NameValueCollection parameters = new NameValueCollection();
            parameters.Add("FStudentId", item.FStudentId.ToString());
            parameters.Add("FOnlineTime", item.FOnlineTime.ToString());
            return Insert(parameters, out ErrInfo);
        }
コード例 #33
0
 public void SetItemRight()
 {
     string qid = Parameters["pquestionid"];
     string itemid = Parameters["pitemid"];
     OEQuestionItemBiz biz = new OEQuestionItemBiz();
     ErrorEntity ErrInfo = new ErrorEntity();
     biz.UpdateRight(qid, itemid, out ErrInfo);
     Response.Write(ErrInfo.ToJson());
 }
コード例 #34
0
 public void DelItem()
 {
     string _id = Parameters["pid"];
     string _date = (new DateTime()).ToString();
     PmPartymemberBiz biz = new PmPartymemberBiz();
     ErrorEntity ErrInfo = new ErrorEntity();
     biz.UpdateObject(_id, "0", _date, "", out ErrInfo);
     Response.Write(ErrInfo.ToJson());
 }
コード例 #35
0
        static private async Task <RenRenBatchRunResponseArg> agentBatchRunReponseHandler(ICollection <RequestParameterEntity> args, string method, Uri target, ICollection <BatchRunBinder> binders)
        {
            ErrorEntity error                = null;
            string      response             = string.Empty;
            RenRenBatchRunResponseArg result = null;

            try
            {
                var agent = new HttpWebRequestAgent();
                agent.Method = method;

                foreach (var parameter in args)
                {
                    agent.AddParameters(parameter.Name, Uri.EscapeDataString(parameter.Values));
                }

                //string response = string.Empty;
                if (null != target)
                {
                    response = await agent.DownloadString(target);
                }
                else
                {
                    response = await agent.DownloadString(ConstantValue.SpecificRequestUri);
                }

                Debug.WriteLine(response);
                error = (ErrorEntity)JsonUtility.DeserializeObj(new MemoryStream(Encoding.UTF8.GetBytes(response)),
                                                                typeof(ErrorEntity));

                if (error != null && error.Error_msg != null)
                {
                    // Try to translate the error mesg
                    if (RemoteErrorMsgTranslator.Instance.Ready)
                    {
                        if (RemoteErrorMsgTranslator.Instance.ErrorTable.ContainsKey(error.Error_code))
                        {
                            var errorEntity = RemoteErrorMsgTranslator.Instance.ErrorTable[error.Error_code];
                            error.Error_msg  = errorEntity.Mesg;
                            error.Error_Type = errorEntity.Type;
                        }
                    }
                    result = new RenRenBatchRunResponseArg(error);
                }
                else
                {
                    result = new RenRenBatchRunResponseArg(response, binders);
                }
            }
            catch (Exception ex)
            {
                result = new RenRenBatchRunResponseArg(ex);
            }

            return(result);
        }
コード例 #36
0
        public Int32 Insert(OEQuestionItem item, out ErrorEntity ErrInfo)
        {
            //Error Judge Define
            if (item.FQuestionId == 0)
            {
                ErrInfo = new ErrorEntity("QI010001", "归属题目ID不能为空!");
                return -1;
            }
            if (string.IsNullOrEmpty(item.FItemContent))
            {
                ErrInfo = new ErrorEntity("QI010002", "题目答案内容不能为空!");
                return -1;
            }
            if (string.IsNullOrEmpty(item.FItemFlag))
            {
                item.FItemFlag = "0";
            }
            //判断题型
            NameValueCollection where = new NameValueCollection();
            where.Add("FQuestionId", item.FQuestionId.ToString());
            List<OEQuestionItem> itemlists = new List<OEQuestionItem>();
            itemlists = Select(where);
            if (itemlists.Count > 0)
            {
                OEQuestion qitem = new OEQuestion();
                OEQuestionBiz biz = new OEQuestionBiz();
                qitem = biz.Select(item.FQuestionId.ToString());
                if (qitem.FQuestionType == "0")
                {
                    if(itemlists.Count > 1)
                    {
                        ErrInfo = new ErrorEntity("QI010003", "判断题型只能有2个备选答案!");
                        return -1;
                    }
                }
                if (qitem.FQuestionType == "1")
                {
                    if (item.FItemFlag == "1")
                    {
                        if (itemlists.Where(p => p.FItemFlag == "1").ToList<OEQuestionItem>().Count > 0)
                        {
                            ErrInfo = new ErrorEntity("QI010004", "单选题只能有一个正确答案!");
                            return -1;
                        }
                    }
                }
            }

            item.FItemId = GenerateItemId(item.FQuestionId.ToString());
            NameValueCollection parameters = new NameValueCollection();
            parameters.Add("FQuestionId", item.FQuestionId.ToString());
            parameters.Add("FItemId", item.FItemId.ToString());
            parameters.Add("FItemContent", item.FItemContent);
            parameters.Add("FItemFlag", item.FItemFlag);
            return Insert(parameters, out ErrInfo);
        }
コード例 #37
0
        public Int32 Insert(OECombineBank item, out ErrorEntity ErrInfo)
        {
            //Error Judge Define

            NameValueCollection parameters = new NameValueCollection();
            parameters.Add("FPaperId", item.FPaperId.ToString());
            parameters.Add("FQBankId", item.FQBankId.ToString());
            parameters.Add("FQBnakRate", item.FQBnakRate.ToString());
            return Insert(parameters, out ErrInfo);
        }
コード例 #38
0
        protected void Application_Error()
        {
            Exception exception = Server.GetLastError();

            if (exception != null)
            {
                var adapter = Helpers.Helper.GetDataAccessAdapter();
                ErrorEntity.LogException(adapter, exception);
            }
        }
コード例 #39
0
        public Int32 Insert(OEPaperDifficulty item, out ErrorEntity ErrInfo)
        {
            //Error Judge Define

            NameValueCollection parameters = new NameValueCollection();
            parameters.Add("FPaperId", item.FPaperId.ToString());
            parameters.Add("FDifficulty", item.FDifficulty);
            parameters.Add("FRate", item.FRate.ToString());
            return Insert(parameters, out ErrInfo);
        }
コード例 #40
0
        public void Test()
        {
            ErrorEntity entity = new ErrorEntity();

            entity += "hello";
            entity += 1;
            entity += 2;
            Assert.AreEqual <int>(1, entity.Messages.Count);
            Assert.AreEqual <int>(2, entity.Codes.Count);
        }
コード例 #41
0
 public void DelFunction()
 {
     string idlist = Parameters["pparm"];
     SysFunListBiz biz = new SysFunListBiz();
     ErrorEntity ErrInfo = new ErrorEntity();
     NameValueCollection where = new NameValueCollection();
     where.Add("condition","FFunId in " + idlist);
     biz.Delete(where, out ErrInfo);
     Response.Write(ErrInfo.ToJson());
 }
コード例 #42
0
        public Int32 Insert(OEErrorQuestion item, out ErrorEntity ErrInfo)
        {
            //Error Judge Define

            NameValueCollection parameters = new NameValueCollection();
            parameters.Add("FStudentId", item.FStudentId.ToString());
            parameters.Add("FQuestionId", item.FQuestionId.ToString());
            parameters.Add("FCollectFlag", item.FCollectFlag);
            return Insert(parameters, out ErrInfo);
        }
コード例 #43
0
        /// <exception cref="VPackParserException"/>
        private string createErrorMessage(Response response)
        {
            string      errorMessage;
            ErrorEntity errorEntity = this.vpack.deserialize(response.getBody(
                                                                 ), typeof(ErrorEntity));

            errorMessage = string.format("Response: %s, Error: %s - %s", errorEntity.getCode(
                                             ), errorEntity.getErrorNum(), errorEntity.getErrorMessage());
            return(errorMessage);
        }
コード例 #44
0
        public Int32 Insert(OEChooseQuestion item, out ErrorEntity ErrInfo)
        {
            //Error Judge Define

            NameValueCollection parameters = new NameValueCollection();
            parameters.Add("FPaperId", item.FPaperId.ToString());
            parameters.Add("FDetailId", item.FDetailId.ToString());
            parameters.Add("FQuestionId", item.FQuestionId.ToString());
            return Insert(parameters, out ErrInfo);
        }
コード例 #45
0
ファイル: OEStudentBiz.cs プロジェクト: hqsoftmac/HQDEV1-1
        public Int32 Insert(OEStudent item, out ErrorEntity ErrInfo)
        {
            //Error Judge Define
            if (string.IsNullOrEmpty(item.FStudentName))
            {
                ErrInfo = new ErrorEntity("ST010001", "学员姓名不能为空!");
                return -1;
            }

            if (string.IsNullOrEmpty(item.FStudentIDNumber))
            {
                ErrInfo = new ErrorEntity("ST010002", "学员身份证号码不能为空!");
                return -1;
            }

            if (!ChkIDDuplicate(item.FStudentIDNumber))
            {
                ErrInfo = new ErrorEntity("ST010003", "学员身份证已经存在,不能新增!");
                return -1;
            }

            if (string.IsNullOrEmpty(item.FStudentPSW))
            {
                item.FStudentPSW = Utils.Md5Sign("123456");
            }
            if (!string.IsNullOrEmpty(item.FEmail))
            {
                if (!PublicMethod.IsEmail(item.FEmail))
                {
                    ErrInfo = new ErrorEntity("ST010003", "请正确输入邮件地址!");
                    return -1;
                }
            }
            if (!string.IsNullOrEmpty(item.FMobile))
            {
                if (!PublicMethod.IsMobile(item.FMobile))
                {
                    ErrInfo = new ErrorEntity("ST010004", "请正确输入手机号码!");
                    return -1;
                }
            }
            string errstr = "";
            if (!PublicMethod.IsIdNo(item.FStudentIDNumber,out  errstr))
            {
                ErrInfo = new ErrorEntity("ST010005", "请正确输入身份证号码!");
                return -1;
            }
            NameValueCollection parameters = new NameValueCollection();
            parameters.Add("FStudentName", item.FStudentName);
            parameters.Add("FStudentIDNumber", item.FStudentIDNumber);
            parameters.Add("FEmail", item.FEmail);
            parameters.Add("FMobile", item.FMobile);
            parameters.Add("FStudentPSW", item.FStudentPSW);
            return Insert(parameters, out ErrInfo);
        }
コード例 #46
0
        public void ErrorEntityTest()
        {
            var entity = new ErrorEntity();

            entity += "Username must be required.";
            entity += "Titile must be required.";
            entity += "Domain must be required.";

            Assert.AreEqual <int>(3, entity.Messages.Count);
            Trace.WriteLine(string.Join("\n", entity.Messages));
        }
コード例 #47
0
        public virtual bool Execute(object[] args)
        {
            var info = new ErrorEntity
            {
                WhereExp = "InsertTime<@InsertTime",
                SaveType = SaveType.Remove
            };

            info.SetParameter("InsertTime", DateTime.Now.AddDays(0 - Convert.ToInt32(args[0])));
            return(Winner.Creator.Get <IContext>().Commit(Repository.Save(info)));
        }
コード例 #48
0
ファイル: Extension.cs プロジェクト: wangscript007/iBlog
        /// <summary>
        /// The to error entity.
        /// </summary>
        /// <param name="exception">
        /// The exception.
        /// </param>
        /// <returns>
        /// The <see cref="ErrorEntity"/>.
        /// </returns>
        public static ErrorEntity ToErrorEntity(this Exception exception)
        {
            var errorEntity = new ErrorEntity
            {
                ThrowTime   = DateTime.Now,
                Message     = exception.Message.Replace("'", "''"),
                Description = exception.ToString().Replace("'", "''")
            };

            return(errorEntity);
        }
コード例 #49
0
        /// <summary>
        /// 填充验证信息
        /// </summary>
        /// <param name="info"></param>
        private static void FillIdentity(ErrorEntity info)
        {
            var identity = Ioc.Resolve <IIdentityApplicationService>().Get <IdentityEntity>();

            if (identity != null)
            {
                info.Account = new AccountEntity {
                    Id = identity.Id
                };
            }
        }
コード例 #50
0
        public void OperaorErrorEntity()
        {
            ErrorEntity entity = new ErrorEntity();

            entity += "hello";
            entity += 1;
            entity += 2;

            var m = entity.Messages;
            var c = entity.Codes;
        }
コード例 #51
0
        public void InsertApplicationError(ErrorEntity errorEntity)
        {
            var insertErrorStmt =
                @"INSERT INTO [dbo].[Errors]([ErrorDateTime],[ErrorMessage],[ErrorDescription],[UserID])
                               VALUES ('{0}','{1}','{2}',{3})";

            ExecuteCommand(string.Format(insertErrorStmt,
                                         errorEntity.ErrorDateTime,
                                         errorEntity.ErrorMessage.Replace("'", ""),
                                         errorEntity.ErrorDescription.Replace("'", ""),
                                         errorEntity.UserID));
        }
コード例 #52
0
 /// <summary>
 /// The add error.
 /// </summary>
 /// <param name="exception">
 /// The exception.
 /// </param>
 public void AddError(Exception exception)
 {
     try
     {
         ErrorEntity errorEntity = exception.ToErrorEntity();
         this.errorTable.InsertOnSubmit(errorEntity);
         this.context.SubmitChanges();
     }
     catch (Exception)
     {
     }
 }
コード例 #53
0
        public void Test()
        {
            var entity = new ErrorEntity();

            entity += "user name cannot be null";
            entity += "password cannot be null";
            entity += "error\n";
            entity += 1;
            entity += 2;
            Assert.AreEqual(3, entity.Messages.Count);
            Assert.AreEqual(2, entity.Codes.Count);
            Trace.WriteLine(String.Join("\n", entity.Messages));
        }
コード例 #54
0
        public void Test()
        {
            var entity = new ErrorEntity();

            entity += "用户名不能为空";
            entity += "职务不能为空";
            entity += "关注领域不能为空";
            entity += 1;
            entity += 2;
            Assert.AreEqual <int>(3, entity.Messages.Count);
            Assert.AreEqual <int>(2, entity.Codes.Count);
            Trace.WriteLine(string.Join("\n", entity.Messages));
        }
コード例 #55
0
ファイル: ErrorCode.cs プロジェクト: K1vs/DotChat
        public ErrorCode(ErrorType type, ErrorModule module, ErrorOperation operation, ErrorScope scope)
        {
            Family    = (ErrorFamily)Enum.ToObject(typeof(ErrorFamily), (int)type / 1000);
            Type      = ErrorType.Unknown;
            Module    = module;
            Operation = operation;
            Scope     = scope;
            Entity    = ErrorEntity.None;
            long shift = 1;

            Code = (long)scope + (long)operation * (shift *= 100000) + (long)module * (shift *= 1000) +
                   (long)type * (shift * 100);
            Name = $"{type}{module}{operation}{scope}";
        }
コード例 #56
0
ファイル: ErrorCode.cs プロジェクト: K1vs/DotChat
        public ErrorCode(ErrorFamily family, ErrorModule module, ErrorOperation operation, ErrorScope scope)
        {
            Family    = family;
            Type      = ErrorType.Unknown;
            Module    = module;
            Operation = operation;
            Scope     = scope;
            Entity    = ErrorEntity.None;
            long shift = 1;

            Code = (long)scope + (long)operation * (shift *= 100000) + (long)module * (shift *= 1000) +
                   (long)family * (shift * 100000);
            Name = $"{family}{module}{operation}{scope}";
        }
コード例 #57
0
ファイル: BottomTabs.cs プロジェクト: sahilagnihotri/Chess
        private void AppendErrorToText(ErrorEntity error)
        {
            txtTestRunErrors.AppendText(String.Format("Error: {0}\n", error.Message));

            if (error.HasInnerErrors)
            {
                txtTestRunErrors.AppendText("\nInner Errors:\n");
                foreach (var innerError in error.EntitiesOfType <ErrorEntity>())
                {
                    AppendErrorToText(innerError);
                }
                txtTestRunErrors.AppendText(">>> End Inner Errors\n");
            }
        }
コード例 #58
0
        public async Task LogErrorAsync(int code, string ip, string page, string referrer, Exception exception)
        {
            var error = new ErrorEntity("www.wixtoolset.com")
            {
                StatusCode = code,
                IP         = ip,
                Url        = page,
                Referrer   = referrer,
                Text       = exception?.Message,
                StackTrace = exception?.StackTrace,
            };

            await this.WriteToTableStorage("Errors", error);
        }
コード例 #59
0
ファイル: ErrorCode.cs プロジェクト: K1vs/DotChat
        public ErrorCode(ErrorFamily family, ErrorModule module, ErrorOperation operation, ErrorEntity entity)
        {
            Family    = family;
            Type      = ErrorType.Unknown;
            Module    = module;
            Operation = operation;
            Scope     = (ErrorScope)Enum.ToObject(typeof(ErrorScope), (int)entity / 1000);
            Entity    = entity;
            long shift = 1;

            Code = (long)entity + (long)operation * (shift *= 100000) + (long)module * (shift *= 1000) +
                   (long)family * (shift * 100);
            Name = $"{family}{module}{operation}{entity}";
        }
コード例 #60
0
ファイル: ErrorCode.cs プロジェクト: K1vs/DotChat
        public ErrorCode(ErrorType type, ErrorModule module, ErrorOperation operation, ErrorEntity entity)
        {
            Family    = (ErrorFamily)Enum.ToObject(typeof(ErrorFamily), (int)type / 1000);
            Type      = type;
            Module    = module;
            Operation = operation;
            Scope     = (ErrorScope)Enum.ToObject(typeof(ErrorScope), (int)entity / 1000);
            Entity    = entity;
            long shift = 1;

            Code = (long)entity + (long)operation * (shift *= 100000) + (long)module * (shift *= 1000) +
                   (long)type * (shift * 100);
            Name = $"{type}{module}{operation}{entity}";
        }