//===================================================================== // FunctionName : ExportToFile /// <summary> /// 重载导出到文件函数 /// </summary> //===================================================================== protected override void ExportToFile() { CustomColumnIndex(); appData = new T_BM_KCXXApplicationData(); QueryRecord(); gvPrint.Visible = true; gvPrint.DataSource = appData.ResultSet; gvPrint.DataBind(); gvPrint.Columns[intKCBHColumnIndex - 1].Visible = chkShowKCBH.Checked; gvPrint.Columns[intKCMCColumnIndex - 1].Visible = chkShowKCMC.Checked; gvPrint.Columns[intKCXLBHColumnIndex - 1].Visible = chkShowKCXLBH.Checked; gvPrint.Columns[intKCKKSJColumnIndex - 1].Visible = chkShowKCKKSJ.Checked; gvPrint.Columns[intKSSColumnIndex - 1].Visible = chkShowKSS.Checked; // 创建信息标题 gvPrint.Caption = GetTableCaption(); gvPrint.CaptionAlign = TableCaptionAlign.Left; switch (ddlExportFileFormat.SelectedValue.ToLower()) { case "xls": FileLibrary.ExportToExcelFile(gvPrint, "Result"); break; case "doc": FileLibrary.ExportToWordFile(gvPrint, "Result"); break; default: FileLibrary.ExportToExcelFile(gvPrint, "Result"); break; } gvPrint.Visible = false; }
protected override void Initalize() { // 初始化界面 KCNR.ImageGalleryPath = "~/Media/Image/FreeTextBox/" + Session[RICH.Common.ConstantsManager.SESSION_USER_ID] + "/"; // 界面控件状态 if (ViewMode || EditMode || CopyMode) { // 读取要修改记录详细资料 appData = new T_BM_KCXXApplicationData { ObjectID = base.ObjectID, OPCode = RICH.Common.Base.ApplicationData.ApplicationDataBase.OPType.ID }; QueryRecord(); // 控件赋值 if (appData.RecordCount > 0) { ObjectID.Text = GetValue(appData.ResultSet.Tables[0].Rows[0]["ObjectID"]); KCBH.Text = GetValue(appData.ResultSet.Tables[0].Rows[0]["KCBH"]); KCMC.Text = GetValue(appData.ResultSet.Tables[0].Rows[0]["KCMC"]); KCXLBH.SelectedValue = GetValue(appData.ResultSet.Tables[0].Rows[0]["KCXLBH"]); KCTP.Text = GetValue(appData.ResultSet.Tables[0].Rows[0]["KCTP"]); KCNR.Text = GetValue(appData.ResultSet.Tables[0].Rows[0]["KCNR"]); KCKKSJ.Text = GetValue(appData.ResultSet.Tables[0].Rows[0]["KCKKSJ"]); KSS.Text = GetValue(appData.ResultSet.Tables[0].Rows[0]["KSS"]); } } if (AddMode) { // 初始化传入参数 // 初始化默认值 } }
protected override void Initalize() { // 读取记录详细资料 appData = new T_BM_KCXXApplicationData(); appData.ObjectID = ObjectID; appData.OPCode = RICH.Common.Base.ApplicationData.ApplicationDataBase.OPType.ID; QueryRecord(); Header.DataBind(); rptDetail.DataSource = appData.ResultSet; rptDetail.DataBind(); if (!IsPostBack) { foreach (DataRow drTemp in appData.ResultSet.Tables[0].Rows) { //记录日志开始 string strLogTypeID = "A10"; strMessageParam[0] = (string)Session[ConstantsManager.SESSION_USER_LOGIN_NAME]; strMessageParam[1] = "课程信息"; strMessageParam[2] = drTemp["KCMC"].ToString(); string strLogContent = MessageManager.GetMessageInfo(MessageManager.LOG_MSGID_0012, strMessageParam); RICH.Common.LM.LogLibrary.LogWrite(strLogTypeID, strLogContent, null, drTemp["ObjectID"].ToString(), null); //记录日志结束 } } }
//===================================================================== // FunctionName : Initalize /// <summary> /// 重载初始化函数 /// </summary> //===================================================================== protected override void Initalize() { // 界面初始化 // 初始化打印页面大小 ddlPrintPageSize.Items.Add(new System.Web.UI.WebControls.ListItem("A4", "A4")); ddlPrintPageSize.Items.Add(new System.Web.UI.WebControls.ListItem("A3", "A3")); // 初始化打印页面方向大小 ddlPrintPageOrientation.Items.Add(new System.Web.UI.WebControls.ListItem("竖向", "portrait")); ddlPrintPageOrientation.Items.Add(new System.Web.UI.WebControls.ListItem("横向", "landscape")); // 读取记录详细资料 appData = new T_BM_KCXXApplicationData(); appData.ObjectID = ObjectID; appData.OPCode = RICH.Common.Base.ApplicationData.ApplicationDataBase.OPType.ID; QueryRecord(); Header.DataBind(); gvPrint.DataSource = appData.ResultSet; gvPrint.DataBind(); // 按钮初始化 if (IsPostBack != true) { foreach (DataRow drTemp in appData.ResultSet.Tables[0].Rows) { //记录日志开始 string strLogTypeID = "A10"; strMessageParam[0] = (string)Session[ConstantsManager.SESSION_USER_LOGIN_NAME]; strMessageParam[1] = "课程信息"; strMessageParam[2] = drTemp["KCMC"].ToString(); string strLogContent = MessageManager.GetMessageInfo(MessageManager.LOG_MSGID_0012, strMessageParam); RICH.Common.LM.LogLibrary.LogWrite(strLogTypeID, strLogContent, null, drTemp["ObjectID"].ToString(), null); //记录日志结束 } } }
//===================================================================== // FunctionName : Initalize /// <summary> /// 重载初始化函数 /// </summary> //===================================================================== protected override void Initalize() { // 创建信息标题 lblCaption.Text = GetTableCaption(); gvPrint.CaptionAlign = TableCaptionAlign.Left; // 数据统计 appData = new T_BM_KCXXApplicationData(); CountRecord(); gvPrint.DataSource = appData.ResultSet; gvPrint.DataBind(); }
protected override void Initalize() { DetailPage = true; // 数据查询 appData = new T_BM_KCXXApplicationData(); QueryRecord(); rptList.DataSource = appData.ResultSet; rptList.DataBind(); ViewState["RecordCount"] = appData.RecordCount; ViewState["CurrentPage"] = appData.CurrentPage; ViewState["PageSize"] = appData.PageSize; ViewState["PageCount"] = FunctionManager.RoundInt(((int)ViewState["RecordCount"] / (float)(int)ViewState["PageSize"])); InitPageInfo(); }
protected override void btnSaveFilterReport_Click(object sender, EventArgs e) { if (FilterReportName.Text.IsHtmlNullOrWiteSpace()) { return; } appData = new T_BM_KCXXApplicationData(); GetQueryInputParameter(); FilterReportApplicationLogic filterReportApplicationLogic = (FilterReportApplicationLogic)CreateApplicationLogicInstance(typeof(FilterReportApplicationLogic)); FilterReportApplicationData filterReportApplicationData = new FilterReportApplicationData() { BGMC = FilterReportName.Text.TrimIfNotNullOrWhiteSpace(), UserID = (string)Session[ConstantsManager.SESSION_USER_ID], BGLX = FilterReportType, GXBG = "0", XTBG = "0", BGCXTJ = JsonHelper.ObjectToJson(appData), BGCJSJ = DateTime.Now, }; FilterReportApplicationData filterReportQueryApplicationData; if (!FilterReportName.Text.IsHtmlNullOrWiteSpace()) { filterReportQueryApplicationData = new FilterReportApplicationData() { BGMC = FilterReportName.Text.TrimIfNotNullOrWhiteSpace(), UserID = (string)Session[ConstantsManager.SESSION_USER_ID], BGLX = FilterReportType, XTBG = "0", CurrentPage = 1, PageSize = 1000, }; filterReportQueryApplicationData = filterReportApplicationLogic.Query(filterReportQueryApplicationData); if (filterReportQueryApplicationData.ResultSet.Tables.Count > 0) { foreach (DataRow item in filterReportQueryApplicationData.ResultSet.Tables[0].Rows) { filterReportApplicationLogic.Delete(new FilterReportApplicationData() { ObjectID = GetValue(item["ObjectID"]), OPCode = RICH.Common.Base.ApplicationData.ApplicationDataBase.OPType.ID }); } } } filterReportApplicationLogic.Add(filterReportApplicationData); FilterReportDataBind((string)Session[ConstantsManager.SESSION_USER_ID], FilterReportList); FilterReportList.Items.FindByText(FilterReportName.Text.TrimIfNotNullOrWhiteSpace()).Selected = true; }
protected override string GetObjectID() { appData = new T_BM_KCXXApplicationData(); appData.OPCode = RICH.Common.Base.ApplicationData.ApplicationDataBase.OPType.ALL; appData.PageSize = 1; appData.CurrentPage = 1; QueryRecord(); if (appData.RecordCount == 1) { return(GetValue(appData.ResultSet.Tables[0].Rows[0]["ObjectID"])); } else { return(string.Empty); } }
protected void btnInfoFromDocBatch_Click(object sender, EventArgs e) { DataTable dt = new DataTable(); dt = GetTemplateColumn(dt); dt = FileLibrary.GetDataFromWordBatch(ConstantsManager.WEBSITE_VIRTUAL_ROOT_DIR + "/" + ConstantsManager.UPLOAD_DOC_DIR + "/" + "T_BM_KCXX", dt, true, true); T_BM_KCXXApplicationLogic instanceT_BM_KCXXApplicationLogic = (T_BM_KCXXApplicationLogic)CreateApplicationLogicInstance(typeof(T_BM_KCXXApplicationLogic)); foreach (DataRow dr in dt.Rows) { appData = new T_BM_KCXXApplicationData(); appData.KCBH = instanceT_BM_KCXXApplicationLogic.AutoGenerateKCBH(appData); int i = 0; appData = instanceT_BM_KCXXApplicationLogic.Add(appData); } }
//===================================================================== // FunctionName : Initalize /// <summary> /// 重载初始化函数 /// </summary> //===================================================================== protected override void Initalize() { DetailPage = true; gvList.Columns[intKCBHColumnIndex].Visible = chkShowKCBH.Checked; gvList.Columns[intKCMCColumnIndex].Visible = chkShowKCMC.Checked; gvList.Columns[intKCXLBHColumnIndex].Visible = chkShowKCXLBH.Checked; gvList.Columns[intKCKKSJColumnIndex].Visible = chkShowKCKKSJ.Checked; gvList.Columns[intKSSColumnIndex].Visible = chkShowKSS.Checked; KCXLBH.RepeatColumns = 1; // 数据查询 appData = new T_BM_KCXXApplicationData(); QueryRecord(); gvList.DataSource = appData.ResultSet; gvList.DataBind(); ViewState["RecordCount"] = appData.RecordCount; ViewState["CurrentPage"] = appData.CurrentPage; ViewState["PageSize"] = appData.PageSize; ViewState["PageCount"] = FunctionManager.RoundInt(((int)ViewState["RecordCount"] / (float)(int)ViewState["PageSize"])); InitPageInfo(); }
//===================================================================== // FunctionName : Initalize /// <summary> /// ÖØÔسõʼ»¯º¯Êý /// </summary> //===================================================================== protected override void Initalize() { try { appData = new T_BM_KCXXApplicationData(); appData.OPCode = RICH.Common.Base.ApplicationData.ApplicationDataBase.OPType.ID; appData.ObjectID = (string)Request.QueryString["ObjectID"]; QueryRecord(); if (appData.ResultSet.Tables[0].Rows.Count > 0) { if (appData.ResultSet.Tables[0].Rows[0][Request.QueryString["ImageField"]] != DBNull.Value) { Response.ContentType = "application/octet-stream"; Response.BinaryWrite((Byte[])appData.ResultSet.Tables[0].Rows[0][Request.QueryString["ImageField"]]); Response.End(); } else { Response.ClearContent(); Response.ContentType = "image/Png"; Response.BinaryWrite(RICH.Common.GenerateImage.GetStringImage("ÔÝÎÞͼƬ", 130, 160, 18, 10, 0).ToArray()); Response.End(); } } else { Response.ClearContent(); Response.ContentType = "image/Png"; Response.BinaryWrite(RICH.Common.GenerateImage.GetStringImage("ÔÝÎÞͼƬ", 130, 160, 18, 10, 0).ToArray()); Response.End(); } } catch (Exception) { Response.ContentType = "image/Png"; Response.BinaryWrite(RICH.Common.GenerateImage.GetStringImage("ÔÝÎÞͼƬ", 130, 160, 18, 10, 0).ToArray()); Response.End(); } }
//===================================================================== // FunctionName : ExportToFile /// <summary> /// 重载ExportToFile /// </summary> //===================================================================== protected override void ExportToFile() { appData = new T_BM_KCXXApplicationData(); appData.OPCode = RICH.Common.Base.ApplicationData.ApplicationDataBase.OPType.ID; appData.ObjectID = base.ObjectID; QueryRecord(); gvPrint.Visible = true; gvPrint.DataSource = appData.ResultSet; gvPrint.DataBind(); switch (ddlExportFileFormat.SelectedValue.ToLower()) { case "xls": FileLibrary.ExportToExcelFile(gvPrint, "Result"); break; case "doc": FileLibrary.ExportToWordFile(gvPrint, "Result"); break; case "pdf": string pageSize = ddlPrintPageSize.SelectedValue; bool boolOrientation = ddlPrintPageOrientation.SelectedValue == "landscape" ? true : false; float marginTop = DataValidateManager.ValidateNumberFormat(txtMarginTop.Text) == true?Convert.ToSingle(txtMarginTop.Text) : 50; float marginRight = DataValidateManager.ValidateNumberFormat(txtMarginRight.Text) == true?Convert.ToSingle(txtMarginRight.Text) : 50; float marginBottom = DataValidateManager.ValidateNumberFormat(txtMarginBottom.Text) == true?Convert.ToSingle(txtMarginBottom.Text) : 50; float marginLeft = DataValidateManager.ValidateNumberFormat(txtMarginLeft.Text) == true?Convert.ToSingle(txtMarginLeft.Text) : 50; ExportToPDFFile(appData.ResultSet, "Result", pageSize, boolOrientation, marginTop, marginRight, marginBottom, marginLeft); break; default: FileLibrary.ExportToExcelFile(gvPrint, "Result"); break; } gvPrint.Visible = false; }
protected override void FilterReportList_SelectedIndexChanged(object sender, EventArgs e) { appData = new T_BM_KCXXApplicationData(); FilterReportName.Text = string.Empty; if (FilterReportList.SelectedIndex > 0) { FilterReportApplicationData filterReportApplicationData = FilterReportBusinessEntity.GetDataByObjectID(FilterReportList.SelectedValue); T_BM_KCXXApplicationData obj = new T_BM_KCXXApplicationData(); appData = JsonHelper.JsonToObject(filterReportApplicationData.BGCXTJ, appData) as T_BM_KCXXApplicationData; FilterReportName.Text = filterReportApplicationData.BGMC; } if (appData != null) { KCBH.Text = GetValue(appData.KCBH); KCMC.Text = GetValue(appData.KCMC); KCXLBH.SelectedValue = GetValue(appData.KCXLBHBatch); KCNR.Text = GetValue(appData.KCNR); KCKKSJ.Text = GetValue(appData.KCKKSJBegin); KCKKSJ.Text = GetValue(appData.KCKKSJEnd); KCKKSJ.Text = GetValue(appData.KCKKSJ); KSS.Text = GetValue(appData.KSS); } Initalize(); }
//===================================================================== // FunctionName : ExportToFile /// <summary> /// 重载导出到文件函数 /// </summary> //===================================================================== protected override void ExportToFile() { appData = new T_BM_KCXXApplicationData(); CountRecord(); gvPrint.DataSource = appData.ResultSet; gvPrint.DataBind(); // 创建信息标题 gvPrint.Caption = GetTableCaption(); gvPrint.CaptionAlign = TableCaptionAlign.Left; switch (ddlExportFileFormat.SelectedValue.ToLower()) { case "xls": FileLibrary.ExportToExcelFileWithoutControl(gvPrint, "Result"); break; case "doc": FileLibrary.ExportToWordFileWithoutControl(gvPrint, "Result"); break; default: FileLibrary.ExportToExcelFileWithoutControl(gvPrint, "Result"); break; } }
protected void btnInfoFromDS_Click(object sender, EventArgs e) { int totalCount = 0; int importCount = 0; int updateCount = 0; try { var appDatas = T_BM_KCXXApplicationData.GetDataFromDataFile <T_BM_KCXXApplicationData>(InfoFromDoc.Text, true, true, recordStartLine: T_BM_KCXXContants.ImportDataSetStartLineNum); T_BM_KCXXApplicationLogic instanceT_BM_KCXXApplicationLogic = (T_BM_KCXXApplicationLogic)CreateApplicationLogicInstance(typeof(T_BM_KCXXApplicationLogic)); totalCount = appDatas.Count; foreach (var app in appDatas) { app.KCBH = instanceT_BM_KCXXApplicationLogic.AutoGenerateKCBH(app); if (!KCMC.Text.IsHtmlNullOrWiteSpace()) { app.KCMC = Convert.ToString(KCMC.Text); } string strKCXLBH = GetValue(new RICH.Common.BM.T_BM_KCXLXX.T_BM_KCXLXXApplicationLogicBase().GetValueByFixCondition("KCXLMC", app.KCXLBH, "KCXLBH")); if (!DataValidateManager.ValidateIsNull(strKCXLBH)) { app.KCXLBH = strKCXLBH; } if (!KCXLBH.SelectedValue.IsHtmlNullOrWiteSpace()) { app.KCXLBH = Convert.ToString(KCXLBH.SelectedValue); } if (!KCTP.Text.IsHtmlNullOrWiteSpace()) { app.KCTP = Convert.ToString(KCTP.Text); } if (!KCNR.Text.IsHtmlNullOrWiteSpace()) { app.KCNR = Convert.ToString(KCNR.Text); } if (!KCKKSJ.Text.IsHtmlNullOrWiteSpace()) { app.KCKKSJ = Convert.ToDateTime(KCKKSJ.Text); } if (!KSS.Text.IsHtmlNullOrWiteSpace()) { app.KSS = Convert.ToInt32(KSS.Text); } instanceT_BM_KCXXApplicationLogic.Add(app); if (app.ResultCode == RICH.Common.Base.ApplicationData.ApplicationDataBase.ResultState.Succeed) { importCount++; } else { app.OPCode = RICH.Common.Base.ApplicationData.ApplicationDataBase.OPType.PK; instanceT_BM_KCXXApplicationLogic.Modify(app); if (app.ResultCode == RICH.Common.Base.ApplicationData.ApplicationDataBase.ResultState.Succeed) { updateCount++; } } } MessageContent += @"<font color=""green"">共{0}条数据,导入数据{1}条,更新数据{2}条。</font>".FormatInvariantCulture(totalCount, importCount, updateCount); } catch (Exception ex) { MessageContent += @"<font color=""red"">导入数据过程出错:{0}<br/>共{1}条数据,已导入数据{2}条,已更新数据{3}条。</font>".FormatInvariantCulture(ex.Message, totalCount, importCount, updateCount); } }