//===================================================================== // 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_BG_0602ApplicationData(); 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["LMM"].ToString(); string strLogContent = MessageManager.GetMessageInfo(MessageManager.LOG_MSGID_0012, strMessageParam); RICH.Common.LM.LogLibrary.LogWrite(strLogTypeID, strLogContent, null, drTemp["ObjectID"].ToString(), null); //记录日志结束 } } }
//===================================================================== // FunctionName : ExportToFile /// <summary> /// 重载导出到文件函数 /// </summary> //===================================================================== protected override void ExportToFile() { CustomColumnIndex(); appData = new T_BG_0602ApplicationData(); QueryRecord(); gvPrint.Visible = true; gvPrint.DataSource = appData.ResultSet; gvPrint.DataBind(); gvPrint.Columns[intLMHColumnIndex - 1].Visible = chkShowLMH.Checked; gvPrint.Columns[intLMMColumnIndex - 1].Visible = chkShowLMM.Checked; gvPrint.Columns[intSJLMHColumnIndex - 1].Visible = chkShowSJLMH.Checked; gvPrint.Columns[intLMNRColumnIndex - 1].Visible = chkShowLMNR.Checked; gvPrint.Columns[intLMLBYSColumnIndex - 1].Visible = chkShowLMLBYS.Checked; gvPrint.Columns[intSFLBLMColumnIndex - 1].Visible = chkShowSFLBLM.Checked; gvPrint.Columns[intSFWBURLColumnIndex - 1].Visible = chkShowSFWBURL.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() { // 读取记录详细资料 appData = new T_BG_0602ApplicationData(); 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["LMM"].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_BG_0602ApplicationData(); CountRecord(); gvPrint.DataSource = appData.ResultSet; gvPrint.DataBind(); }
protected override void Initalize() { DetailPage = true; // 数据查询 appData = new T_BG_0602ApplicationData(); 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_BG_0602ApplicationData(); 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_BG_0602ApplicationData(); 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); } }
//===================================================================== // FunctionName : Initalize /// <summary> /// 重载初始化函数 /// </summary> //===================================================================== protected override void Initalize() { // 初始化界面 LMNR.ImageGalleryPath = "~/Media/Image/FreeTextBox/" + Session[RICH.Common.ConstantsManager.SESSION_USER_ID] + "/"; // 界面控件状态 if (ViewMode || EditMode || CopyMode) { // 读取要修改记录详细资料 appData = new T_BG_0602ApplicationData { 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"]); LMH.Text = GetValue(appData.ResultSet.Tables[0].Rows[0]["LMH"]); LMM.Text = GetValue(appData.ResultSet.Tables[0].Rows[0]["LMM"]); SJLMH.SelectedValue = GetValue(appData.ResultSet.Tables[0].Rows[0]["SJLMH"]); LMTP.Text = GetValue(appData.ResultSet.Tables[0].Rows[0]["LMTP"]); LMNR.Text = GetValue(appData.ResultSet.Tables[0].Rows[0]["LMNR"]); LMLBYS.SelectedValue = GetValue(appData.ResultSet.Tables[0].Rows[0]["LMLBYS"]); SFLBLM.SelectedValue = GetValue(appData.ResultSet.Tables[0].Rows[0]["SFLBLM"]); SFWBURL.SelectedValue = GetValue(appData.ResultSet.Tables[0].Rows[0]["SFWBURL"]); WBURL.Text = GetValue(appData.ResultSet.Tables[0].Rows[0]["WBURL"]); } } if (AddMode) { // 初始化传入参数 if (!DataValidateManager.ValidateIsNull(Request.QueryString["SJLMH"])) { SJLMH.SelectedValue = GetValue(Request.QueryString["SJLMH"]); SJLMH.Enabled = false; } // 初始化默认值 } }
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_BG_0602", dt, true, true); T_BG_0602ApplicationLogic instanceT_BG_0602ApplicationLogic = (T_BG_0602ApplicationLogic)CreateApplicationLogicInstance(typeof(T_BG_0602ApplicationLogic)); foreach (DataRow dr in dt.Rows) { appData = new T_BG_0602ApplicationData(); appData.LMH = instanceT_BG_0602ApplicationLogic.AutoGenerateLMH(appData); int i = 0; appData = instanceT_BG_0602ApplicationLogic.Add(appData); } }
//===================================================================== // FunctionName : Initalize /// <summary> /// 重载初始化函数 /// </summary> //===================================================================== protected override void Initalize() { gvList.Columns[intLMHColumnIndex].Visible = chkShowLMH.Checked; gvList.Columns[intLMMColumnIndex].Visible = chkShowLMM.Checked; gvList.Columns[intSJLMHColumnIndex].Visible = chkShowSJLMH.Checked; gvList.Columns[intLMNRColumnIndex].Visible = chkShowLMNR.Checked; gvList.Columns[intLMLBYSColumnIndex].Visible = chkShowLMLBYS.Checked; gvList.Columns[intSFLBLMColumnIndex].Visible = chkShowSFLBLM.Checked; gvList.Columns[intSFWBURLColumnIndex].Visible = chkShowSFWBURL.Checked; // 数据查询 appData = new T_BG_0602ApplicationData(); 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(); }
protected override void FilterReportList_SelectedIndexChanged(object sender, EventArgs e) { appData = new T_BG_0602ApplicationData(); FilterReportName.Text = string.Empty; if (FilterReportList.SelectedIndex > 0) { FilterReportApplicationData filterReportApplicationData = FilterReportBusinessEntity.GetDataByObjectID(FilterReportList.SelectedValue); T_BG_0602ApplicationData obj = new T_BG_0602ApplicationData(); appData = JsonHelper.JsonToObject(filterReportApplicationData.BGCXTJ, appData) as T_BG_0602ApplicationData; FilterReportName.Text = filterReportApplicationData.BGMC; } if (appData != null) { LMM.Text = GetValue(appData.LMM); SJLMH.SelectedValue = GetValue(appData.SJLMH); LMLBYS.SelectedValue = GetValue(appData.LMLBYS); LMNR.Text = GetValue(appData.LMNR); } Initalize(); }
//===================================================================== // FunctionName : Initalize /// <summary> /// ÖØÔسõʼ»¯º¯Êý /// </summary> //===================================================================== protected override void Initalize() { try { appData = new T_BG_0602ApplicationData(); 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_BG_0602ApplicationData(); 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; }
//===================================================================== // FunctionName : ExportToFile /// <summary> /// 重载导出到文件函数 /// </summary> //===================================================================== protected override void ExportToFile() { appData = new T_BG_0602ApplicationData(); 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_BG_0602ApplicationData.GetDataFromDataFile <T_BG_0602ApplicationData>(InfoFromDoc.Text, true, true, recordStartLine: T_BG_0602Contants.ImportDataSetStartLineNum); T_BG_0602ApplicationLogic instanceT_BG_0602ApplicationLogic = (T_BG_0602ApplicationLogic)CreateApplicationLogicInstance(typeof(T_BG_0602ApplicationLogic)); totalCount = appDatas.Count; foreach (var app in appDatas) { app.LMH = instanceT_BG_0602ApplicationLogic.AutoGenerateLMH(app); if (!LMM.Text.IsHtmlNullOrWiteSpace()) { app.LMM = Convert.ToString(LMM.Text); } string strSJLMH = GetValue(new RICH.Common.BM.T_BG_0602.T_BG_0602ApplicationLogicBase().GetValueByFixCondition("LMM", app.SJLMH, "LMH")); if (!DataValidateManager.ValidateIsNull(strSJLMH)) { app.SJLMH = strSJLMH; } if (!SJLMH.SelectedValue.IsHtmlNullOrWiteSpace()) { app.SJLMH = Convert.ToString(SJLMH.SelectedValue); } if (!LMTP.Text.IsHtmlNullOrWiteSpace()) { app.LMTP = Convert.ToString(LMTP.Text); } if (!LMNR.Text.IsHtmlNullOrWiteSpace()) { app.LMNR = Convert.ToString(LMNR.Text); } string strLMLBYS = GetValue(new RICH.Common.BM.Dictionary.DictionaryApplicationLogicBase().GetValueByFixCondition("MC", app.LMLBYS, "DM")); if (!DataValidateManager.ValidateIsNull(strLMLBYS)) { app.LMLBYS = strLMLBYS; } if (!LMLBYS.SelectedValue.IsHtmlNullOrWiteSpace()) { app.LMLBYS = Convert.ToString(LMLBYS.SelectedValue); } string strSFLBLM = GetValue(new RICH.Common.BM.Dictionary.DictionaryApplicationLogicBase().GetValueByFixCondition("MC", app.SFLBLM, "DM")); if (!DataValidateManager.ValidateIsNull(strSFLBLM)) { app.SFLBLM = strSFLBLM; } if (!SFLBLM.SelectedValue.IsHtmlNullOrWiteSpace()) { app.SFLBLM = Convert.ToString(SFLBLM.SelectedValue); } string strSFWBURL = GetValue(new RICH.Common.BM.Dictionary.DictionaryApplicationLogicBase().GetValueByFixCondition("MC", app.SFWBURL, "DM")); if (!DataValidateManager.ValidateIsNull(strSFWBURL)) { app.SFWBURL = strSFWBURL; } if (!SFWBURL.SelectedValue.IsHtmlNullOrWiteSpace()) { app.SFWBURL = Convert.ToString(SFWBURL.SelectedValue); } if (!WBURL.Text.IsHtmlNullOrWiteSpace()) { app.WBURL = Convert.ToString(WBURL.Text); } instanceT_BG_0602ApplicationLogic.Add(app); if (app.ResultCode == RICH.Common.Base.ApplicationData.ApplicationDataBase.ResultState.Succeed) { importCount++; } else { app.OPCode = RICH.Common.Base.ApplicationData.ApplicationDataBase.OPType.PK; instanceT_BG_0602ApplicationLogic.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); } }