Demo entry 6769605

native

   

Submitted by anonymous on Nov 07, 2018 at 03:30
Language: C#. Code size: 3.5 kB.

namespace InterfaceQuiz
{
    [Serializable]
    class EmpElements
    {
        int employeeId;

        public int EmployeeId
        {
            get { return employeeId; }
            set { employeeId = value; }
        }

        string firstName;

        public string FirstName
        {
            get { return firstName; }
            set { firstName = value; }
        }

        string lastName;
        private string email;

        public string Email
        {
            get { return email; }
            set { email = value; }
        }

        string phone_Number;
        string hireDate;
        private string jobId;

        public string JobId
        {
            get { return jobId; }
            set { jobId = value; }
        }

        private int salary;

        public int Salary
        {
            get { return salary; }
            set { salary = value; }
        }

        string commissionPct;
        int managerId;
        private int departmentId;

        public int DepartmentId
        {
            get { return departmentId; }
            set { departmentId = value; }
        }


        /// <summary>
        /// 2번 문제의 EmpnoSearch 메소드를 수행할때 저장프로시저에서 구한 데이터로 멤버를 초기화함
        /// </summary>
        /// <param name="employeeId">사번</param>
        /// <param name="firstName">이름</param>
        /// <param name="email">이메일</param>
        /// <param name="jobId">직급</param>
        /// <param name="salary">월급</param>
        /// <param name="departmentId">부서번호</param>
        public EmpElements(int employeeId, string firstName, string email, string jobId, int salary, int departmentId)
        {
            this.employeeId = employeeId;
            this.firstName = firstName;
            this.email = email;
            this.jobId = jobId;
            this.salary = salary;
            this.departmentId = departmentId;
        }

        public EmpElements(int employeeId, string firstName, string lastName, string email, string phone_Number, string hireDate, string jobId, int salary, string commissionPct, int managerId, int departmentId)
        {
            this.employeeId = employeeId;
            this.firstName = firstName;
            this.lastName = lastName;
            this.email = email;
            this.phone_Number = phone_Number;
            this.hireDate = hireDate;
            this.jobId = jobId;
            this.salary = salary;
            this.commissionPct = commissionPct;
            this.managerId = managerId;
            this.departmentId = departmentId;
        }

        public EmpElements()
        {
        }

        public void Writer(object obj)
        {
            string path = @"C:\C#\EMPLOYEE.bin";

            FileStream file = new FileStream(path, FileMode.Create, FileAccess.Write);
            SoapFormatter soapFormatter = new SoapFormatter();          //SOAP 형태(XML)형태로 직렬화

            soapFormatter.Serialize(file, obj);
            file.Close();
        }

        public object Reader()
        {
            string path = @"C:\C#\EMPLOYEE.bin";
            FileStream file = new FileStream(path, FileMode.Open, FileAccess.Read);
            SoapFormatter soapFormatter = new SoapFormatter();         //SOAP 형태(XML)형태로 역직렬화

            object obj = soapFormatter.Deserialize(file);
            file.Close();   

            return obj;
        }
    }
}

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).