Пример #1
0
        /// <summary>
        /// 根據聯繫ID匯出面談資料
        /// </summary>
        /// <param name="contactIdList"></param>
        /// <param name="path"></param>
        /// <returns></returns>
        public string ExportInterviewDataByContactId(List <string> contactIdList, string path)
        {
            bool isAllExport = true; ////紀錄是否有資料沒有面談資料

            try
            {
                for (int i = 0; i < contactIdList.Count; i++)
                {
                    List <InterviewData> interviewDataList = new List <InterviewData>(); ///面談資料清單
                    DataSet       ds = Talent.GetInstance().SelectContactSituationDataById(contactIdList[i]);
                    List <string> interviewIdList = new List <string>();
                    foreach (DataRow dr in ds.Tables[4].Rows)
                    {
                        interviewIdList.Add(dr[0].ToString());
                    }

                    ////代表沒有面談資料
                    if (interviewIdList.Count == 0)
                    {
                        isAllExport = false;
                        continue;
                    }

                    foreach (string interviewId in interviewIdList)
                    {
                        InterviewResults         interviewResults      = new InterviewResults();
                        InterviewData            interviewData         = new InterviewData();
                        DataSet                  interviewDataSet      = Talent.GetInstance().SelectInterviewDataById(interviewId);
                        List <InterviewInfo>     interviewInfo         = interviewDataSet.Tables[0].DataTableToList <InterviewInfo>();     ////面談基本資料
                        List <InterviewComments> interviewCommentsList = interviewDataSet.Tables[1].DataTableToList <InterviewComments>(); ////面談評語
                        List <InterviewResult>   interviewResult       = interviewDataSet.Tables[2].DataTableToList <InterviewResult>();   ////面談結果(任用評定與備註)

                        interviewResults.InterviewResult       = interviewResult[0];
                        interviewResults.InterviewCommentsList = interviewCommentsList;

                        List <ProjectExperience> projectExperienceList = interviewDataSet.Tables[3].DataTableToList <ProjectExperience>(); ////專案經驗

                        interviewData.InterviewInfo         = interviewInfo[0];
                        interviewData.InterviewResults      = interviewResults;
                        interviewData.ProjectExperienceList = projectExperienceList;
                        interviewDataList.Add(interviewData);
                    }

                    string msg = ExcelHelper.GetInstance().ExportInterviewData(interviewDataList, path, i + 1);
                    if (msg != "匯出成功")
                    {
                        return("匯出失敗");
                    }
                }

                if (!isAllExport)
                {
                    return("匯出成功,但有些資料沒有面談資料");
                }

                return("匯出成功");
            }
            catch (Exception ex)
            {
                LogInfo.WriteErrorInfo(ex);
                return("匯出失敗");
            }
        }
Пример #2
0
        /// <summary>
        /// 根據聯繫ID匯出所有資料
        /// </summary>
        /// <param name="contactIdList"></param>
        /// <param name="path"></param>
        /// <returns></returns>
        public string ExportAllDataByContactId(List <string> contactIdList, string path)
        {
            try
            {
                for (int i = 0; i < contactIdList.Count; i++)
                {
                    List <ContactSituation> ContactSituationList = new List <ContactSituation>(); ////聯繫狀況資料
                    List <InterviewData>    interviewDataList    = new List <InterviewData>();    ///面談資料清單
                    ContactSituation        contactSituation     = new ContactSituation();
                    DataSet ds = Talent.GetInstance().SelectContactSituationDataById(contactIdList[i]);
                    contactSituation.Info   = ds.Tables[0].DBNullToEmpty().DataTableToList <ContactInfo>()[0];
                    contactSituation.Status = ds.Tables[1].DataTableToList <ContactStatus>();
                    string codeList = string.Empty;
                    foreach (DataRow dr in ds.Tables[2].Rows)
                    {
                        codeList += dr[0].ToString() + "\n";
                    }

                    contactSituation.Code = codeList;
                    ContactSituationList.Add(contactSituation);
                    List <string> interviewIdList = new List <string>();
                    foreach (DataRow dr in ds.Tables[4].Rows)
                    {
                        interviewIdList.Add(dr[0].ToString());
                    }

                    foreach (string interviewId in interviewIdList)
                    {
                        InterviewResults         interviewResults      = new InterviewResults();
                        InterviewData            interviewData         = new InterviewData();
                        DataSet                  interviewDataSet      = Talent.GetInstance().SelectInterviewDataById(interviewId);
                        List <InterviewInfo>     interviewInfo         = interviewDataSet.Tables[0].DataTableToList <InterviewInfo>();     ////面談基本資料
                        List <InterviewComments> interviewCommentsList = interviewDataSet.Tables[1].DataTableToList <InterviewComments>(); ////面談評語
                        List <InterviewResult>   interviewResult       = interviewDataSet.Tables[2].DataTableToList <InterviewResult>();   ////面談結果(任用評定與備註)

                        interviewResults.InterviewResult       = interviewResult[0];
                        interviewResults.InterviewCommentsList = interviewCommentsList;

                        List <ProjectExperience> projectExperienceList = interviewDataSet.Tables[3].DataTableToList <ProjectExperience>(); ////專案經驗

                        interviewData.InterviewInfo         = interviewInfo[0];
                        interviewData.InterviewResults      = interviewResults;
                        interviewData.ProjectExperienceList = projectExperienceList;
                        interviewDataList.Add(interviewData);
                    }

                    string msg = ExcelHelper.GetInstance().ExportAllData(ContactSituationList, interviewDataList, path, i + 1);
                    if (msg != "匯出成功")
                    {
                        return("匯出失敗");
                    }
                }

                return("匯出成功");
            }
            catch (Exception ex)
            {
                LogInfo.WriteErrorInfo(ex);
                return("匯出失敗");
            }
        }