예제 #1
0
        public void SaveExpData(ExperienceItem myItem)
        {
            using (var db = DBConnection.CreateConnection())
            {
                db.Open();

                var sql = "dbo.spInsertExperience";
                var cmd = new SqlCommand(sql, db);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add(new SqlParameter("@EMP_NO", myItem._EMP_NO));
                cmd.Parameters.Add(new SqlParameter("@DESIGNATION", myItem._DESIGNATION));
                cmd.Parameters.Add(new SqlParameter("@COMPANY", myItem._COMPANY));
                cmd.Parameters.Add(new SqlParameter("@DATE_START", myItem._DATE_START));
                cmd.Parameters.Add(new SqlParameter("@DATE_END", myItem._DATE_END));
                cmd.Parameters.Add(new SqlParameter("@WORK_LOCATION", myItem._WORK_LOCATION));

                cmd.ExecuteNonQuery();
                db.Close();
            }
        }
예제 #2
0
        public List <ExperienceItem> RetreiveEmpExperience(string employeeID)
        {
            var itemList = new List <ExperienceItem>();

            using (var db = DBConnection.CreateConnection())
            {
                db.Open();

                var sql = "dbo.GetSpecificExperience";
                var cmd = new SqlCommand(sql, db);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add(new SqlParameter("@EMP_NO", employeeID));
                var reader = cmd.ExecuteReader();

                while (!reader.HasRows)
                {
                    return(null);
                }

                while (reader.Read())
                {
                    var item = new ExperienceItem();
                    item._EMP_NO        = (string)reader["EMP_NO"];
                    item._DESIGNATION   = (string)reader["DESIGNATION"];
                    item._COMPANY       = (string)reader["COMPANY"];
                    item._DATE_START    = (string)reader["DATE_START"];
                    item._DATE_END      = (string)reader["DATE_END"];
                    item._WORK_LOCATION = (string)reader["WORK_LOCATION"];

                    itemList.Add(item);
                }

                db.Close();

                return(itemList);
            }
        }