private void GetDocReqName() { DTO.ResponseMessage <bool> res = new DTO.ResponseMessage <bool>(); DataCenterBiz biz = new DataCenterBiz(); IAS.DTO.ResponseService <IAS.DTO.ConfigDocument[]> getDoc = biz.GetDocRequire(Convert.ToString(DTO.DocFunction.LICENSE_FUNCTION.GetEnumValue()), Convert.ToString(this.MasterLicense.UserProfile.MemberType), this.MasterLicense.LicenseTypeCode, this.MasterLicense.PettionTypeCode); //Add Doc Req to lblDocReq if ((getDoc.DataResponse.Count() > 0) && (getDoc.DataResponse != null)) { StringBuilder docName = new StringBuilder(); if (getDoc.DataResponse.Count() == 1) { docName.Append(getDoc.DataResponse[0].DOCUMENT_NAME + " " + "" + Environment.NewLine + ""); } else { for (int i = 0; i < getDoc.DataResponse.Count(); i++) { docName.Append((i + 1).ToString() + "." + getDoc.DataResponse[i].DOCUMENT_NAME + Environment.NewLine); } } lblNote1.Visible = true; lblDocReq.Text = docName.ToString(); } //กรณีไม่ต้องแนบเอกสาร 25/11/2556 else { lblNote1.Visible = false; } }
/// <summary> /// License Req Validation /// </summary> /// DataCenterService /// <returns>DTO.ResponseMessage<bool></returns> public DTO.ResponseMessage <bool> DocRequire() { DTO.ResponseMessage <bool> res = new DTO.ResponseMessage <bool>(); DataCenterBiz biz = new DataCenterBiz(); List <FilesLiceValidate> filesCheck = new List <FilesLiceValidate>(); //IAS.DTO.ResponseService<IAS.DTO.ConfigDocument[]> getDoc = biz.GetDocumentLicenseConfig(this.MasterLicense.PettionTypeCode, this.MasterLicense.LicenseTypeCode); //Get Doc Req IAS.DTO.ResponseService <IAS.DTO.ConfigDocument[]> getDoc = biz.GetDocRequire(Convert.ToString(DTO.DocFunction.LICENSE_FUNCTION.GetEnumValue()), Convert.ToString(this.MasterLicense.UserProfile.MemberType), this.MasterLicense.LicenseTypeCode, this.MasterLicense.PettionTypeCode); if (getDoc.DataResponse.Count().Equals(0) && (!getDoc.IsError)) { res.ResultMessage = true; } else if ((getDoc.DataResponse.Count() > 0) && (!getDoc.IsError)) { try { string lccode = this.MasterLicense.LicenseTypeCode; var docFunc = getDoc.DataResponse.Where(doc => doc.LICENSE_TYPE_CODE.Equals(this.MasterLicense.LicenseTypeCode) && doc.DOCUMENT_REQUIRE.Equals("Y")).ToList(); foreach (BLL.AttachFilesIAS.AttachFile item in this.AttachFiles) { for (int i = 0; i < docFunc.Count; i++) { FilesLiceValidate ent = new FilesLiceValidate(); if ((item.ATTACH_FILE_TYPE.Equals(docFunc[i].DOCUMENT_CODE)) && (item.FILE_STATUS != "D")) { ent.Status = true; ent.DocName = getDoc.DataResponse[i].DOCUMENT_NAME; filesCheck.Add(ent); } } } } catch (Exception ex) { res.ErrorMsg = "กรุณาติดต่อผู้ดูแลระบบ"; } Func <List <string>, string> getDocName = (doclist) => { StringBuilder docname = new StringBuilder(); for (int j = 0; j < doclist.Count(); j++) { docname.Append(" : " + doclist[j].ToString()); } doclist[0] = docname.ToString(); return(doclist[0]); }; if (filesCheck.Count > 0) { if (filesCheck.Where(chk => chk.Status == true).ToList().Count == getDoc.DataResponse.Count()) { res.ResultMessage = true; } else { if (MasterLicense != null) { List <string> ls = getDoc.DataResponse.Select(doct => doct.DOCUMENT_NAME).ToList(); string docNAme = getDocName(ls); this.MasterLicense.UCLicenseUCLicenseModelError.ShowMessageError = SysMessage.FileRequire + docNAme; this.MasterLicense.UCLicenseUCLicenseModelError.ShowModalError(); res.ErrorMsg = SysMessage.FileRequire + docNAme; res.ResultMessage = false; } } } else if (filesCheck.Count == 0) { if (MasterLicense != null) { List <string> ls = getDoc.DataResponse.Select(doct => doct.DOCUMENT_NAME).ToList(); string docNAme = getDocName(ls); this.MasterLicense.UCLicenseUCLicenseModelError.ShowMessageError = SysMessage.FileRequire.ToString() + docNAme; this.MasterLicense.UCLicenseUCLicenseModelError.ShowModalError(); res.ErrorMsg = SysMessage.FileRequire + docNAme; res.ResultMessage = false; } } } return(res); }