public void AddDetail(ExamFileDetail detail) { detail.SetHeader(this); detail.UPLOAD_GROUP_NO = this.UPLOAD_GROUP_NO; detail.AssociateName = this.ASSOCIATE_NAME; detail.AssociateCode = this.ASSOCIATE_CODE; detail.ProvinceCode = this.PROVINCE_CODE; detail.TestingDate = this.TESTING_DATE; detail.LicenseTypeCode = this.LICENSE_TYPE_CODE; detail.TimeCode = this.EXAM_TIME_CODE; VW_IAS_COM_CODE ent = this.CTX.VW_IAS_COM_CODE.SingleOrDefault(s => s.ID == "01"); detail.InsurCompName = ent.NAME; string examResult = detail.EXAM_RESULT; if ("P_F".Contains(examResult)) { detail.EXAM_RESULT = examResult; } else if (examResult == "M") { detail.ABSENT_EXAM = examResult; } string title = detail.TITLE == "น.ส." ? "นางสาว" : detail.TITLE; //ตรวจสอบคำนำหน้าชื่อ VW_IAS_TITLE_NAME entTitle = this.CTX.VW_IAS_TITLE_NAME.ToList().FirstOrDefault(s => s.NAME == title); if (entTitle != null) { detail.PRE_NAME_CODE = entTitle.ID.ToString(); } else { detail.ERROR_MSG = Resources.errorExamFileHeader_001; } IEnumerable <BusinessRule> rules = detail.GetBrokenRules(); if (rules != null && rules.Count() > 0) { StringBuilder errmsg = new StringBuilder(""); foreach (BusinessRule rule in rules) { errmsg.AppendLine(String.Format("- {0} <br />", rule.Rule)); } detail.ERROR_MSG = errmsg.ToString(); } _examFileDetails.Add(detail); }
public static String ConvertToCode(IAS.DAL.Interfaces.IIASPersonEntities ctx, String source) { string title = (source == "น.ส.") ? "นางสาว" : source; VW_IAS_TITLE_NAME entTitle = ctx.VW_IAS_TITLE_NAME.FirstOrDefault(s => s.NAME == title); if (entTitle == null) { return("999"); } else { return(entTitle.ID.ToString()); } }