Skip to content
running_Turtle edited this page Dec 7, 2024 · 5 revisions

关于 ResumeInfo 的设计

public class ResumeInfo
{
    BaseInfo baseInfo = new BaseInfo();
    EduBG eduBG = new EduBG();
    List<string> skill = new List<string>();
    List<WorkExper> workExpers = new List<WorkExper>();

    public ResumeInfo()
    {
    }

    public ResumeInfo(BaseInfo baseInfo, EduBG eduBG, List<string> skill, List<WorkExper> workExpers)
    {
        BaseInfo = baseInfo;
        EduBG = eduBG;
        this.skill = skill;
        this.workExpers = workExpers;
    }


    /// <summary>
    /// 技能
    /// </summary>
    public List<string> Skills { get => skill; set => skill = value; }

    /// <summary>
    /// 教育背景
    /// </summary>
    public EduBG EduBG { get => eduBG; set => eduBG = value; }

    /// <summary>
    /// 工作经历
    /// </summary>
    public List<WorkExper> WorkExpers { get => workExpers; set => workExpers = value; }

    /// <summary>
    /// 基础信息
    /// </summary>
    public BaseInfo BaseInfo { get => baseInfo; set => baseInfo = value; }

    public override string ToString()
    {
        StringBuilder sb = new StringBuilder();

        sb.AppendLine("=== Resume Information ===");
        sb.AppendLine("Basic Information:");
        sb.AppendLine(BaseInfo.ToString());
        sb.AppendLine();

        sb.AppendLine("Education Background:");
        sb.AppendLine(EduBG.ToString());
        sb.AppendLine();

        sb.AppendLine("Skills:");
        if (Skills.Any())
            sb.AppendLine(string.Join(", ", Skills));
        else
            sb.AppendLine("None");
        sb.AppendLine();

        sb.AppendLine("Work Experience:");
        if (WorkExpers.Any())
        {
            foreach (var workExper in WorkExpers)
            {
                sb.AppendLine(workExper.ToString());
            }
        }
        else
        {
            sb.AppendLine("No work experience.");
        }

        return sb.ToString();
    }
}

关于 BaseInfo 的设计

public class BaseInfo
{
    private int id;
    private string name = string.Empty;
    private string phone = string.Empty;
    private int age;

    public BaseInfo() { }

    public BaseInfo(int id, string name,int age, string phone)
    {
        this.id = id;
        this.name = name;
        this.age = age;
        this.phone = phone;
    }

    /// <summary>
    /// 信息ID
    /// </summary>
    public int Id { get => id; set => id = value; }

    /// <summary>
    /// 电话
    /// </summary>
    public string Phone { get => phone; set => phone = value; }

    /// <summary>
    /// 名字
    /// </summary>
    public string Name { get => name; set => name = value; }

    /// <summary>
    /// 年龄
    /// </summary>
    public int Age { get => age; set => age = value; }


    public override string ToString()
    {
        return $"ID: {id}, Name: {name}, Age: {age}, Phone: {phone}";
    }
}

关于 EduBG 的设计

public class EduBG
{
    private string school_name = string.Empty;
    private string schooll_type = string.Empty;
    private string degree = string.Empty;
    private string major = string.Empty;

    public EduBG() { }

    public EduBG(string school_name, string schooll_type, string degree, string major)
    {
        this.school_name = school_name;
        this.schooll_type = schooll_type;
        this.degree = degree;
        this.major = major;
    }

    /// <summary>
    /// 最高学历学校
    /// </summary>
    public string School_name { get => school_name; set => school_name = value; }

    /// <summary>
    /// 985 211/211/空值
    /// </summary>
    public string Schooll_type { get => schooll_type; set => schooll_type = value; }

    /// <summary>
    /// 最高学历 博士/MBA/EMBA/硕士/本科/大专/高中/中专/初中
    /// </summary>
    public string Degree { get => degree; set => degree = value; }

    /// <summary>
    /// 最高学历专业
    /// </summary>
    public string Major { get => major; set => major = value; }

    public override bool Equals(object? obj)
    {
        return obj is EduBG bG &&
               school_name == bG.school_name &&
               schooll_type == bG.schooll_type &&
               degree == bG.degree &&
               major == bG.major;
    }

    public override int GetHashCode()
    {
        return HashCode.Combine(school_name, schooll_type, degree, major);
    }

    public override string ToString()
    {
        return $"School Name: {school_name}, School Type: {schooll_type}, Degree: {degree}, Major: {major}";
    }
}

关于 WorkExper 的设计

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Models.ResumeInfo.Apart
{
    public class WorkExper
    {
        string start_time_year = string.Empty;
        string start_time_month = string.Empty;
        string end_time_year = string.Empty;
        string end_time_month = string.Empty;
        bool still_active;
        string company_name = string.Empty;
        string department = string.Empty;
        string location = string.Empty;
        string job_title = string.Empty;

        public WorkExper()
        {
        }

        public WorkExper(string start_time_year, string start_time_month, string end_time_year, string end_time_month, bool still_active, string company_name, string department, string location, string job_title)
        {
            this.start_time_year = start_time_year;
            this.start_time_month = start_time_month;
            this.end_time_year = end_time_year;
            this.end_time_month = end_time_month;
            this.still_active = still_active;
            this.company_name = company_name;
            this.department = department;
            this.location = location;
            this.job_title = job_title;
        }

        /// <summary>
        /// 开始时间年份
        /// </summary>
        public string Start_time_year { get => start_time_year; set => start_time_year = value; }

        /// <summary>
        /// 开始时间月份
        /// </summary>
        public string Start_time_month { get => start_time_month; set => start_time_month = value; }

        /// <summary>
        /// 	结束时间年份
        /// </summary>
        public string End_time_year { get => end_time_year; set => end_time_year = value; }

        /// <summary>
        /// 结束时间月份
        /// </summary>
        public string End_time_month { get => end_time_month; set => end_time_month = value; }

        /// <summary>
        /// 是否仍在
        /// </summary>
        public bool Still_active { get => still_active; set => still_active = value; }

        /// <summary>
        /// 公司/学校/社团名
        /// </summary>
        public string Company_name { get => company_name; set => company_name = value; }

        /// <summary>
        /// 所属部门
        /// </summary>
        public string Department { get => department; set => department = value; }

        /// <summary>
        /// 地点
        /// </summary>
        public string Location { get => location; set => location = value; }

        /// <summary>
        /// 职位名
        /// </summary>
        public string Job_title { get => job_title; set => job_title = value; }

        public override bool Equals(object? obj)
        {
            if (obj is WorkExper other)
            {
                return start_time_year == other.start_time_year &&
                       start_time_month == other.start_time_month &&
                       end_time_year == other.end_time_year &&
                       end_time_month == other.end_time_month &&
                       still_active == other.still_active &&
                       company_name == other.company_name &&
                       department == other.department &&
                       location == other.location &&
                       job_title == other.job_title;
            }
            return false;
        }


        public override string ToString()
        {
            string activeStatus = still_active ? "Still Active" : $"{end_time_year}-{end_time_month}";
            return $"Company: {company_name}, Department: {department}, Location: {location}, Job Title: {job_title}, Start: {start_time_year}-{start_time_month}, End: {activeStatus}";
        }

    }
}

Clone this wiki locally