Exemple #1
0
 public EmployeeDetailsModel GetUserProfileDetails(int EmpId)
 {
     try
     {
         var userData       = user.GetUserProfileDetails(EmpId);
         var profileDetails = new EmployeeDetailsModel();
         List <EmployeeEducationDetails> EEdetails = new List <EmployeeEducationDetails>();
         profileDetails.FirstName   = userData.FirstName;
         profileDetails.LastName    = userData.LastName;
         profileDetails.City        = userData.City;
         profileDetails.Country     = userData.Country;
         profileDetails.Telephone   = userData.PhoneNumber;
         profileDetails.RoleName    = "S/W Engineer";
         profileDetails.DateOfBirth = userData.DateOfBirth.ToString("MMM dd,yyyy");
         profileDetails.Email       = userData.UserAccounts.FirstOrDefault(i => i.RefEmployeeId == EmpId).UserName;
         profileDetails.ImagePath   = userData.ImagePath;
         profileDetails.Bio         = userData.Bio;
         foreach (var item in userData.EmployeeEducationDetails)
         {
             var edet = new EmployeeEducationDetails();
             edet.Degree      = item.Degree;
             edet.Institution = item.Institution;
             edet.TimePeriod  = item.FromDate.ToString("MMMM yyyy") + "~" + item.ToDate.ToString("MMMM yyyy");
             EEdetails.Add(edet);
         }
         profileDetails.EmployeeEducationDetails = EEdetails;
         List <EmployeeExperienceDetails> EExpdetails = new List <EmployeeExperienceDetails>();
         foreach (var item in userData.EmployeeExperienceDetails)
         {
             var exdet = new EmployeeExperienceDetails();
             exdet.Company    = item.CompanyName;
             exdet.Role       = item.Role;
             exdet.TimePeriod = item.FromDate.ToString("MMMM yyyy") + "~" + item.ToDate.ToString("MMMM yyyy");
             EExpdetails.Add(exdet);
         }
         profileDetails.EmployeeExperienceDetails = EExpdetails;
         return(profileDetails);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        public JsonResult EducationHistory(int EmployeeID)
        {
            List <EmployeeEducationDetails> t = new List <EmployeeEducationDetails>();
            string conn = ConfigurationManager.ConnectionStrings["kalingaPPDO"].ConnectionString;

            using (SqlConnection cn = new SqlConnection(conn))
            {
                string     myQuery = "select * from vw_EducationHistory where empid = @EmployeeID";
                SqlCommand cmd     = new SqlCommand()
                {
                    CommandText = myQuery,
                    CommandType = CommandType.Text
                };
                cmd.Parameters.AddWithValue("@EmployeeID", EmployeeID);
                cmd.Connection = cn;
                cn.Open();
                SqlDataReader dr = cmd.ExecuteReader();
                if (dr.HasRows)
                {
                    int counter = 0;
                    while (dr.Read())
                    {
                        EmployeeEducationDetails tsData = new EmployeeEducationDetails()
                        {
                            EducationID       = dr["empEducID"].ToString(),
                            Level             = dr["EducLevel"].ToString(),
                            SchoolName        = dr["SchoolName"].ToString(),
                            DegreeCourse      = dr["Degree"].ToString(),
                            YearGraduated     = dr["YearGraduated"].ToString(),
                            HighestAttainment = dr["Earned"].ToString(),
                            StartDate         = dr["StartDate"].ToString(),
                            EndDate           = dr["EndDate"].ToString(),
                            AcademicHonors    = dr["Distinction"].ToString()
                        };
                        t.Add(tsData);
                        counter++;
                    }
                }
            }
            return(Json(t, JsonRequestBehavior.AllowGet));
        }