一张培训表,分为很多字段,抽象的培训建表,相比较商品之类的实体建表,更难一些,当然多看多想多实践,一切熟能生巧
这一次代码实现关键是根据客户提出需求,用程序员的思维,建立对应的表,核心是不同的字段,不同的人进行维护
1.培训计划填写界面+后端代码
非专业前端页面,觉得难看的话,请体谅......
using Hcl;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections;
using jj360;
namespace 聚直银.Web
{
public partial class trainAdd : jj360.Web.BasePage
{
protected IBrainControlOperateData Op = new OperateWebData();
private dbo conn = common.make();
private UserInfo ui = new UserInfo();
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
this.TextBox2.Text = DateTime.Now.ToString("yyyy-MM-dd");
this.TextBox2.Attributes.Add("onfocus", "WdatePicker({isShowClear:false,dateFmt:'yyyy-MM-dd'})");
if (Request.QueryString["ID"] != null)
{
DataTable dt = conn.GetDataTable("select a.*,b.INSUCHNNM from IBAS_Train a join IBAS_YBTINSUINFO b on a.INSUID = b.INSUID where GUID='" + CommonMethods.GetSafeViewBag(Request.QueryString["ID"]) + "'");
if (dt != null && dt.Rows.Count > 0)
{
// myEditor.Value = dt.Rows[0]["Content"].ToString();
Memo.Value = dt.Rows[0]["Memo"].ToString();
MainPerson.Value = dt.Rows[0]["MainPerson"].ToString();
textFilter.Value = dt.Rows[0]["INSUCHNNM"].ToString();
TextBox2.Text =Convert.ToDateTime(dt.Rows[0]["TranPlanDate"]).ToString("yyyy-MM-dd");
RadioButtonList1.SelectedIndex = Convert.ToInt32(dt.Rows[0]["TranPlanAddressType"].ToString());
Op.Fill(dt.Rows[0], this.Controls);
}
}
if (Request.QueryString["t"] != null)
{
//进行报告填写,
this.Controls.SetControlsToNormal();
this.Button1.Visible = false;
}
}
}
protected void Button1_Click(object sender, EventArgs e)
{
try
{
string title = Request["BrainTextBox1"];
// string content = myEditor.Value;
string id = Request.QueryString["ID"];
if (Memo.Value.Length ==0)
{
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "js", "<script language='javascript' type='text/javascript'>top.$.messager.error('提示', '培训内容不能为空!');</script>");
return;
}
if (MainPerson.Value.Length ==0)
{
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "js", "<script language='javascript' type='text/javascript'>top.$.messager.error('提示', '培训负责人主要信息不能为空!');</script>");
return;
}
if (Convert.ToInt32(BrainTextBox2.GetValue().ToString()) < 0 || Convert.ToInt32(BrainTextBox2.GetValue().ToString())>=128)
{
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "js", "<script language='javascript' type='text/javascript'>top.$.messager.error('提示', '计划时长无效(请尝试使用大于0,小于128的数!)');</script>");
return;
}
Hashtable ht = Op.Collect2Hashtable(this.Controls, "IBAS_Train");
//ht.Add("Content", myEditor.Value);
if (string.IsNullOrEmpty(id))
{
ht.Add("GUID", Guid.NewGuid().ToString());
ht.Add("INSUID", textFilter.Value);
ht.Add("TranPlanDate", TextBox2.Text);
ht.Add("Memo", Memo.Value);
ht.Add("MainPerson", MainPerson.Value);
//ht.Add("",TextBox2.ToString());
ht.Add("TranPlanAddressType", RadioButtonList1.SelectedValue);
//ht.Add("MainPerson", MainPerson.Value);
ht.Add("WorkNO", ui.UserName);
ht.Add("AddTime", DateTime.Now);
ht.Add("NetworkNo", ui.NetWorkNO);
ht.Add("State", 0);
//ht.Add("IsDeleted", 0);
//string sql = string.Format("INSERT INTO [IBAS_Train] (GUID,INSUID,Memo,MainPerson,TranPlanDate,TranPlanHours,TranPlanAddress,TranPlanAddressType,State)VALUES( NEWID() ,'" + Request.QueryString["moduleID"] + "' ,0 ,'{0}' ,'{1}','{2}')", title, content, config.conn.GetServerDateTime().ToString("yyyy-MM-dd HH:mm:ss"));
try
{
conn.Insert(ht, "IBAS_Train");
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "js", "<script language='javascript' type='text/javascript'>top.$.messager.info('提示', '提交成功!');window.top.reload_clfx.call();window.top.close_win.call();</script>");
return;
}
catch (Exception ee)
{
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "js", "<script language='javascript' type='text/javascript'>top.$.messager.error('提示', '提交失败!');window.top.reload_clfx.call();window.top.close_win.call();</script>");
return;
throw;
}
}
else
{
string sql = @"Update IBAS_Train set Memo='@Memo' , MainPerson='@MainPerson',TranPlanDate='@TranPlanDate' , TranPlanHours='@TranPlanHours',TranPlanAddressType='@TranPlanAddressType' , TranPlanAddress='@TranPlanAddress' , WorkNO='@WorkNO' , AddTime='@AddTime' , NetworkNo='@NetworkNo' where GUID='@id'".Replace("@Memo", Memo.Value).Replace("@MainPerson", MainPerson.Value).Replace("@TranPlanDate", TextBox2.Text).Replace("@TranPlanHours", BrainTextBox2.GetValue().ToString()).Replace("@TranPlanAddressType", RadioButtonList1.SelectedValue).Replace("@TranPlanAddress", BrainTextBox4.GetValue().ToString()).Replace("@WorkNO", ui.UserName).Replace("@AddTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")).Replace("@NetworkNo", ui.NetWorkNO).Replace("@id", id);
int res=conn.Update(sql) ;
if (res > 0)
{
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "js", "<script language='javascript' type='text/javascript'>top.$.messager.info('提示', '修改成功!');window.top.reload_clfx.call();window.top.close_win.call();</script>");
return;
}
else
{
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "js", "<script language='javascript' type='text/javascript'>top.$.messager.error('提示', '修改失败!');window.top.reload_clfx.call();window.top.close_win.call();</script>");
return;
}
}
}
catch(Exception ex)
{
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "js", "<script language='javascript' type='text/javascript'>top.$.messager.error('提示', '提交出错" + ex.Message.Replace("\r\n", "") + "!');</script>");
}
}
}
}
2展示管理页面+前后端代码
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Train.aspx.cs" Inherits="jj360.Web.BX.Train" %>
<%@ Register Src="~/Web/commonheader.ascx" TagPrefix="uc1" TagName="commonheader" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<uc1:commonheader runat="server" ID="commonheader" />
<style>
input, select {
/* height: 28px; */
border-radius: 6px;
border: #95B8E7 1px solid;
height: 24px !important;
border-color: #9ecaed !important;
}
</style>
<script>
$(function () {
bindgb();
})
function bindgb() {
$("#dg").Datagrid({
url: "/Service/BX.ashx?Method=List_Train&" + $("#form1").serialize(),
singleSelect: true,
showFooter: false,
sortName: 'AddTime',
sortOrder: 'desc',
frozenColumns: [[
//generatecolumn({ field: "chk", "checkbox": true })
]],
columns: [[
generatecolumn({ field: "INSUCHNNM", title: "保险公司", width: 180, align: 'left' }),
generatecolumn({
field: "State", title: "审核状态", width: 80, formatter: function (value, row) {
if (value == "0")
return "<span style='color:red;'>待审核</span>"
else if (value == "1")
return "<span style='color:blue;'>已通过</span>"
else if (value == "2")
return "<span style='color:orange;'>已培训</span>"
else {
return "未通过"
}
}
}),
generatecolumn({ field: "Memo", title: "培训内容", width: 90, align: 'left' }),
generatecolumn({ field: "MainPerson", title: "负责人信息", width: 90 }),
generatecolumn({ field: "TranPlanDate", title: "计划培训时间", width: 90, formatter: Dateformatter }),
generatecolumn({
field: "TranPlanHours", title: "计划培训时长", width: 90, align: 'left', formatter: function (value) {
return value + "小时";
}
}),
generatecolumn({
field: "TranPlanAddressType", title: "计划地址类型", width: 90, formatter: function (value) {
return value == 0 ? "网点" : "外训";
}
}),
generatecolumn({ field: "TranPlanAddress", title: "计划培训地址", width: 90, align: 'left' }),
generatecolumn({ field: "PlanDate", title: "培训时间", width: 90, formatter: Dateformatter }),
generatecolumn({
field: "PlanHours", title: "培训时长", width: 90, align: 'left', formatter: function (value) {
if (value==null) {
return "";
}
else
return value + "小时";
}}),
generatecolumn({
field: "PlanAddressType", title: "地址类型", width: 90, formatter: function (value) {
if (value == 0) {
return "网点" ;
}
else if (value == 1) {
return "外训";
}
else {
return "";
}
}
}),
generatecolumn({ field: "PlanAddress", title: "培训地址", width: 90, align: 'left' }),
generatecolumn({ field: "addName", title: "填写人", width: 90 }),
generatecolumn({ field: "Name", title: "填写网点", width: 90 }),
generatecolumn({
field: "Score", title: "评分", width: 130, align: 'left', formatter: function (value, row) {
var str = "";
for (var i = 0; i < value; i++) {
str += " <span style='color:rgb(255, 228, 141);font-size:18px;'>★</span> ";
}
str += "";
return str;
}
}),
generatecolumn({ field: "AddTime", title: "添加时间", width: 150, formatter: DateTimeformatter }),
generatecolumn({ field: "examineName", title: "审核人", width: 90 }),
generatecolumn({ field: "ExamineTime", title: "审核时间", width: 150, formatter: DateTimeformatter }),
]]
});
}
function onApply(ID) {
if (ID) {
top.$.messager.confirm('提示', '是否确定申领该保单?', function (y) {
if (y) {
$.post("/Service/BX.ashx?Method=Apply_BDGL_BD", { ID: ID }, function (data) {
top.$.messager.info('提示', data);
bindgb()
});
}
})
}
}
function onPolicyno(TRACENO) {
top.tanchu('dialog', '保单详情', '/Web/BX/bdxxDialog.aspx?TRACENO=' + TRACENO + '&RecordOrderID=1', 880, 475, null);
}
function addItem() {
top.tanchu("dialog", "申领", "/Web/BX/BDGL_BD_Add.aspx", 500, 280, null);
}
window.top["reload_BDGL_BD"] = function (str, msg) {
bindgb()
};
function delItem() {
var selected = $("#dg").datagrid('getSelections');
if (selected.length > 0) {
var s = selected.filter(function (v) { return v.State != 1 && v.AddWorkNo=='<%= ui.UserName%>' }).map(function (v) { return v.GUID })
if (s.length > 0 && s.length == selected.length) {
top.$.messager.confirm('提示', '是否确定取消申领?', function (y) {
if (y) {
$.post("/Service/BX.ashx?Method=Delete_BDGL_BD", { ID: s.join(',') }, function (data) {
top.$.messager.info('提示', data);
bindgb()
});
}
})
}
else {
top.$.messager.info('提示', '只能取消本人未通过审核的申领记录!');
}
} else {
top.$.messager.alert('提示', '您还没有选中一行,请选中再操作!');
}
}
function oncheckin() {
var selected = $("#dg").datagrid('getSelections');
if (selected.length > 0) {
var s = selected.filter(function (v) { return v.State != 1 && v.WorkNO }).map(function (v) { return v.GUID });
if (s.length > 0 && s.length == selected.length) {
top.$.messager.confirm('提示', '是否确定审核通过?', function (y) {
if (y) {
//alert(s.join(','));
$.post("/Service/BX.ashx?Method=Checkin_Train", { ID: s.join(',') }, function (data) {
top.$.messager.info('提示', data);
bindgb()
});
}
})
}
else {
top.$.messager.alert('提示', '请选择待审核的保单进行操作!');
}
} else {
top.$.messager.alert('提示', '您还没有选中一行,请选中再操作!');
}
}
function oncheckout() {
var selected = $("#dg").datagrid('getSelections');
if (selected.length > 0) {
var s = selected.filter(function (v) { return v.State == 0 }).map(function (v) { return v.GUID })
//console.log(s);
//return;
if (s.length > 0) {
top.$.messager.confirm('提示', '是否确定审核未通过?', function (y) {
if (y) {
//console.log(s)
$.post("/Service/BX.ashx?Method=Checkout_Train", { ID: s.join(',') }, function (data) {
top.$.messager.info('提示', data);
bindgb()
});
}
})
}
else {
top.$.messager.alert('提示', '请选择待审核的保单进行操作!');
}
} else {
top.$.messager.alert('提示', '您还没有选中一行,请选中再操作!');
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div id="div_main">
<div id="tool" class="toolbar" runat="server">
<ul style="list-style-type: none;border-bottom: 1px dashed #61b1f3;height: 32px;margin-top: -1px;">
<li>
<a class="easyui-linkbutton" id="A1" onclick="addItem();" iconcls="icon-add" style="margin-top:1px;" >添加</a>
</li>
<li>
<a class="easyui-linkbutton" id="A2" onclick="editItem();" iconcls="icon-edit" style="margin-top:1px;" >修改</a>
</li>
<li>
<a id="A3" class="easyui-linkbutton" onclick="delItem();" iconcls="icon-cancel" style="margin-top:1px;" >删除</a>
</li>
<li style="width:18px;display:inline-block;height:100%"></li>
<%-- <li> <a class="easyui-linkbutton" id="addBtn" onclick="addItem();" style="margin-top:1px;" iconcls="icon-add" runat="server">申领录入</a></li>
<li> <a class="easyui-linkbutton" id="delBtn" onclick="delItem();" style="margin-top:1px;" iconcls="icon-remove" runat="server">取消申领</a></li>--%>
<li> <a class="easyui-linkbutton" id="checkin" onclick="oncheckin();" style="margin-top:1px;" iconcls="icon-sptg" runat="server">审核通过</a></li>
<li> <a class="easyui-linkbutton" id="checkout" onclick="oncheckout();" style="margin-top:1px;" iconcls="icon-spbtg" runat="server">审核不通过</a></li>
<li style="width:18px;display:inline-block;height:100%"></li>
<li> <a class="easyui-linkbutton" id="A4" onclick="editTrain();" style="margin-top:1px;" iconcls="icon-edit" runat="server">培训填写</a></li>
</ul>
<ul style="height: 32px;margin-top: 1px;">
<li style="margin-top:4px;">
<anthem:RadioButtonList ID="RadioButtonList1" runat="server" TextDuringCallBack="loading..." RepeatDirection="Horizontal" RepeatLayout="Flow" onchange="bindgb()">
<Items>
<asp:ListItem>待审核</asp:ListItem>
<asp:ListItem>已通过</asp:ListItem>
<asp:ListItem>已培训</asp:ListItem>
<asp:ListItem Selected="True">全部</asp:ListItem>
</Items>
</anthem:RadioButtonList>
|
<anthem:RadioButtonList ID="RadioButtonList2" runat="server" TextDuringCallBack="loading..." RepeatDirection="Horizontal" RepeatLayout="Flow" onchange="bindgb()">
<Items>
<asp:ListItem>本周</asp:ListItem>
<asp:ListItem>下周</asp:ListItem>
<asp:ListItem>本月</asp:ListItem>
<asp:ListItem>下月</asp:ListItem>
<asp:ListItem Selected="True">全部</asp:ListItem>
</Items>
</anthem:RadioButtonList>
| 保险公司:<input name="INSUID" type="text" id="textFilter" placeholder="" style="width: 180px;height:26px;" />
<%--<input id="textFilter" name="INSUID" class="easyui-combox" style="width:210px;height:26px"/>--%>
<a class="easyui-linkbutton" id="search" iconcls="icon-search" onclick="bindgb();">搜索</a>
</li>
</ul>
</div>
<div id="dg">
</div>
</div>
</form>
</body>
</html>
<script>
function editTrain() {
var selected = $("#dg").datagrid('getSelected');
if (selected != null) {
if (selected.State != "1" && selected.State != null) {
top.$.messager.alert('提示', '该状态不能修改。');
return;
}
top.Window("dialog", "填写培训计划", "/Web/BX/TrainedAdd.aspx?ID=" + selected.GUID + "&t=1", 800, 600, null);
} else {
top.$.messager.alert('提示', '您还没有选中一行,请选中再修改!');
}
}
function delItem() {
var selected = $("#dg").datagrid('getSelected');
//console.log(selected.ArticleID);
if (selected != null) {
top.$.messager.confirm('提示', '是否确定要删除?', function (y) {
if (y) {
$.post("/Service/BX.ashx?Method=Del_tran", { id: selected.GUID }, function (data) {
top.$.messager.show({
title: "提示",
msg: data
});
$("#dg").datagrid('reload');
});
}
})
} else {
top.$.messager.alert('提示', '您还没有选中一行,请选中再刪除!');
}
}
//--------------类似反射,这里定义一个方法,为reload_clfx,然后在弹窗子页面,调用window.top.reload_clfx.call();
window.top["reload_clfx"] = function (str, msg) {
$('#dg').Datagrid("reload");
};
function ck(e) {
top.Window("dialog", "查看", "/System/clfxAdd.aspx?ID=" + $(e).attr("ids") + "&t=1", 800, 600, null);
}
var isEdit = false;
function addItem() {
top.tanchu("dialog", "填写培训计划", "/Web/BX/trainAdd.aspx?INSUID=" + getQueryString("moduleID"), 800, 508, null);
}
function editItem() {
var selected = $("#dg").datagrid('getSelected');
if (selected != null) {
//if (selected.State != "0" && selected.State != null) {
// top.$.messager.alert('提示', '该状态不能修改。');
// return;
//}
top.tanchu("dialog", "编辑", "/Web/BX/trainAdd.aspx?ID=" + selected.GUID, 800, 600, null);
} else {
top.$.messager.alert('提示', '您还没有选中一行,请选中再修改!');
}
}
$('#textFilter').combobox({
mode: 'remote',
url: '/Service/EasyUiService.ashx?Method=AutoComplete_BXGS',
valueField: 'INSUID',
textField: 'INSUCHNNM',
onSelect: function () {
var txt = $("#textFilter").combobox('getText');
$('#textFilter').combobox('setText', txt);
}
});
</script>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Hcl;
namespace jj360.Web.BX
{
public partial class Train : jj360.Web.BasePage
{
protected UserInfo ui = new UserInfo();
private dbo conn = common.make();
protected void Page_Load(object sender, EventArgs e)
{
if (ui.RoleID == config.LCSROLEGUID)
{
this.checkin.Visible = false;
this.checkout.Visible = false;
}
else if (ui.RoleID == config.GLYROLEGUID && ui.UserType == "2级支行")
{
//this.addBtn.Visible = false;
//this.delBtn.Visible = false;
}
else
{
this.checkin.Visible = false;
this.checkout.Visible = false;
//this.addBtn.Visible = false;
//this.delBtn.Visible = false;
}
}
}
}
public void List_Train()
{
// select a.*,b.INSUCHNNM,c.RealName,d.RealName,e.Name from IBAS_Train a
//join IBAS_YBTINSUINFO b on a.INSUID = b.INSUID
//join Tb_Common_User c on a.WorkNO = c.Username
//join Tb_Common_User d on a.ExamineWorkNO = d.Username
//join WFT_Network e on a.NetworkNo = e.NetworkNO
//考虑审核工号为空
string sql = @"select a.*,b.INSUCHNNM,c.RealName addName,(select t.RealName from Tb_Common_User t where a.ExamineWorkNO=t.Username) examineName,e.Name
from IBAS_Train a
join IBAS_YBTINSUINFO b on a.INSUID = b.INSUID
join Tb_Common_User c on a.WorkNO = c.Username
join WFT_Network e on a.NetworkNo = e.NetworkNO
where @where";
string where = " 1=1 ";
string state = replaceDanger("RadioButtonList1");
if (state == "待审核")
{
where += " and a.State='0'";
}
else if (state == "已审核")
{
where += " and a.State='1'";
}
else if (state == "已培训")
{
where += " and a.State='2' AND a.ExamineWorkNo IS NOT NULL";
}
string period = replaceDanger("RadioButtonList2");
if (period == "本周")
{
where += " and datediff(week,a.AddTime,getdate())=0";
}
else if (period == "下周")
{
where += " and datediff(week,a.AddTime,getdate())=1";
}
else if (period == "本月")
{
where += " and datediff(mm,a.AddTime,getdate())=0";
}
else if (period == "下月")
{
where += " and datediff(mm,a.AddTime,getdate())=1";
}
//else if (state == "未申领")
//{
// where += " and a.State='0' AND a.AddWorkNo IS NULL";
//}
if(!string.IsNullOrEmpty(Request["INSUID"]))
{
where += " AND a.INSUID='" + Request["INSUID"] + "'";
}
//if (!string.IsNullOrEmpty(Request["INSUID"]))
//{
// where += " AND a.INSUID='" + Request["INSUID"] + "'";
//}
//if (ui.UserType.Contains("支行"))
// where += " and CHARINDEX(a.NetworkNO,(select AllChildNetworkNO from WFT_Network where NetworkNO='" + ui.NetWorkNO + "'))>0";
//else if (ui.UserType.Contains("网点"))
// where += " and a.NetworkNO='" + ui.NetWorkNO + "'";
sql = sql.Replace("@where", where);
DataTable dt = conn.GetDataTable(sql);
JsonConvert<object> jc = new JsonConvert<object>();
Response.Write(jc.ToDataGrid(dt, dt.Rows.Count.ToString()));
}
3提醒功能界面+相关前后端代码
var nextmsgstyle;
var bottom=0;
if ('<%=ArticleID%>' != '') {
console.log(1);
top.$.messager.show({
title: "事件推送",
msg: "<%=Title%><a onclick='updateSJTS(\"<%=ArticleID%>\")' style='cursor:hand'>【详情】</a>",
timeout: 8000
});
bottom+=100;
nextmsgstyle = { left: '', right: 0, top: '', bottom: bottom };
}
var rcount = <%=RemindCount%>;
if (rcount > 0) {
console.log(2);
top.$.messager.show({
title: "开放提醒",
msg: "您的客户有 <%=RemindCount%> 款产品即将开放,请关注!<a onclick='showKFTX()' style='cursor:hand'>【详情】</a>",
timeout: 8000,
style: nextmsgstyle
});
bottom+=180;
nextmsgstyle = { left: '', right: 0, top: '', bottom: bottom };
}
//二级网点,是否可以看到培训计划填写提醒,
if ('<%=GUID%>' != '' ) {
console.log(3);
top.$.messager.show({
title: "培训填写",
msg: "您所在网点的的培训【<%=Train%>——<%=Memo%>】已进行!<a onclick='updateTrain(\"<%=GUID%>\")' style='cursor:hand;color:red;'>【填写培训内容】</a>",
height:"180px",
timeout: 8000,
style: nextmsgstyle
});
bottom+=180;
nextmsgstyle = { left: '', right: 0, top: '', bottom: bottom };
}
if ('<%=GUID1%>' != '') {
console.log(4);
top.$.messager.show({
title: "培训参加",
msg: "您所在网点的培训【<%=Train1%>——<%=Memo1%>】即将开始!<a onclick='showTrain(\"<%=GUID1%>\")' style='cursor:hand;color:red;'>【详情】</a>",
//
height:"180px",
timeout: 8000,
style: nextmsgstyle
});
}
window.top["reload_clfx"] = function (str, msg) {
//避免报错
};
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Hcl;
using System.IO;
using System.Text.RegularExpressions;
using System.Data;
namespace XQH.EasyUi.Web
{
public partial class Index : jj360.Web.BasePage
{
protected UserInfo ui = new Hcl.UserInfo();
private dbo conn = common.make();
public string ico;
public string flag = "false";
public string url = "";
public string urlName = "";
protected string LastTime;
protected string ArticleID = "";
protected string Title = "";
protected string GUID = "";
protected string Train = "";
protected string Memo = "";
protected string GUID1 = "";
protected string Train1 = "";
protected string Memo1 = "";
protected string RemindCount = string.Empty;
protected void Page_Load(object sender, EventArgs e)
{
//Response.Write(ui.RoleID);
if (!IsPostBack)
{
if (ui.Valid == false)
{
Response.Redirect("/Login.aspx");
Response.End();
}
RealName = ui.RoleName+":"+ ui.RealName;
if (Request.QueryString["url"] != null)
{
url = Request.QueryString["url"];
}
if (Request.QueryString["urlName"] != null)
{
urlName = Request.QueryString["urlName"];
}
DataRow dr = conn.GetDataRow("SELECT top 1 convert(varchar,OperateTime,120) OperateTime FROM Tb_Common_OperateRecord where UserID='" + ui.UserName + "' and ModelID='FF0562B5-CAB2-4EE8-8A56-1AA4110D2411' order by OperateTime desc");
if (dr != null)
{
LastTime = dr["OperateTime"].ToString();
}
DataRow dr1 = conn.GetDataRow("select top 1 a.ArticleID,Title from YX_SJTS a where charindex('" + ui.RoleID + "',RoleGUId)>0 and not exists(select 1 from YX_SJTSDetails b where a.ArticleID=b.ArticleID and b.WorkNo='" + ui.UserName + "') order by a.AddTime desc");
if (dr1 != null)
{
ArticleID = dr1["ArticleID"].ToString();
Title = dr1["Title"].ToString();
}
//时间到,处于已通过状态的,当前网点所有人都会提醒,两天内尚未过期的
DataRow dr2 = conn.GetDataRow("select top 1 a.*,b.INSUCHNNM from IBAS_Train a join IBAS_YBTINSUINFO b on a.INSUID = b.INSUID where datediff(dd,getdate(),a.TranPlanDate)<=2 and datediff(dd,getdate(),a.TranPlanDate) >=0 and a.NetworkNo='" + ui.NetWorkNO + "' and a.State=1");
if (dr2 != null)
{
GUID1 = dr2["GUID"].ToString();
Train1 = dr2["INSUCHNNM"].ToString();
Memo1 = dr2["Memo"].ToString();
}
//时间到,填写,针对所有二级行,网点管理员
DataRow dr3 = conn.GetDataRow("select top 1 a.*,b.INSUCHNNM from IBAS_Train a join IBAS_YBTINSUINFO b on a.INSUID = b.INSUID where datediff(ss,a.TranPlanDate,getdate())>0 and a.NetworkNo='" + ui.NetWorkNO + "' and a.State=1");
if (dr3 != null && ui.RoleName == "管理员" && (ui.UserType == "2级支行" || ui.UserType == "网点"))
{
GUID = dr3["GUID"].ToString();
Train = dr3["INSUCHNNM"].ToString();
Memo = dr3["Memo"].ToString();
}
RemindCount = conn.GetScalar("SELECT COUNT(DISTINCT b.DM) FROM DX_OpenSet_Remind a JOIN DX_OpenSet b ON a.OpenSetID=b.ID WHERE a.WorkNo='" + ui.UserName + "' AND a.HasRead='1'");
}
}
public string RealName;
protected override void Render(HtmlTextWriter writer)
{
TextWriter tempWriter = new StringWriter();
base.Render(new HtmlTextWriter(tempWriter));
string newstr = "";
//1.定义页面的样式表,所有从这个基类继承而来的页面都不需要添加样式表的链接。
//string css = AppName + "/System/Css/main.css";//自定义css样式路径
//string newCSS = "<link type=\"text/css\" rel=\"stylesheet\" href=\"" + AppName + "/System/Css/main.css" + "\" /><link type=\"text/css\" rel=\"stylesheet\" href=\"" + AppName + "/System/tipswindown/tipswindown.css" + "\" />";
//2.定义页面的应用js,所有从这个基类继承而来的页面都不需要添加js的链接。
//string js = AppName + "/System/Js/My97DatePicker/WdatePicker.js";//自定义js路径
//string js1 = AppName + "/system/js/jquery/jquery-1.4.1.js";//自定义js路径
//string js2 = AppName + "/system/js/jsTools.aspx";//自定义js路径
//string newJS = "<script src=\"" + AppName + "/system/js/jsTools.aspx" + "\"></script><script src=\"" + AppName + "/System/My97DatePicker/WdatePicker.js" + "\"></script><script src=\"" + AppName + "/system/js/jquery/jquery-1.4.1.js" + "\"></script></script><script src=\"" + AppName + "/system/tipswindown/tipswindown.js" + "\"></script>";//如果有多个js文件时,可以继续加入
//string newJS1 = "<script src=\"" + js1 + "\"></script>";
//string newJS2 = "<script src=\"" + js2 + "\"></script>";
//string newstr = "</HEAD>";
writer.Write(Regex.Replace(tempWriter.ToString(), "<HEAD>", newstr, RegexOptions.IgnoreCase));
//原理就是把</head>标签替换为想要加的内容,然后再加上</head>标签,相当于在</head>标签前插入想要加的内容。
}
}
}
题外话:后端采用是.net ,其实增删改非常常见,如果封装好相关代码,会起到事半功倍的效果,公司封装的一个控件工具,比较好用,但一直没有时间研究。
以上就是全部内容,内容比较冗杂,看自己的重点就行,希望给需要的人一点启发,仓促之下完成,水平不足之处,请多理解!