//===================================================================== // 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_PM_UserGroupInfoApplicationData(); 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["UserGroupName"].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_PM_UserGroupInfoApplicationData(); QueryRecord(); gvPrint.Visible = true; gvPrint.DataSource = appData.ResultSet; gvPrint.DataBind(); gvPrint.Columns[intUserGroupIDColumnIndex - 1].Visible = chkShowUserGroupID.Checked; gvPrint.Columns[intUserGroupNameColumnIndex - 1].Visible = chkShowUserGroupName.Checked; gvPrint.Columns[intUserGroupContentColumnIndex - 1].Visible = chkShowUserGroupContent.Checked; gvPrint.Columns[intUserGroupRemarkColumnIndex - 1].Visible = chkShowUserGroupRemark.Checked; gvPrint.Columns[intDefaultPageColumnIndex - 1].Visible = chkShowDefaultPage.Checked; gvPrint.Columns[intUpdateDateColumnIndex - 1].Visible = chkShowUpdateDate.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() { // 初始化界面 UserGroupContent.ImageGalleryPath = "~/Media/Image/FreeTextBox/" + Session[RICH.Common.ConstantsManager.SESSION_USER_ID] + "/"; UserGroupRemark.ImageGalleryPath = "~/Media/Image/FreeTextBox/" + Session[RICH.Common.ConstantsManager.SESSION_USER_ID] + "/"; // 界面控件状态 if (ViewMode || EditMode || CopyMode) { // 读取要修改记录详细资料 appData = new T_PM_UserGroupInfoApplicationData { 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"]); UserGroupID.Text = GetValue(appData.ResultSet.Tables[0].Rows[0]["UserGroupID"]); UserGroupName.Text = GetValue(appData.ResultSet.Tables[0].Rows[0]["UserGroupName"]); UserGroupContent.Text = GetValue(appData.ResultSet.Tables[0].Rows[0]["UserGroupContent"]); UserGroupRemark.Text = GetValue(appData.ResultSet.Tables[0].Rows[0]["UserGroupRemark"]); DefaultPage.Text = GetValue(appData.ResultSet.Tables[0].Rows[0]["DefaultPage"]); UpdateDate.Text = GetValue(appData.ResultSet.Tables[0].Rows[0]["UpdateDate"]); } } if (AddMode) { // 初始化传入参数 // 初始化默认值 UpdateDate.Text = DateTime.Now.ToString(); } }
protected override void Initalize() { // 读取记录详细资料 appData = new T_PM_UserGroupInfoApplicationData(); 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["UserGroupName"].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_PM_UserGroupInfoApplicationData(); CountRecord(); gvPrint.DataSource = appData.ResultSet; gvPrint.DataBind(); }
protected override void Initalize() { DetailPage = true; // 数据查询 appData = new T_PM_UserGroupInfoApplicationData(); 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_PM_UserGroupInfoApplicationData(); 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_PM_UserGroupInfoApplicationData(); 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_PM_UserGroupInfo", dt, true, true); T_PM_UserGroupInfoApplicationLogic instanceT_PM_UserGroupInfoApplicationLogic = (T_PM_UserGroupInfoApplicationLogic)CreateApplicationLogicInstance(typeof(T_PM_UserGroupInfoApplicationLogic)); foreach (DataRow dr in dt.Rows) { appData = new T_PM_UserGroupInfoApplicationData(); int i = 0; appData = instanceT_PM_UserGroupInfoApplicationLogic.Add(appData); } }
//===================================================================== // FunctionName : Initalize /// <summary> /// 重载初始化函数 /// </summary> //===================================================================== protected override void Initalize() { gvList.Columns[intUserGroupIDColumnIndex].Visible = chkShowUserGroupID.Checked; gvList.Columns[intUserGroupNameColumnIndex].Visible = chkShowUserGroupName.Checked; gvList.Columns[intUserGroupContentColumnIndex].Visible = chkShowUserGroupContent.Checked; gvList.Columns[intUserGroupRemarkColumnIndex].Visible = chkShowUserGroupRemark.Checked; gvList.Columns[intDefaultPageColumnIndex].Visible = chkShowDefaultPage.Checked; gvList.Columns[intUpdateDateColumnIndex].Visible = chkShowUpdateDate.Checked; // 数据查询 appData = new T_PM_UserGroupInfoApplicationData(); 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_PM_UserGroupInfoApplicationData(); FilterReportName.Text = string.Empty; if (FilterReportList.SelectedIndex > 0) { FilterReportApplicationData filterReportApplicationData = FilterReportBusinessEntity.GetDataByObjectID(FilterReportList.SelectedValue); T_PM_UserGroupInfoApplicationData obj = new T_PM_UserGroupInfoApplicationData(); appData = JsonHelper.JsonToObject(filterReportApplicationData.BGCXTJ, appData) as T_PM_UserGroupInfoApplicationData; FilterReportName.Text = filterReportApplicationData.BGMC; } if (appData != null) { UserGroupID.Text = GetValue(appData.UserGroupID); UserGroupName.Text = GetValue(appData.UserGroupName); UserGroupContent.Text = GetValue(appData.UserGroupContent); UserGroupRemark.Text = GetValue(appData.UserGroupRemark); } Initalize(); }
//===================================================================== // FunctionName : ExportToFile /// <summary> /// 重载ExportToFile /// </summary> //===================================================================== protected override void ExportToFile() { appData = new T_PM_UserGroupInfoApplicationData(); 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 : Initalize /// <summary> /// ÖØÔسõʼ»¯º¯Êý /// </summary> //===================================================================== protected override void Initalize() { try { appData = new T_PM_UserGroupInfoApplicationData(); 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> /// 重载导出到文件函数 /// </summary> //===================================================================== protected override void ExportToFile() { appData = new T_PM_UserGroupInfoApplicationData(); 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_PM_UserGroupInfoApplicationData.GetDataFromDataFile <T_PM_UserGroupInfoApplicationData>(InfoFromDoc.Text, true, true, recordStartLine: T_PM_UserGroupInfoContants.ImportDataSetStartLineNum); T_PM_UserGroupInfoApplicationLogic instanceT_PM_UserGroupInfoApplicationLogic = (T_PM_UserGroupInfoApplicationLogic)CreateApplicationLogicInstance(typeof(T_PM_UserGroupInfoApplicationLogic)); totalCount = appDatas.Count; foreach (var app in appDatas) { if (!UserGroupID.Text.IsHtmlNullOrWiteSpace()) { app.UserGroupID = Convert.ToString(UserGroupID.Text); } if (!UserGroupName.Text.IsHtmlNullOrWiteSpace()) { app.UserGroupName = Convert.ToString(UserGroupName.Text); } if (!UserGroupContent.Text.IsHtmlNullOrWiteSpace()) { app.UserGroupContent = Convert.ToString(UserGroupContent.Text); } if (!UserGroupRemark.Text.IsHtmlNullOrWiteSpace()) { app.UserGroupRemark = Convert.ToString(UserGroupRemark.Text); } if (!DefaultPage.Text.IsHtmlNullOrWiteSpace()) { app.DefaultPage = Convert.ToString(DefaultPage.Text); } app.UpdateDate = DateTime.Now; instanceT_PM_UserGroupInfoApplicationLogic.Add(app); if (app.ResultCode == RICH.Common.Base.ApplicationData.ApplicationDataBase.ResultState.Succeed) { importCount++; } else { app.OPCode = RICH.Common.Base.ApplicationData.ApplicationDataBase.OPType.PK; instanceT_PM_UserGroupInfoApplicationLogic.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); } }