protected void Page_Load(object sender, EventArgs e) { #region 接收参数 if (this.Request.QueryString["fileId"] == null) { this.Response.Write("{\"ExecResult\":\"Failed\",\"ErrorMsg\":\"Missing required query string.\"}"); this.Response.End(); } int fileId = 0; if (!int.TryParse(this.Request.QueryString["fileId"], out fileId)) { this.Response.Write("{\"ExecResult\":\"Failed\",\"ErrorMsg\":\"Query string is invalid.\"}"); this.Response.End(); } #endregion // json示例 // {"ExecResult":"Success","ErrorMsg":""} // {"ExecResult":"Failed","ErrorMsg":"执行数据库脚本时发生错误。"} string sExecResult = string.Empty; string sErrorMsg = string.Empty; try { LPWeb.BLL.PointImportHistory bllHis = new PointImportHistory(); var histories = bllHis.GetModelList("FileId=" + fileId); var hisIds = histories.Select(his => his.HistoryId).ToList(); bllHis.DeleteImportErrors(hisIds); sExecResult = "Success"; sErrorMsg = ""; } catch (Exception ex) { sExecResult = "Failed"; sErrorMsg = "Failed to delete selected record."; } System.Threading.Thread.Sleep(1000); this.Response.Write("{\"ExecResult\":\"" + sExecResult + "\",\"ErrorMsg\":\"" + sErrorMsg + "\"}"); this.Response.End(); }
private void LoadControls() { this.tbxFolderName.Text = ""; this.tbxBranch.Text = ""; this.tbxImportCount.Text = ""; this.tbxLastImportDate.Text = ""; this.tbxPath.Text = ""; this.tbxEnabled.Text = ""; this.gridSyncLogList.DataSource = null; LPWeb.Model.PointFolders model = null; try { model = this.folderMgr.GePonitFolderModel(this.iFolderID); if (model == null) { return; } this.tbxFolderName.Text = model.Name; this.tbxBranch.Text = model.BranchName; this.tbxImportCount.Text = model.ImportCount.ToString(); if (model.LastImport != null) { this.tbxLastImportDate.Text = Convert.ToDateTime(model.LastImport).ToString("MM/dd/yyyy HH:mm:ss"); } this.tbxPath.Text = model.Path; this.tbxEnabled.Text = model.Enabled.ToString(); this.cbEnableAutoFileNaming.Checked = model.AutoNaming; if (model.PreFix != null) { this.txbPrefix.Text = model.PreFix.ToString(); } this.cbdigitsName.Checked = model.RandomFileNaming; if (model.FilenameLength != null) { this.txtdigits.Text = model.FilenameLength.ToString(); } #region Get sync log PointImportHistory importHistory = new PointImportHistory(); DataSet dsSyncLog = importHistory.GetList(" FileId IN(SELECT FileId FROM PointFiles WHERE FolderId =" + this.iFolderID.ToString() + ")"); this.gridSyncLogList.DataSource = dsSyncLog.Tables[0]; this.gridSyncLogList.DataBind(); #endregion } catch (Exception ex) { throw ex; } }
private void BindPage(int fileId, int hisId) { BLL.Loans bllLoans = new BLL.Loans(); Model.Loans modelLoan = new Model.Loans(); BLL.Contacts bllContact = new BLL.Contacts(); BLL.Users bllUser = new BLL.Users(); BLL.PointImportHistory bllPointImportHistory = new PointImportHistory(); BLL.PointFiles bllPointFiles = new PointFiles(); BLL.PointFolders bllPointFolders = new PointFolders(); var dsList = new DataSet(); if (fileId > 0) { dsList = bllPointImportHistory.GetList(string.Format("FileId={0}", fileId)); } else if (hisId > 0) { dsList = bllPointImportHistory.GetList(string.Format("HistoryId={0}", hisId)); } if (dsList == null || dsList.Tables.Count == 0 || dsList.Tables[0].Rows.Count == 0) { PageCommon.AlertMsg(this, "There is no data in database."); return; } fileId = int.Parse(dsList.Tables[0].Rows[0]["FileId"].ToString()); hfdHisId.Value = fileId.ToString(); var modelPointFiles = bllPointFiles.GetModel(fileId); if (modelPointFiles != null) { var modelPointFolder = bllPointFolders.GetModel(modelPointFiles.FolderId); if (modelPointFolder != null) { lblPointFile.Text = modelPointFolder.Name + modelPointFiles.Name; } } lblBorrower.Text = bllContact.GetBorrower(fileId); lblLoanOfficer.Text = bllUser.GetLoanOfficer(fileId); // Start: get icon name by fileId, 2010-11-15 if (string.IsNullOrEmpty(imgSrc)) { string strSeverity = dsList.Tables[0].Rows[0]["Severity"].ToString().ToLower(); switch (strSeverity) { case "error": imgIcon.Src = "../images/loan/AlertError.png"; break; case "warning": imgIcon.Src = "../images/loan/AlertWarning.png"; break; default: imgIcon.Visible = false; break; } } else { imgIcon.Src = "../images/loan/" + imgSrc; } // End: get icon name by fileId, 2010-11-15 DateTime dt = DateTime.MinValue; DateTime.TryParse(dsList.Tables[0].Rows[0]["ImportTime"].ToString(), out dt); if (dt != DateTime.MinValue) { lblTime.Text = dt.ToString("MM/dd/yyyy hh:mm:ss"); } if (!string.IsNullOrEmpty(dsList.Tables[0].Rows[0]["Error"].ToString())) { string s1 = dsList.Tables[0].Rows[0]["Error"].ToString().Trim(); s1 = s1.Replace("<br/> ", "\r\n"); s1 = s1.Replace("<br/> ", "\r\n"); s1 = s1.Replace("<br/>", "\r\n"); tbxErrorMessages.Text = s1; } }