zoukankan      html  css  js  c++  java
  • 小东西

    接收前端传过来的值:

    前端url:href="/1658506266/manage/getfiles?FileUrl=/Uploads/Files/2019/07/24/efdcd38f3e3b47a993d97315b44995a6.png&FileName=1691105794_ManYee_98376740"

    var fileName = Request["FileName"];

    var fileUrl = Request["FileUrl"];

    MySql:

    查询不等于某个字段:select * from TableA a where ifnull(a.check_in_status,'') <> "UnSignedIn" ;

    JObject:不用定义具体字段,返回给前端可成json对象

    JObject jObject = new JObject();
    
                    jObject.Add("Role", role.ToString());
                    // 参会人
                    if (role == (int)AttendeeRoleEnum.Registrant)
                    {
                        jObject.Add("RoleName", "参会人");                    
                        jObject.Add("Detail", result);
                    }
                    else if (role == (int)AttendeeRoleEnum.Speaker)
                    {
                        jObject.Add("RoleName", "演讲嘉宾");
                        jObject.Add("Detail", await _registrationRestfulApiProxy.GetSpeakerDetailAsync(new SpeakerDetailRequest() { BventId = bventId, Ids = new List<string>() { attendeeId} }));
                    }
                    else if (role == (int)AttendeeRoleEnum.EssayExpert)
                    {
                        jObject.Add("RoleName", "评审专家");
                        jObject.Add("Detail", await _registrationRestfulApiProxy.GetEssayExpertDetailAsync(new SpeakerDetailRequest() { BventId = bventId, Ids = new List<string>() { attendeeId } }));
                    }

    取值:

    result.Property("attendeeRoles").First.ToObject<List<int>>();  //
    "attendeeRoles" json字符串中的key

    反射:(使用类扩展)判断一个类中是否包含某一个属性,同一个命名空间下。

    public static class GuestViewModelExtra
        {
            private static Type _type = typeof(GuestViewModel);
            /// <summary>
            /// 是否包含属性
            /// </summary>
            /// <param name="obj"></param>
            /// <param name="name"></param>
            /// <returns></returns>
            public static bool IsExistProperty(this GuestViewModel obj, string name)
            {
                if (obj != null && !string.IsNullOrEmpty(name))
                {
                    PropertyInfo findedPropertyInfo = _type.GetProperty(name);
                    return (findedPropertyInfo != null);
                }
                return false;
            }
            /// <summary>
            /// 获取属性值
            /// </summary>
            /// <param name="name"></param>
            /// <param name="entity"></param>
            /// <returns></returns>
            public static object GetValue(this GuestViewModel entity, string name)
            {
                try
                {
                    PropertyInfo p = _type.GetProperty(name);
                    if (p != null)
                    {
                        return p.GetValue(entity);
                    }
                    return null;
                }
                catch
                {
                    return null;
                }
    
            }
        }
    public class GuestViewModel : IViewModel
        {
            public string Id { get; set; }
    
            /// <summary>
            /// 
            /// </summary>
            public string UserId { get; set; }
    
            /// <summary>
            /// 会议id
            /// </summary>
            public string BventId { get; set; }
    
            /// <summary>
            /// 参会人类别id
            /// </summary>
            public string AttendeeTypeId { get; set; }
    
            /// <summary>
            /// 全名
            /// </summary>
            public string FullName { get; set; }
    
            /// <summary>
            ////// </summary>
            public string FirstName { get; set; }
    }

    正则:从字符串中找到url链接

    Regex regex = new Regex(@"(https://|http://)?([w-]+.)+[w-]+(/[w- ./?%&=]*)?");
                MatchCollection matches = regex.Matches(command.Content);
                // 如果Content中包含一个url链接,则以按钮形式发送消息
                if (matches.Count == 1)
                {
                    sendMsgParams.MsgBody.Type = 2;
                    sendMsgParams.MsgBody.Buttons.Add(new Button()
                    {
                        Style = 1,
                        Title = "查看详情",
                        Url = matches.FirstOrDefault().Groups[0].ToString()
                    });
                }
    再求一个能匹配下面含分类的正则。比如:http://www.ok.com/this-is-a-article.html或者http://www.ok.com/******/
    正则:(?i)(http://|https://)?(w+.){1,3}(com(.cn)?|cn|net|info|org|us|tk)

    比较
    两个字符串:忽略大小写
    string.Equals(a.FieldName, item.Key, StringComparison.OrdinalIgnoreCase)


    // 获取文件相对路径
    var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "StyleTemplate", "border1.png");
    StyleTemplate:文件夹名称  
  • 相关阅读:
    Linux之文件处理命令
    Linux基础命令
    rip实验
    Linux基础之磁盘分区
    mysql安装
    centos Apache、php、mysql默认安装路径
    You probably tried to upload too large file. Please refer to documentation for ways to workaround this limit.
    Wrong permissions on configuration file, should not be world writable!
    机器会学习么 学习总结
    实验 5 Spark SQL 编程初级实践
  • 原文地址:https://www.cnblogs.com/yxzs/p/11237450.html
Copyright © 2011-2022 走看看