protected void Page_Load(object sender, EventArgs e) { TakeOutData blltakeOutData = new TakeOutData(); TakeOutItemData bllTakeOutItemData = new TakeOutItemData(); List <TakeOutItemDataInfo> list = bllTakeOutItemData.selectTakeOutItemDataList(Request.QueryString["takeOutDataCode"]); for (int i = 0; i < list.Count; i++) { TakeOutItemDataInfo item = (TakeOutItemDataInfo)list[i]; int resultDel = bllTakeOutItemData.deleteTakeOutItemData(item); } TakeOutDataInfo takeOutDataInfo = new TakeOutDataInfo(); takeOutDataInfo.TakeOutDataCode = Request.QueryString["takeOutDataCode"]; int result = blltakeOutData.deleteTakeOutData(takeOutDataInfo); Page.RegisterClientScriptBlock("alert", JavaScriptBuilder.alert("đã xóa (삭제 하였습니다).", "listTakeOut.aspx")); }
protected void Page_Load(object sender, EventArgs e) { // 로그인 체크 check login //EmployeeInfo loginEmployee = new EmployeeInfo(); //loginEmployee = (EmployeeInfo)Session["loginMember"]; //if (loginEmployee == null) //{ // Response.Redirect("~/login.aspx", true); //} if (this.Context.User.Identity.Name == null) { Response.Redirect("~/login.aspx", true); } EmployeeInfo requestEmployee = new EmployeeInfo(); List <ElecStatusInfo> elecApproveInfo = new List <ElecStatusInfo>(); List <TakeOutItemDataInfo> takeOutItem = new List <TakeOutItemDataInfo>(); Employee bllEmployee = new Employee(); ElecApprove bllElecApprove = new ElecApprove(); TakeOutItemData bllTakeOutItem = new TakeOutItemData(); //반출정보 thông tin tài sản ra cổng TakeOutDataInfo takeOutDataInfo = bll.selectTakeOutData(Request.QueryString["takeOutDataCode"]); // 전자결재 elecApproveInfo = bllElecApprove.SelectStatus(takeOutDataInfo.ElecApproveCode); //반출 항목 hạng mục tài sản ra cổng takeOutItem = bllTakeOutItem.selectTakeOutItemDataList(takeOutDataInfo.TakeOutDataCode); //요청자 người yêu cầu requestEmployee = bllEmployee.selectEmployee(takeOutDataInfo.RequestUserCode); requestEmployeeDepartmentName = requestEmployee.Dep_name; requestEmployeeDisplayName = requestEmployee.DisplayName; requestEmployeeUpnid = requestEmployee.Upnid; requestEmployeeTitle = requestEmployee.Title_name; // 신청자 보이기 lblDepartment.Text = takeOutDataInfo.RequestUserDepartment; lblUpnid.Text = takeOutDataInfo.RequestUserCode; lblDisplayName.Text = takeOutDataInfo.RequestUserDisplayName; lblTitle.Text = takeOutDataInfo.RequestUserTitleName; if (String.IsNullOrEmpty(requestEmployee.OfficePhoneNumber)) { lblPhone.Text = "-"; } else { lblPhone.Text = requestEmployee.OfficePhoneNumber; } // 반출 정보 보이기 thông tin tài sản ra cổng lblTakeOutDataCode.Text = takeOutDataInfo.TakeOutDataCode; lblScheduleOutDate.Text = takeOutDataInfo.ScheduleOutDate; lblTakeOutObject.Text = takeOutDataInfo.TakeOutObjectName; lblCompanyName.Text = takeOutDataInfo.CompanyName; lblReceiveName.Text = takeOutDataInfo.RecieveName; lblRequireIN.Text = bll.requireKor(takeOutDataInfo.RequireIN); if (String.IsNullOrEmpty(takeOutDataInfo.ScheduleInDate)) { lblScheduleDate.Text = "-"; } else { lblScheduleDate.Text = takeOutDataInfo.ScheduleInDate; } if (String.IsNullOrEmpty(takeOutDataInfo.ObjectContents)) { lblTakeOutObjectContents.Text = "-"; } else { lblTakeOutObjectContents.Text = takeOutDataInfo.ObjectContents; } if (String.IsNullOrEmpty(takeOutDataInfo.DisApprovalCategoryName)) { lblDisApproveName.Text = "-"; } else { lblDisApproveName.Text = takeOutDataInfo.DisApprovalCategoryName; } if (String.IsNullOrEmpty(takeOutDataInfo.Note)) { lblNote.Text = "-"; } else { lblNote.Text = takeOutDataInfo.Note; } // 결재정보 보이기 thông tin phê duyệt int count = elecApproveInfo.Count; for (int i = 0; i < count; i++) { // 결재의견이 없을때 "-" 채워줌. 셀의 border 때문에... nếu không có ý kiến phê duyệt thì chèn "-" if (String.IsNullOrEmpty(elecApproveInfo[i].UserOpi)) { elecApproveInfo[i].UserOpi = "-"; } elecApporveHtml += "<tr align=\"center\">"; elecApporveHtml += "<td style=\"border-color:Black;border-style:solid\" rowspan=\"2\">" + bllElecApprove.ElecApproveKor(elecApproveInfo[i].Decision) + "</td>"; elecApporveHtml += "<td style=\"border-color:Black;border-style:solid\">" + elecApproveInfo[i].UserName + " " + elecApproveInfo[i].UserTitle + "</td>"; elecApporveHtml += "<td style=\"border-color:Black;border-style:solid\" rowspan=\"2\">" + elecApproveInfo[i].DepName + "</td>"; elecApporveHtml += "<td style=\"border-color:Black;border-style:solid\" rowspan=\"2\">" + elecApproveInfo[i].UserOpi + "</td>"; elecApporveHtml += "</tr>"; elecApporveHtml += "<tr align=\"center\">"; elecApporveHtml += "<td style=\"border-color:Black;border-style:solid\">" + HanaMicron.COMS.Utility.DateUtility.getDateFormat2(Convert.ToDateTime(elecApproveInfo[i].ViewDate)) + "</td>"; elecApporveHtml += "</tr>"; } // 반출 항목 보이기 hạng mịc tài sản ra cổng int seq = 0; for (int i = 0; i < 10; i++) //항목 10개 만듬 { seq = i + 1; if (i < takeOutItem.Count) //데이타 있는 만큼 데이타 뿌려줌. Đẩy dữ liệu tương ứng vào ô nhận dữ liệu { takeOutItemListHtml += "<tr align=\"center\">"; takeOutItemListHtml += "<td style=\"border-color:Black;border-style:solid\">" + seq + "</td>"; takeOutItemListHtml += "<td style=\"border-color:Black;border-style:solid\">" + takeOutItem[i].ParentCodeName + "</td>"; takeOutItemListHtml += "<td style=\"border-color:Black;border-style:solid\">" + takeOutItem[i].SubCodeName + "</td>"; takeOutItemListHtml += "<td style=\"border-color:Black;border-style:solid\">" + takeOutItem[i].TakeOutItemName + "</td>"; takeOutItemListHtml += "<td style=\"border-color:Black;border-style:solid\">" + takeOutItem[i].TakeOutItemType + "</td>"; takeOutItemListHtml += "<td style=\"border-color:Black;border-style:solid\">" + takeOutItem[i].UnitName + "</td>"; takeOutItemListHtml += "<td style=\"border-color:Black;border-style:solid\">" + takeOutItem[i].Account + "</td>"; takeOutItemListHtml += "<td style=\"border-color:Black;border-style:solid\"> </td>"; takeOutItemListHtml += "</tr>"; } else //데이타 없는 부분 공백으로 채움. Cho khoảng trống vào những ô không có dữ liệu { takeOutItemListHtml += "<tr align=\"center\">"; takeOutItemListHtml += "<td style=\"border-color:Black;border-style:solid\">" + seq + "</td>"; takeOutItemListHtml += "<td style=\"border-color:Black;border-style:solid\"> </td>"; takeOutItemListHtml += "<td style=\"border-color:Black;border-style:solid\"> </td>"; takeOutItemListHtml += "<td style=\"border-color:Black;border-style:solid\"> </td>"; takeOutItemListHtml += "<td style=\"border-color:Black;border-style:solid\"> </td>"; takeOutItemListHtml += "<td style=\"border-color:Black;border-style:solid\"> </td>"; takeOutItemListHtml += "<td style=\"border-color:Black;border-style:solid\"> </td>"; takeOutItemListHtml += "<td style=\"border-color:Black;border-style:solid\"> </td>"; takeOutItemListHtml += "</tr>"; } } }
//private String filepath; //private String filename; protected void Page_Load(object sender, EventArgs e) { bllTakeOutData = new TakeOutData(); bllTakeOutItemData = new TakeOutItemData(); bllVisitData = new VisitData(); String takeOutDataCode; // 반출 번호 mã ra ngoài // 로그인 체크 check login EmployeeInfo loginEmployee = new EmployeeInfo(); loginEmployee = (EmployeeInfo)Session["loginMember"]; if (loginEmployee == null) { Response.Redirect("~/login.aspx", true); } if (Page.IsPostBack) { //Createfolder(); // 2021-03-26 Nguyen Van An: file upload #region 일 업로드 String userFileMimeType1 = String.Empty; String userFileMimeType2 = String.Empty; String userFileMimeType3 = String.Empty; String userFileName1 = String.Empty; String userFileName2 = String.Empty; String userFileName3 = String.Empty; String userFileByte1 = String.Empty; String userFileByte2 = String.Empty; String userFileByte3 = String.Empty; String userFileDBName1 = String.Empty; String userFileDBName2 = String.Empty; String userFileDBName3 = String.Empty; String separator = "|"; // String fileUploadDir = ConfigurationManager.AppSettings["fileUploadPath"]; string[] arrFileName; string ext; if (userFile1.HasFile && checkfile(userFile1.FileName)) { //arrFileName = userFile1.FileName.Split('.'); //ext = arrFileName[arrFileName.Length - 1].ToLower(); //userFileName1 = HanaMicron.COMS.Utility.StringUtil.ReplaceSpecial(userFile1.FileName.Replace("." + ext, "")) + "." + ext; //String savePath1 = fileUploadDir + "\\" + (userFileName1); //userFileMimeType1 = userFile1.PostedFile.ContentType; //userFileByte1 = userFile1.PostedFile.ContentLength.ToString(); //userFile1.SaveAs(savePath1); // userFileDBName1 = userFileName1 ; String filename1 = DateTime.Now.ToString("yyyyMMdd_hhmmss_") + userFile1.FileName; String filepath = MapPath("~/image/" + filename1); userFile1.SaveAs(filepath); userFileDBName1 = filename1; } if (userFile2.HasFile && checkfile(userFile2.FileName)) { //arrFileName = userFile2.FileName.Split('.'); //ext = arrFileName[arrFileName.Length - 1].ToLower(); //userFileName2 = HanaMicron.COMS.Utility.StringUtil.ReplaceSpecial(userFile2.FileName.Replace("." + ext, "")) + "." + ext; //userFileMimeType2 = userFile2.PostedFile.ContentType; //userFileByte2 = userFile2.PostedFile.ContentLength.ToString(); //String savePath2 = fileUploadDir + "\\" + userFileName2; //userFile2.SaveAs(savePath2); //userFileDBName2 = userFileName2 + separator + userFileMimeType2 + separator + userFileByte2; String filename2 = DateTime.Now.ToString("yyyyMMdd_hhmmss_") + userFile2.FileName; String filepath = MapPath("~/image/" + filename2); userFile2.SaveAs(filepath); userFileDBName2 = filename2; } if (userFile3.HasFile && checkfile(userFile3.FileName)) { //arrFileName = userFile3.FileName.Split('.'); //ext = arrFileName[arrFileName.Length - 1].ToLower(); //userFileName3 = HanaMicron.COMS.Utility.StringUtil.ReplaceSpecial(userFile3.FileName.Replace("." + ext, "")) + "." + ext; //userFileMimeType3 = userFile3.PostedFile.ContentType; //userFileByte3 = userFile3.PostedFile.ContentLength.ToString(); //String savePath3 = fileUploadDir + "\\" + userFileName3; //userFile3.SaveAs(savePath3); //userFileDBName3 = userFileName3 ; String filename3 = DateTime.Now.ToString("yyyyMMdd_hhmmss_") + userFile3.FileName; String filepath = MapPath("~/image/" + filename3); userFile3.SaveAs(filepath); userFileDBName3 = filename3; } #endregion // 반출 정보 Data 만들기 tạo data thông tin ra ngoài TakeOutDataInfo takeOutDataInfo = new TakeOutDataInfo(); takeOutDataInfo.CompanyCode = Convert.ToInt32(Request["companyCode"]); takeOutDataInfo.RecieveName = Request["recieveName"]; takeOutDataInfo.RequestUserCode = loginEmployee.Upnid; takeOutDataInfo.RequireIN = Convert.ToInt32(Request["requireIN"]); //반입 필 여부 có/ không cần vào takeOutDataInfo.ObjectContents = Request["objectContents"]; //반입필 일 경우만 반입예정일 입력 if (takeOutDataInfo.RequireIN == 1) { takeOutDataInfo.ScheduleInDate = Request["scheduleInDate"]; } takeOutDataInfo.ScheduleOutDate = Request["scheduleOutDate"]; takeOutDataInfo.CarCode = Convert.ToInt32(Request["carCode"]); takeOutDataInfo.TakeOutStateCode = 0; takeOutDataInfo.TakeOutObjectCode = Convert.ToInt32(takeOutObjectCode.SelectedValue); //takeOutDataInfo.ApprovalUserCode = Request["approvalUserCode"]; takeOutDataInfo.TakeOutPathEndCode = Convert.ToInt32(takeOutPathEnd.SelectedValue); takeOutDataInfo.TakeOutPathStartCode = Convert.ToInt32(takeOutPathStart.SelectedValue); takeOutDataInfo.Note = Request["note"]; //반입불가 일때만 반입불가사유 입력 (수정시에도 해당됨) if (takeOutDataInfo.RequireIN == 2) { takeOutDataInfo.DisApprovalCategoryCode = Convert.ToInt32(disApprovalCategoryCode.SelectedValue); } takeOutDataInfo.DisApprovalCategoryDetail = Request["disApprovalCategoryDetail"]; takeOutDataInfo.ElecApproveCode = Request["elecApproveCode"]; // 신규 if (Request.QueryString["mode"].Equals("write")) { // 반출 번호 만들기 (물품 저장 될것을 위해서) takeOutDataCode = bllTakeOutData.selectNextTakeOutDataCode(); takeOutDataInfo.TakeOutDataCode = takeOutDataCode; takeOutDataInfo.ApprovalState = 0; takeOutDataInfo.UserFile1 = userFileDBName1; takeOutDataInfo.UserFile2 = userFileDBName2; takeOutDataInfo.UserFile3 = userFileDBName3; int result = bllTakeOutData.insertTakeOutData(takeOutDataInfo); } // 수정 else { takeOutDataCode = Request["takeOutDataCode"]; TakeOutDataInfo oldData = bllTakeOutData.selectTakeOutData(Request.QueryString["takeOutDataCode"]); takeOutDataInfo.TakeOutDataCode = takeOutDataCode; takeOutDataInfo.ApprovalState = 0; //takeOutDataInfo.TakeOutItemDataList[0].TakeOutTime = oldData.TakeOutItemDataList[0].TakeOutTime; //takeOutDataInfo.TakeOutItemDataList[0].TakeINTime = oldData.TakeOutItemDataList[0].TakeINTime; //takeOutDataInfo.ApproveTime = oldData.ApproveTime; takeOutDataInfo.ElecApproveCode = oldData.ElecApproveCode; if (!String.IsNullOrEmpty(userFileName1)) { takeOutDataInfo.UserFile1 = userFileDBName1; } if (!String.IsNullOrEmpty(userFileName2)) { takeOutDataInfo.UserFile2 = userFileDBName2; } if (!String.IsNullOrEmpty(userFileName3)) { takeOutDataInfo.UserFile3 = userFileDBName3; } int result = bllTakeOutData.updateTakeOutData(takeOutDataInfo); // 이전 물품 삭제 List <TakeOutItemDataInfo> takeOutItemList = bllTakeOutItemData.selectTakeOutItemDataList(oldData.TakeOutDataCode); for (int i = 0; i < takeOutItemList.Count; i++) { TakeOutItemDataInfo obj = (TakeOutItemDataInfo)takeOutItemList[i]; int resultDelete = bllTakeOutItemData.deleteTakeOutItemData(obj); } } // 반출 물품 정보 넣기 String subTakeOutItemCategoryCodes = Request["subTakeOutItemCategoryCodes"]; String[] arrSubTakeOutItemCategoryCode = subTakeOutItemCategoryCodes.Split(','); String takeOutItemNames = Request["takeOutItemNames"]; String[] arrTakeOutItemNames = takeOutItemNames.Split(','); String takeOutItemNameTypes = Request["takeOutItemNameTypes"]; String[] arrTakeOutItemNameTypes = takeOutItemNameTypes.Split(','); String takeOutItemAccounts = Request["takeOutItemAccounts"]; String[] arrTakeOutItemAccounts = takeOutItemAccounts.Split(','); String takeOutUnits = Request["takeOutUnits"]; String[] arrTakeOutUnits = takeOutUnits.Split(','); for (int i = 0; i < arrSubTakeOutItemCategoryCode.Length; i++) { if (!String.IsNullOrEmpty(arrSubTakeOutItemCategoryCode[i])) { TakeOutItemDataInfo takeOutItemDataInfo = new TakeOutItemDataInfo(); takeOutItemDataInfo.TakeOutDataCode = takeOutDataCode; takeOutItemDataInfo.SubCategoryCode = Convert.ToInt32(arrSubTakeOutItemCategoryCode[i]); takeOutItemDataInfo.TakeOutItemName = arrTakeOutItemNames[i]; takeOutItemDataInfo.TakeOutItemType = arrTakeOutItemNameTypes[i]; takeOutItemDataInfo.Account = Convert.ToInt32(arrTakeOutItemAccounts[i]); takeOutItemDataInfo.UnitCode = Convert.ToInt32(arrTakeOutUnits[i]); int itemResult = bllTakeOutItemData.insertTakeOutItemData(takeOutItemDataInfo); } } Response.Redirect("viewTakeOut.aspx?takeOutDataCode=" + takeOutDataCode, true); } else { // 신규 if (Request.QueryString["mode"].Equals("write")) { // 신규 결재 코드 가져오기 approveDocCode = bllVisitData.GetNewApproveCode(); } // 수정 else { // 반출 번호 TakeOutDataInfo oldData = bllTakeOutData.selectTakeOutData(Request.QueryString["takeOutDataCode"]); lblTakeOutDataCode.Text = Request["takeOutDataCode"]; scheduleDateTitle = oldData.ScheduleInDate; scheduleDateOut = oldData.ScheduleOutDate; takeOutObjectCode.SelectedValue = oldData.TakeOutObjectCode.ToString(); takeOutPathStart.SelectedValue = oldData.TakeOutPathStartCode.ToString(); takeOutPathEnd.SelectedValue = oldData.TakeOutPathEndCode.ToString(); objectContents = oldData.ObjectContents; companyCode = oldData.CompanyCode; companyName = oldData.CompanyName; recieveName = oldData.RecieveName; carCode = oldData.CarCode; carNumber = oldData.CarNumber; // 반입불가가 아닌경우(반입가능) 불가사유 없으므로 수정시 select 1로 하고 실제 저장시에는 저장 안되게 되어 있음. if (oldData.DisApprovalCategoryCode == 0) { disApprovalCategoryCode.SelectedValue = "20"; } else { disApprovalCategoryCode.SelectedValue = oldData.DisApprovalCategoryCode.ToString(); } disApprovalCategoryDetail = oldData.DisApprovalCategoryDetail; if (oldData.RequireIN == 1) { ckRequire1 = "checked"; } else { ckRequire2 = "checked"; } // 이전 물품 정보 보여주기 List <TakeOutItemDataInfo> takeOutItemList = bllTakeOutItemData.selectTakeOutItemDataList(Request.QueryString["takeOutDataCode"]); for (int i = 0; i < takeOutItemList.Count; i++) { TakeOutItemDataInfo obj = (TakeOutItemDataInfo)takeOutItemList[i]; arrTakeOutItemList += "parentCategory[" + i + "]='" + obj.ParentCategoryCode + "';\n"; arrTakeOutItemList += "subCategory[" + i + "]='" + obj.SubCategoryCode + "';\n"; arrTakeOutItemList += "itemName[" + i + "]='" + obj.TakeOutItemName + "';\n"; arrTakeOutItemList += "itemType[" + i + "]='" + obj.TakeOutItemType + "';\n"; arrTakeOutItemList += "account[" + i + "]='" + obj.Account.ToString() + "';\n"; arrTakeOutItemList += "unit[" + i + "]='" + obj.UnitCode + "';\n"; } displayCellCount = takeOutItemList.Count.ToString(); // 결재 코드 approveDocCode = oldData.ElecApproveCode; //첨부 파일 if (!String.IsNullOrEmpty(oldData.UserFile1)) { lblUserFile1.Text = "<a href='" + ConfigurationManager.AppSettings["fileOpenPath"] + "/" + bllTakeOutData.GetFileName(oldData.UserFile1) + "' target='_blank'>" + bllTakeOutData.GetFileName(oldData.UserFile1) + "</a>"; lblUserFile1.Text += "<a href='#;' onclick=\"confirmMove('Có chắc chắn xóa không? (정말로 삭제하시겠습니까?)','userFileDeleteTakeOut.aspx?takeOutDataCode=" + oldData.TakeOutDataCode + "&fileNumber=1&fileName=" + HttpUtility.UrlEncode(bllTakeOutData.GetFileName(oldData.UserFile1)) + "',document.dummy)\"><img src='../../images/icon/fileDelete.gif' align='absmiddle'></a>"; } if (!String.IsNullOrEmpty(oldData.UserFile2)) { String[] arrUserFile2 = oldData.UserFile2.Split('|'); lblUserFile2.Text = "<a href='" + ConfigurationManager.AppSettings["fileOpenPath"] + "/" + bllTakeOutData.GetFileName(oldData.UserFile2) + "' target='_blank'>" + bllTakeOutData.GetFileName(oldData.UserFile2) + "</a>"; lblUserFile2.Text += "<a href='#;' onclick=\"confirmMove('Có chắc chắn xóa không? (정말로 삭제하시겠습니까?)','userFileDeleteTakeOut.aspx?takeOutDataCode=" + oldData.TakeOutDataCode + "&fileNumber=2&fileName=" + HttpUtility.UrlEncode(bllTakeOutData.GetFileName(oldData.UserFile2)) + "',document.dummy)\"><img src='../../images/icon/fileDelete.gif' align='absmiddle'></a>"; } if (!String.IsNullOrEmpty(oldData.UserFile3)) { String[] arrUserFile3 = oldData.UserFile3.Split('|'); lblUserFile3.Text = "<a href='" + ConfigurationManager.AppSettings["fileOpenPath"] + "/" + bllTakeOutData.GetFileName(oldData.UserFile3) + "' target='_blank'>" + bllTakeOutData.GetFileName(oldData.UserFile3) + "</a>"; lblUserFile3.Text += "<a href='#;' onclick=\"confirmMove('Có chắc chắn xóa không? (정말로 삭제하시겠습니까?)','userFileDeleteTakeOut.aspx?takeOutDataCode=" + oldData.TakeOutDataCode + "&fileNumber=3&fileName=" + HttpUtility.UrlEncode(bllTakeOutData.GetFileName(oldData.UserFile3)) + "',document.dummy)\"><img src='../../images/icon/fileDelete.gif' align='absmiddle'></a>"; } note = oldData.Note; } // 임직원 정보 보이기 lblDepartment.Text = loginEmployee.Dep_name; lblUpnid.Text = loginEmployee.Upnid; lblOfficeName.Text = loginEmployee.OfficeName; lblDisplayName.Text = loginEmployee.DisplayName; lblTitle.Text = loginEmployee.Title_name; lblPhone.Text = loginEmployee.MobilePhoneNumber; // 대분류 가져오기 TakeOutItemCategory bllTakeOutItemCategory = new TakeOutItemCategory(); List <TakeOutItemCategoryInfo> categorylist = bllTakeOutItemCategory.selectTakeOutItemCategoryList(1, 0); for (int i = 0; i < categorylist.Count; i++) { TakeOutItemCategoryInfo itemCategory = (TakeOutItemCategoryInfo)categorylist[i]; itemCategoryNameList += "arrItemCategoryNameList[" + i + "] = '" + itemCategory.CodeName + "';\n"; itemCategoryCodeList += "arrItemCategoryCodeList[" + i + "] = '" + itemCategory.TakeOutItemCategoryCode + "';\n"; } // 단위 가져오기 HanaMicron.COMS.BLL.Unit bllUnit = new HanaMicron.COMS.BLL.Unit(); String unitSearchKey = "A"; List <UnitInfo> unitList = bllUnit.selectUnitList(unitSearchKey); for (int i = 0; i < unitList.Count; i++) { UnitInfo unitInfo = (UnitInfo)unitList[i]; unitNameList += "arrUnitNameList[" + i + "] = '" + unitInfo.CodeName + "';\n"; unitCodeList += "arrUnitCodeList[" + i + "] = '" + unitInfo.UnitCode + "';\n"; } } }