private Queue <string> GetByQueue(object obj) { //Enum Type var objType = obj.GetType(); //Class Type var objDeclaringType = objType.DeclaringType; //1.Add Class Attr Queue <string> q = new Queue <string>(); //ClassAttribute attrClass = objDeclaringType.GetCustomAttributes(typeof(ClassAttribute), true)[0] as ClassAttribute; //q.Enqueue(attrClass.Title); //2.Add Enum Attr EnumAttribute attrEnum = objType.GetCustomAttributes(typeof(EnumAttribute), true)[0] as EnumAttribute; foreach (var item in attrEnum.Titles) { q.Enqueue(item); } //3. Add Enum field Attr FieldAttribute attrEnumField = Attribute.GetCustomAttribute(obj.GetType().GetMember(obj.ToString())[0], typeof(FieldAttribute)) as FieldAttribute; foreach (string item in attrEnumField.Titles) { q.Enqueue(item); } //q.Enqueue(attrEnumField.Titles[0]); return(q); }
public JsonResult GetPriceRange() { var result = new ReturnMessage(false) { Message = "获取失败!" }; try { //string[] names = System.Enum.GetNames(typeof(QX360.Model.Enums.DistanceRange)); int[] values = (int[])System.Enum.GetValues(typeof(QX360.Model.Enums.PriceRange)); List <KeyValueEntity> list = new List <KeyValueEntity>(); for (int i = 0; i < values.Length; i++) { var discript = EnumAttribute.GetDescription((QX360.Model.Enums.PriceRange)values[i]); list.Add(new KeyValueEntity() { ItemId = values[i].ToString(), ItemName = discript }); } result.IsSuccess = true; result.Message = "获取成功!"; result.ResultData["List"] = list; } catch (Exception ex) { ex.Data["Method"] = "DataItemEnumsController>>GetPriceRange"; new ExceptionHelper().LogException(ex); } return(Json(result, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 从枚举类型和它的特性读出并返回一个键值对 /// </summary> /// <param name="enumType">Type,该参数的格式为typeof(需要读的枚举类型)</param> /// <returns>键值对</returns> public static Dictionary <String, EnumAttribute> ListEnumExtendAttribute(Type enumType) { Dictionary <String, EnumAttribute> nvc = new Dictionary <String, EnumAttribute>(); Type typeDescription = typeof(EnumAttribute); System.Reflection.FieldInfo[] fields = enumType.GetFields(); string strText = string.Empty; string strValue = string.Empty; foreach (FieldInfo field in fields) { if (field.FieldType.IsEnum) { strValue = ((int)enumType.InvokeMember(field.Name, BindingFlags.GetField, null, null, null)).ToString(); object[] arr = field.GetCustomAttributes(typeDescription, true); strText = field.Name; EnumAttribute item = null; if (arr.Length > 0) { item = (EnumAttribute)arr[0]; } nvc.Add(strText, item); } } return(nvc); }
/// <summary> /// 写入日志(log4net) /// </summary> /// <param name="context">提供使用</param> private void WriteLog(ExceptionContext context) { if (context == null) { return; } if (OperatorProvider.Provider.Current() == null) { return; } if (OperatorProvider.Provider.IsOverdue()) { return; } var log = LogFactory.GetLogger(context.Controller.ToString()); Exception Error = context.Exception; LogMessage logMessage = new LogMessage(); logMessage.OperationTime = DateTime.Now; logMessage.Url = HttpContext.Current.Request.RawUrl; logMessage.Class = context.Controller.ToString(); logMessage.Ip = Net.Ip; logMessage.Host = Net.Host; logMessage.Browser = Net.Browser; if (null != OperatorProvider.Provider.Current()) { logMessage.UserName = OperatorProvider.Provider.Current().Account + "(" + OperatorProvider.Provider.Current().UserName + ")"; } //if (Error.InnerException == null) //{ // logMessage.ExceptionInfo = Error.Message; //} //else //{ // logMessage.ExceptionInfo = Error.InnerException.Message; //} logMessage.ExceptionInfo = Newtonsoft.Json.JsonConvert.SerializeObject(Error); //logMessage.ExceptionSource = Error.Source; //logMessage.ExceptionRemark = Error.StackTrace; string strMessage = new LogFormat().ExceptionFormat(logMessage); log.Error(strMessage); LogEntity logEntity = new LogEntity(); logEntity.CategoryId = 4; logEntity.OperateTypeId = ((int)OperationType.Exception).ToString(); logEntity.OperateType = EnumAttribute.GetDescription(OperationType.Exception); logEntity.OperateAccount = logMessage.UserName; if (null != OperatorProvider.Provider.Current()) { logEntity.OperateUserId = OperatorProvider.Provider.Current().UserId; } logEntity.ExecuteResult = -1; logEntity.ExecuteResultJson = strMessage; logEntity.Module = SystemInfo.CurrentModuleName; logEntity.ModuleId = SystemInfo.CurrentModuleId; logEntity.WriteLog(); //SendMail(strMessage); }
private void WriteLog(ExceptionContext context) { if (context == null) { return; } var log = LogFactory.GetLogger(context.Controller.ToString()); var paramsForm = context.RequestContext.HttpContext.Request.Form; Exception error = context.Exception; LogMessage logMessage = new LogMessage { CategoryId = (int)DbLogType.Exception, OperateType = EnumAttribute.GetDescription(DbLogType.Exception), ExecuteResult = -1, MethodName = (string)context.RouteData.Values["action"], Parameters = ConvertArgumentsToJson(paramsForm.ToDictionary()), Exception = error.InnerException == null ? error.Message : error.InnerException.Message, ExceptionSource = error.Source, ExceptionRemark = error.StackTrace, }; LogRepository.LogError(logMessage, "错误日志"); #if !DEBUG SendMail(logMessage.ExecuteResultJson); #endif }
/// <summary> /// 获取数据库连接信息 /// </summary> /// <returns>数据库连接信息</returns> public unsafe Sql.Connection Get() { ProviderAttribute provider = EnumAttribute <Provider, ProviderAttribute> .Array((byte)Provider); byte *buffer = AutoCSer.UnmanagedPool.Default.Get(); try { using (CharStream connectionStream = new CharStream((char *)buffer, AutoCSer.UnmanagedPool.DefaultSize >> 1)) { connectionStream.SimpleWriteNotNull("Provider="); connectionStream.Write(provider.Name); connectionStream.SimpleWriteNotNull(";Data Source="); connectionStream.Write(DataSource); if (Password != null) { connectionStream.WriteNotNull(";Database Password="******";Extended Properties='"); connectionStream.Write(provider.Excel); connectionStream.WriteNotNull(IsTitleColumn ? ";HDR=YES;IMEX=" : ";HDR=NO;IMEX="); AutoCSer.Extension.Number.ToString((byte)Intermixed, connectionStream); connectionStream.Write('\''); return(new Sql.Connection { Type = ClientKind.Excel, ConnectionString = connectionStream.ToString() }); } } finally { AutoCSer.UnmanagedPool.Default.Push(buffer); } }
/// <summary>Gets the holiday calendar from a specific enumeration, where the elements of the enumeration has to /// have some <see cref="HolidayAttribute"/> attribute containing the holiday information and the enumeration /// has to have a <see cref="CustomHolidayCalendarAttribute"/>. /// </summary> /// <param name="enumType">The <see cref="System.Type"/> of the enumeration where each element /// contains some <see cref="HolidayAttribute"/> attribute.</param> /// <returns>A holiday calendar with respect to <paramref name="enumType"/>.</returns> /// <exception cref="ArgumentException">Thrown if <paramref name="enumType"/> does not represent an enumeration or no attributes are given.</exception> public static IHolidayCalendar Create(Type enumType) { if ((enumType == null) || (!enumType.IsEnum)) { throw new ArgumentException("Enumeration types allowed only.", "enumType"); } CustomHolidayCalendarAttribute enumTypeAttribute = EnumAttribute.Create <CustomHolidayCalendarAttribute>(enumType); if ((enumTypeAttribute == null) || (enumTypeAttribute.FullResourceName == null) || (enumTypeAttribute.FullResourceName.Length == 0)) { throw new InvalidOperationException("The enumeration type '" + enumType.Name + "' does not contains the 'CustomHolidayCalendarAttribute' with a valid resource name."); } /* now get the list of holidays with respect to the holiday calendar: */ List <IHoliday> holidayList = new List <IHoliday>(); ResourceManager resourceManager = new ResourceManager(enumTypeAttribute.FullResourceName, enumType.Assembly); foreach (Enum holiday in Enum.GetValues(enumType)) { HolidayAttribute holidayAttribute = EnumAttribute.Create <HolidayAttribute>(holiday); if (holidayAttribute != null) { holidayList.Add(holidayAttribute.GetHoliday(resourceManager)); } } IdentifierString calendarName = new IdentifierString(enumTypeAttribute.CalendarName); /* try to get some (language depending) description of the holiday calendar: */ string description = null; if ((enumTypeAttribute.Description != null) && (String.IsNullOrEmpty(enumTypeAttribute.Description) == false)) { description = resourceManager.GetString(enumTypeAttribute.Description, Thread.CurrentThread.CurrentUICulture); } return(new CustomHolidayCalendar(calendarName, enumTypeAttribute.Region, holidayList, enumTypeAttribute.FirstDate, enumTypeAttribute.LastDate, description)); }
/// <summary> /// 写操作日志 /// </summary> public void WriteOperateLog(OperateLogModel operateLogModel) { try { if (operateLogModel.userInfo == null) { operateLogModel.userInfo = LoginUserInfo.Get(); } LogEntity logEntity = new LogEntity(); logEntity.F_CategoryId = 3; logEntity.F_OperateTypeId = ((int)operateLogModel.type).ToString(); logEntity.F_OperateType = EnumAttribute.GetDescription(operateLogModel.type); logEntity.F_OperateAccount = operateLogModel.userInfo.account; logEntity.F_OperateUserId = operateLogModel.userInfo.userId; logEntity.F_Module = operateLogModel.title; logEntity.F_ExecuteResult = 1; logEntity.F_ExecuteResultJson = "访问地址:" + operateLogModel.url; logEntity.F_SourceObjectId = operateLogModel.sourceObjectId; logEntity.F_SourceContentJson = operateLogModel.sourceContentJson; logEntity.WriteLog(); } catch (Exception) { } }
//初始化页面数据 protected void LoadBillData(string billId) { CostReportBillInfo model = CostReportBillInfo = _costReportBill.Getlmshop_CostReportBillByBillId(new Guid(billId)); txt_BillUnit.Text = model.BillUnit; txt_BillDate.Text = DateTime.Parse(model.BillDate.ToString()).ToString("yyyy-MM-dd"); txt_NoTaxAmount.Text = model.NoTaxAmount.ToString(CultureInfo.InvariantCulture); txt_Tax.Text = model.Tax.ToString(CultureInfo.InvariantCulture); txt_BillNo.Text = model.BillNo; txt_TaxAmount.Text = model.TaxAmount.ToString(CultureInfo.InvariantCulture); txt_BillCode.Text = model.BillCode; txt_BillState.Text = EnumAttribute.GetKeyName((CostReportBillState)model.BillState); txt_Memo.Text = model.Memo; var invoiceType = Request.QueryString["InvoiceType"]; if (int.Parse(invoiceType).Equals((int)CostReportInvoiceType.VatInvoice)) { VatInvoice.Visible = true; } else if (int.Parse(invoiceType).Equals((int)CostReportInvoiceType.Voucher)) { lit_BillNo.Text = "收据"; lit_TaxAmount.Visible = BillCode.Visible = txtBillCode.Visible = false; } }
/// <summary> /// 获取数据库连接信息 /// </summary> /// <param name="isPool">是否启用数据库连接池</param> /// <returns>数据库连接信息</returns> public unsafe Sql.Connection Get(bool isPool = false) { ProviderAttribute provider = EnumAttribute <Provider, ProviderAttribute> .Array((byte)Provider); AutoCSer.Memory.Pointer buffer = UnmanagedPool.Default.GetPointer(); try { using (CharStream connectionStream = new CharStream(ref buffer)) { connectionStream.SimpleWrite("Provider="); connectionStream.Write(provider.Name); connectionStream.SimpleWrite(";Data Source="); connectionStream.Write(DataSource); if (Password != null) { connectionStream.Write(";Database Password="******";Extended Properties='"); connectionStream.Write(provider.Excel); connectionStream.Write(IsTitleColumn ? ";HDR=YES;IMEX=" : ";HDR=NO;IMEX="); AutoCSer.Extensions.NumberExtension.ToString((byte)Intermixed, connectionStream); connectionStream.Write('\''); return(new Sql.Connection { Type = ClientKind.Excel, ConnectionString = connectionStream.ToString(), IsPool = isPool }); } } finally { UnmanagedPool.Default.Push(ref buffer); } }
public HttpResponseMessage CheckLogin(string openId) { LogEntity logEntity = new LogEntity(); logEntity.CategoryId = 1; logEntity.OperateTypeId = ((int)OperationType.Login).ToString(); logEntity.OperateType = EnumAttribute.GetDescription(OperationType.Login); logEntity.OperateAccount = openId; logEntity.OperateUserId = openId; logEntity.Module = "WeChat"; try { //验证账户 UserEntity userEntity = new UserBLL().WechatLogin(openId); //生成票据 var ticket = Guid.NewGuid().ToString(); //写入票据 CacheFactory.Cache().WriteCache(userEntity, ticket, DateTime.Now.AddHours(8)); //写入日志 logEntity.ExecuteResult = 1; logEntity.ExecuteResultJson = "登录成功"; logEntity.WriteLog(); return(Success("登录成功", ticket)); } catch (Exception ex) { logEntity.ExecuteResult = -1; logEntity.ExecuteResultJson = ex.Message; logEntity.WriteLog(); return(Error(ex.Message)); } }
private void BindValue(InvoiceApplyInfo applyInfo) { TbAddress.Text = applyInfo.Address; TbTelephone.Text = applyInfo.Telephone; TbReceiver.Text = applyInfo.Receiver; TbApplyRemark.Text = applyInfo.ApplyRemark; TbRetreat.Text = applyInfo.RetreatRemark; TbTitleType.Text = EnumAttribute.GetKeyName((ApplyInvoiceTitleType)applyInfo.InvoiceTitleType); TbTitle.Text = applyInfo.Title; TbAmount.Text = applyInfo.Amount.ToString("#0.00"); TbPerAmount.Text = applyInfo.Amount.ToString("#0.00"); TbOrderNo.Text = applyInfo.TradeCode; TbThirdPartyOrderNo.Text = applyInfo.ThirdPartyCode; BtSave.Text = IsAudit ? "核准" : "开票"; BtBack.Text = IsAudit ? "核退" : "退回"; IsSpecial = applyInfo.ApplyType == (int)ApplyInvoiceType.Special; if (applyInfo.InvoiceTitleType == (int)ApplyInvoiceTitleType.Company) { TbContactAddress.Text = applyInfo.ContactAddress; TbContactPhone.Text = applyInfo.ContactTelephone; TbTaxNumber.Text = applyInfo.TaxpayerNumber; TbBankName.Text = applyInfo.BankName; TbBankAccountNo.Text = applyInfo.BankAccountNo; IsCompany = true; } else { IsCompany = false; } RAM.ResponseScripts.Add(string.Format("load({0},{1});", !IsCompany?1:0, IsAudit ? 0 : 1)); }
/// <summary> /// Populates the element (including children) with information from its XML definition. /// </summary> /// <param name="Input">XML definition.</param> public override void FromXml(XmlElement Input) { base.FromXml(Input); this.sigmaX = new DoubleAttribute(Input, "sigmaX"); this.sigmaY = new DoubleAttribute(Input, "sigmaY"); this.tileMode = new EnumAttribute <SKShaderTileMode>(Input, "tileMode"); }
/// <summary> /// Populates the element (including children) with information from its XML definition. /// </summary> /// <param name="Input">XML definition.</param> public override void FromXml(XmlElement Input) { base.FromXml(Input); this.order = new EnumAttribute <FlexibleOrder>(Input, "order"); this.horizontalDirection = new EnumAttribute <HorizontalDirection>(Input, "horizontalDirection"); this.verticalDirection = new EnumAttribute <VerticalDirection>(Input, "verticalDirection"); }
private void BindApplyKindType() { var dataSource = EnumAttribute.GetDict <ApplyInvoiceSourceType>(); DdlKindType.DataSource = dataSource; DdlKindType.DataBind(); DdlKindType.SelectedValue = string.Format("{0}", (int)ApplyInvoiceSourceType.All); }
static Coder() { codes = new StringArray[EnumAttribute <CodeLanguage> .GetMaxValue(-1) + 1]; for (int index = codes.Length; index != 0; codes[--index] = new StringArray()) { ; } }
public AttributeModel(EnumAttribute type, int baseValue, int raceMod, int nationMod, List <AttributeModModel> dynamicMod) { Type = type; BaseValue = baseValue; RaceMod = raceMod; NationMod = nationMod; DynamicMod = dynamicMod; }
protected string GetPaymentTypeName(object paymentType) { if (Convert.ToInt32(paymentType) > Convert.ToInt32(PaymentType.SwipeCard)) { return("待设置"); } return(EnumAttribute.GetKeyName((PaymentType)paymentType)); }
/// <summary> /// 得到采购类型 /// </summary> /// <param name="purchaseType"></param> /// <returns></returns> protected string GetPurchaseTypeName(object purchaseType) { if (purchaseType == null || purchaseType.ToString() == "0" || string.IsNullOrEmpty(purchaseType.ToString())) { return("-"); } return(EnumAttribute.GetKeyName((PurchaseType)purchaseType)); }
/// <summary> /// 写入日志(log4net) /// </summary> /// <param name="context">提供使用</param> private void WriteLog(ExceptionContext context) { string userCode = string.Empty; string userId = string.Empty; if (context == null) { return; } if (OperatorProvider.Provider.IsOverdue()) { userCode = "System"; userId = "System"; } else { userCode = OperatorProvider.Provider.Current().Account + "(" + OperatorProvider.Provider.Current().UserName + ")"; userId = OperatorProvider.Provider.Current().UserId; } var log = LogFactory.GetLogger(context.Controller.ToString()); Exception Error = GerInnerException(context.Exception); LogMessage logMessage = new LogMessage(); logMessage.OperationTime = DateTime.Now; logMessage.Url = HttpContext.Current.Request.RawUrl; logMessage.Class = context.Controller.ToString(); logMessage.Ip = Net.Ip; logMessage.Host = Net.Host; logMessage.Browser = Net.Browser; logMessage.UserName = userCode; if (Error.InnerException == null) { logMessage.ExceptionInfo = Error.Message; } else { logMessage.ExceptionInfo = Error.InnerException.Message; } logMessage.ExceptionSource = Error.Source; logMessage.ExceptionRemark = Error.StackTrace; string strMessage = new LogFormat().ExceptionFormat(logMessage); log.Error(strMessage); LogEntity logEntity = new LogEntity(); logEntity.CategoryId = 4; logEntity.OperateTypeId = ((int)OperationType.Exception).ToString(); logEntity.OperateType = EnumAttribute.GetDescription(OperationType.Exception); logEntity.OperateAccount = logMessage.UserName; logEntity.OperateUserId = userId; logEntity.ExecuteResult = -1; logEntity.ExecuteResultJson = strMessage; logEntity.WriteLog(); //LogBLL.SendMail(strMessage); }
//对账状态 protected void LoadCheckTypeStateData() { var list = EnumAttribute.GetDict <CheckType>().OrderBy(p => p.Key); ddl_CheckState.DataSource = list; ddl_CheckState.DataTextField = "Value"; ddl_CheckState.DataValueField = "Key"; ddl_CheckState.DataBind(); }
/// <summary> /// 绑定单据的类型 /// </summary> protected void BindComboBoxReceiptType() { var typeList = (Dictionary <int, string>)EnumAttribute.GetDict <CompanyFundReceiptType>(); foreach (var type in typeList) { RCB_ReceiptType.Items.Add(new RadComboBoxItem(type.Value, string.Format("{0}", type.Key))); } }
/// <summary> /// 加载补贴类型列表 /// </summary> public void LoadTypeData() { var list = EnumAttribute.GetDict <SubsidyType>(); RcbType.DataSource = list; RcbType.DataTextField = "Value"; RcbType.DataValueField = "Key"; RcbType.DataBind(); }
private void BindApplyState() { var dataSource = EnumAttribute.GetDict <ApplyInvoiceState>(); dataSource.Remove((int)ApplyInvoiceState.WaitAudit); DdlState.DataSource = dataSource; DdlState.DataBind(); DdlState.SelectedValue = string.Format("{0}", (int)ApplyInvoiceState.All); }
/// <summary> /// 写入日志(log4net) /// </summary> /// <param name="context">提供使用</param> private void WriteLog(ExceptionContext context, Exception ex) { if (context == null) { return; } //var userInfo = LoginUserInfo.Get(); var log = LogFactory.GetLogger("webapi"); Exception error = ex; var logMessage = new LogMessage { OperationTime = DateTime.Now }; if (context.HttpContext.Request.Url != null) { logMessage.Url = context.HttpContext.Request.Url.PathAndQuery; } logMessage.Class = context.Controller.ToString(); logMessage.Ip = Net.Ip; logMessage.Host = Net.Host; logMessage.Browser = Net.Browser; //if (userInfo != null) //{ // logMessage.UserName = userInfo.number + "(" + userInfo.cus_name + ")"; //} if (error.InnerException == null) { logMessage.ExceptionInfo = error.Message; } else { logMessage.ExceptionInfo = error.InnerException.Message; } logMessage.ExceptionSource = error.Source; logMessage.ExceptionRemark = error.StackTrace; string strMessage = new LogFormat().ExceptionFormat(logMessage); log.Error(strMessage); var logEntity = new LogEntity { F_CategoryId = 4, F_OperateTypeId = ((int)OperationType.Exception).ToString(), F_OperateType = EnumAttribute.GetDescription(OperationType.Exception), F_OperateAccount = logMessage.UserName }; //if (userInfo != null) //{ // logEntity.OperateUserId = userInfo.id; //} logEntity.F_ExecuteResult = -1; logEntity.F_ExecuteResultJson = strMessage; logEntity.WriteLog(); }
/// <summary> /// 操作日志 /// </summary> /// <param name="filterContext"></param> public override void OnActionExecuting(ActionExecutingContext filterContext) { HttpRequestBase request = filterContext.HttpContext.Request; var controllerName = filterContext.ActionDescriptor.ControllerDescriptor.ControllerName; var actionName = filterContext.ActionDescriptor.ActionName; switch (actionName) { case "SaveForm": _operationType = OperationType.Submit; break; case "RemoveForm": _operationType = OperationType.Delete; break; case "GetListJson": case "GetPageListJson": _operationType = OperationType.Get; break; case "Index": case "Form": case "Detail": _operationType = OperationType.Visit; break; default: _operationType = OperationType.Other; break; } if (_operationType == OperationType.Other) { if (actionName.IndexOf("Get") != -1) { _operationType = OperationType.Get; } } if (_operationType != OperationType.Visit) { LogEntity logEntity = new LogEntity(); logEntity.CategoryId = 3; logEntity.OperateTypeId = ((int)OperationType.Exception).ToString(); logEntity.OperateType = EnumAttribute.GetDescription(_operationType); logEntity.OperateAccount = OperatorProvider.Provider.Current().Account + "(" + OperatorProvider.Provider.Current().UserName + ")"; logEntity.OperateUserId = OperatorProvider.Provider.Current().UserId; logEntity.ExecuteResult = 0; logEntity.ExecuteResultJson = "QueryString:" + request.QueryString.ToString() + "|postJson:" + request.Form.ToString(); logEntity.Module = controllerName + "/" + actionName; logEntity.WriteLog(); } }
/// <summary> /// 写入日志(log4net) /// </summary> /// <param name="context">提供使用</param> private void WriteLog(ExceptionContext context) { if (context == null) { return; } var userInfo = LoginUserInfo.Get(); var log = LogFactory.GetLogger(context.Controller.ToString()); Exception Error = context.Exception; LogMessage logMessage = new LogMessage(); logMessage.OperationTime = DateTime.Now; logMessage.Url = HttpContext.Current.Request.RawUrl; logMessage.Class = context.Controller.ToString(); logMessage.Ip = Net.Ip; logMessage.Host = Net.Host; logMessage.Browser = Net.Browser; if (userInfo != null) { logMessage.UserName = userInfo.account + "(" + userInfo.realName + ")"; } if (Error.InnerException == null) { logMessage.ExceptionInfo = Error.Message; logMessage.ExceptionSource = Error.Source; logMessage.ExceptionRemark = Error.StackTrace; } else { logMessage.ExceptionInfo = Error.InnerException.Message; logMessage.ExceptionSource = Error.InnerException.Source; logMessage.ExceptionRemark = Error.InnerException.StackTrace; } string strMessage = new LogFormat().ExceptionFormat(logMessage); log.Error(strMessage); LogEntity logEntity = new LogEntity(); logEntity.F_CategoryId = 4; logEntity.F_OperateTypeId = ((int)OperationType.Exception).ToString(); logEntity.F_OperateType = EnumAttribute.GetDescription(OperationType.Exception); logEntity.F_OperateAccount = logMessage.UserName; if (userInfo != null) { logEntity.F_OperateUserId = userInfo.userId; } logEntity.F_ExecuteResult = -1; logEntity.F_ExecuteResultJson = strMessage; logEntity.WriteLog(); SendMail(strMessage); }
/// <summary>加载商品类型 /// </summary> private void LoadGoodsKindType() { var goodsKindTypeDic = (Dictionary <int, string>)EnumAttribute.GetDict <GoodsKindType>(); foreach (var item in goodsKindTypeDic.Where(ent => ent.Key != 0)) { RCB_GoodsKingType.Items.Add(new RadComboBoxItem(item.Value, string.Format("{0}", item.Key))); } RCB_GoodsKingType.Items.Insert(0, new RadComboBoxItem("请选择类型", "0")); }
//票据状态 protected void LoadBillStateData() { var list = EnumAttribute.GetDict <CostReportBillState>(); ddl_BillState.DataSource = list; ddl_BillState.DataTextField = "Value"; ddl_BillState.DataValueField = "Key"; ddl_BillState.DataBind(); ddl_BillState.Items.Insert(0, new ListItem("请选择", "")); }
//申报类型 protected void LoadReportKindData() { var list = EnumAttribute.GetDict <CostReportKind>().OrderBy(p => p.Key); ddl_ReportKind.DataSource = list; ddl_ReportKind.DataTextField = "Value"; ddl_ReportKind.DataValueField = "Key"; ddl_ReportKind.DataBind(); ddl_ReportKind.Items.Insert(0, new ListItem("全部", "")); }