protected void bntConfirmChange_Click(Object sender, EventArgs e) { pnlConfirmImportList.Visible = false; if (GvCheckListSource.Count() > 0) { if (GvPaymentLateSource.Count() > 0) { foreach (DTO.BankTransaction item in GvPaymentLateSource) { DTO.BankTransaction data = GvCheckListSource.FirstOrDefault(a => a.Id == item.Id); if (item.Selected) { data.ErrorMessage = "(อนุมัตินำเข้า) นำส่งล่าช้า "; } else { var result = GvCheckListSource.ToList(); result.Remove(data); Session["gvCheckListSource"] = result; } } } if (GvPaymentMissingSource.Count() > 0) { foreach (DTO.BankTransaction item in GvPaymentMissingSource) { DTO.BankTransaction data = GvCheckListSource.FirstOrDefault(a => a.Id == item.Id); if (String.IsNullOrEmpty(item.ChangeRef1)) { var result = GvCheckListSource.ToList(); result.Remove(data); Session["gvCheckListSource"] = result; } else { data.ChangeRef1 = item.ChangeRef1; data.ChangeAmount = item.ChangeAmount; data.ErrorMessage = String.Format("เปลี่ยน เลขที่ใบสั่งจ่ายเป็น {0}", item.ChangeRef1); } } } if (GvPaymentInvalidSource.Count() > 0) { foreach (DTO.BankTransaction item in GvPaymentInvalidSource) { DTO.BankTransaction data = GvCheckListSource.FirstOrDefault(a => a.Id == item.Id); var result = GvCheckListSource.ToList(); result.Remove(data); Session["gvCheckListSource"] = result; } } btnImport.Enabled = true; btnImport.Visible = true; pnlImportFile.Visible = true; Int32 getResult = GvCheckListSource.Count(); SummaryUploadSource.NumberOfValid = getResult; SummaryUploadSource.NumberOfInValid = SummaryUploadSource.NumberOfItems - getResult; gvImportFile.DataSource = GvImportFileSource; gvImportFile.DataBind(); //if (GvCheckListSource.Where(a => !String.IsNullOrEmpty(a.ErrorMessage)).Count() > 0) //{ // lblMessageError.Text = Resources.errorPayRenewFee_001; // lblMessageError.Visible = true; // btnImport.Enabled = false; // btnImport.Visible = false; // Button1.Visible = true; // Button1.Enabled = true; //} //else if (!String.IsNullOrEmpty(SummaryUploadSource.ErrMessage)) //{ // lblMessageError.Text = SummaryUploadSource.ErrMessage; // lblMessageError.Text = String.Format("ไม่สามารถนำเข้าข้อมูลได้ เนื่องจาก {0}!!!", SummaryUploadSource.ErrMessage); // lblMessageError.Visible = true; // btnImport.Enabled = false; // btnImport.Visible = false; // Button1.Visible = true; // Button1.Enabled = true; //} //else if (GvCheckListSource.Count() <= 0) //{ // btnImport.Enabled = false; // btnImport.Visible = false; // Button1.Visible = true; // Button1.Enabled = true; //} if (GvCheckListSource.Count() > 0) { Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("th-TH"); gvCheckList.DataSource = GvCheckListSource; gvCheckList.DataBind(); } } }
protected void btnLoadFile_Click(object sender, EventArgs e) { ClearAndDisbleImport(); pnlImportFile.Visible = false; if (string.IsNullOrEmpty(FuFile.FileName)) { UCModalError.ShowMessageError = SysMessage.PleaseSelectFileData; UCModalError.ShowModalError(); return; } if (String.IsNullOrEmpty(ddlBankTranfer.SelectedValue)) { UCModalError.ShowMessageError = SysMessage.PleaseSelectBankData; UCModalError.ShowModalError(); return; } else { var biz = new BLL.PaymentBiz(); var res = biz.UploadData(FuFile.FileName, FuFile.PostedFile.InputStream, base.UserId, ddlBankTranfer.SelectedValue); if (res.IsError) { UCModalError.ShowMessageError = res.ErrorMsg; UCModalError.ShowModalError(); } else if (res.DataResponse != null && res.DataResponse.Header != null && !String.IsNullOrEmpty(res.DataResponse.Header.FirstOrDefault().ErrMessage)) { UCModalError.ShowMessageError = res.DataResponse.Header.FirstOrDefault().ErrMessage; UCModalError.ShowModalError(); } else { Session["GroupID"] = res.DataResponse.GroupId; if (res.DataResponse.Header.Count > 0) { Session["gvImportFileSource"] = res.DataResponse.Header; Session["gvCheckListSource"] = res.DataResponse.Detail; //*********** *********************** IsEnableChangePanel(true); BindValidateGridAll(); //**************************************** hdfGroupID.Value = res.DataResponse.GroupId; if ((GvCheckListSource != null && GvCheckListSource.Count() >= 0) && (GvPaymentMissingSource != null && GvPaymentMissingSource.Count() == 0) && (GvPaymentLateSource != null && GvPaymentLateSource.Count() == 0) && (GvPaymentInvalidSource != null && GvPaymentInvalidSource.Count() == 0) ) { bntConfirmChange_Click(bntConfirmChange, e); } } } } }