项目中的精华功能讲解:相信大家都用过CSDN 中结贴的功能吧(弹出的小黄窗体)

本文介绍了一个使用C#实现的奖金分配系统,该系统通过网页形式展现,支持部门经理进行奖金分配操作,并提供了数据验证、合计计算等功能。

相信大家都用过CSDN 中结贴的功能吧(弹出的小黄窗体)

如下图所示:

这个功能可以大家有时在项目中也要用到,我项目中就用到过

具体实现:

前台:

 

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Import Namespace="System.Data" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    
<title></title>
    
<script language="javascript" type="text/javascript">
        
<!--
        
//如CSDN一样的提示层
        function wfsr(txt){
        event.cancelBubble
=true
        oStr
= "<div id='tip' style='position:absolute;border:1px solid  #000000;background-color:#ff8080;font-size:9pt;color:#FFFFFF;;filter:progid:DXImageTransform.Microsoft.dropshadow(OffX=0,OffY=0,Color=gray,Positive=true);display:none'></div>";
        
if(typeof(tip)=="undefined")
        document.body.insertAdjacentHTML(
"BeforeEnd",oStr)
        tip.innerHTML
="分配总金额:"+Number(document.getElementById("lbBUDGT02").value) + "<br/>你目前可分配金额:"+ (Number(document.getElementById("lbBUDGT02").value)-Number(document.getElementById("lbVal02").value));
        tip.style.top
=event.clientY+10
        tip.style.left
=event.clientX+10
        tip.style.display
=''
        }

        document.onclick
=function(){
        
if(typeof(tip)!=="undefined"&&event.srcElement.id!="tip"&&event.srcElement.parentElement.id!='tip')
        tip.style.display
="none"
        }

        
        
function   myPosition(obj){   
          
var   t   =   obj.offsetTop,l   =   obj.offsetLeft;   
                  
while   (obj=   obj.offsetParent){   
          t   
+=   obj.offsetTop;     
          l   
+=   obj.offsetLeft;   
                  }
   
                  alert(t);   
                  alert(l);   
          }
   

            
function clearNoNum(obj)
            
{
                
//先把非数字的都替换掉,除了数字和.
                obj.value = obj.value.replace(/[^d.]/g,"");
                
//必须保证第一个为数字而不是.
                obj.value = obj.value.replace(/^./g,"");
                
//保证只有出现一个.而没有多个.
                obj.value = obj.value.replace(/.{2,}/g,".");
                
//保证.只出现一次,而不能出现两次以上
                obj.value = obj.value.replace(".","$#$").replace(/./g,"").replace("$#$",".");
            }

            
function   chkN(str)
            
{
                
if(/D/.test(str.value)){alert('只能输入数字');str.value='0.00';}
            }
   
            
function setVal02(obj)
            
{
                document.getElementById(
"lbVal02").innerText="";
                
var sum = 0;
                
var txts =  document.getElementById('<%=objGridView.ClientID%>').getElementsByTagName("INPUT");

                
for(var i=0;i<txts.length;i++)
                
{    
                    
if(txts[i].type=="text")
                    
{
                        sum 
+= Number(txts[i].value);
                        document.getElementById(
"lbVal02").value = sum;
                    }

                }

            }

            
function Chk_BUDGT02BUDGT03()
            
{
                
var budgt03 = document.getElementById("lbVal02").value;
                
var budgt02 = document.getElementById("lbBUDGT02").value;
                
if(Number(budgt03)>Number(budgt02))
                
{
                    alert(
"分配额总和"+budgt03+"不能大于可分配额"+budgt02 +",请重输检查输入");//给于提示
                    return false;
                }

            }

        
//-->    
    
</script>

    
<link href="../Css/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
    
<form id="form1" runat="server">
        
<div style="text-align: center">
            
<table style="width: 100%" align="center" border="1" cellspacing="0" rules="rows">
                
<tr>
                    
<td colspan="5" align="left">
                    当前位置:
<asp:Label ID="lbPosition" runat="server" Text="Label"></asp:Label>
                        
<asp:DropDownList ID="ddlBonus" runat="server" OnSelectedIndexChanged="ddlBonus_SelectedIndexChanged" AutoPostBack="True">
                        
</asp:DropDownList></td>
                
</tr>
                
<tr>
                    
<td colspan="5">
                        
<asp:Label ID="lbddlBonusText" runat="server" Text="Label"></asp:Label><br />
                    
<div style="display:none">(<asp:Label ID="lbYear" runat="server" Text="Label"></asp:Label><asp:Label ID="lbReason"
                        runat
="server" Text="Label"></asp:Label>季)</div></td>
                
</tr>
                
<tr>
                    
<td style="width: 100px; height: 23px;">部门:<asp:Label ID="lbSText" runat="server" Text='<%#strLbSTEXT %>'></asp:Label></td>
                    
<td style="height: 23px;" colspan="3">
                    (上次结余:
<asp:Label
                        
ID="lbBUDGT" runat="server" Text="Label"></asp:Label>
                    || 本部门总额:
<asp:Label ID="lbBUDGT01" runat="server" Text="Label"></asp:Label><asp:TextBox
                        
ID="lbBUDGT02" runat="server"></asp:TextBox></td>
                    
<td style="width: 100px; height: 23px;">
                    
</td>
                
</tr>
                
<tr>
                    
<td colspan="5">
                    
<asp:GridView ID="objGridView" runat="server" Width="100%" AutoGenerateColumns="False" OnRowDataBound="objGridView_RowDataBound">
                        
<Columns>
                            
<asp:TemplateField HeaderText="序号">
                                
<ItemTemplate>
                                    
<asp:Label ID="lbID" runat="server" Text='<%#Container.DataItemIndex+1%>'></asp:Label>
                                
</ItemTemplate>
                                
<HeaderStyle Width="48px" />
                                
<ItemStyle Width="48px" />
                            
</asp:TemplateField>
                            
<asp:BoundField DataField="SNAME" HeaderText="姓名" >
                                
<HeaderStyle Width="50%" />
                                
<ItemStyle Width="50%" />
                            
</asp:BoundField>
                            
<asp:BoundField DataField="KQXS"  HeaderText="季度缺勤信息" HtmlEncode="False" >
                                
<HeaderStyle Width="12%" />
                                
<ItemStyle Width="12%" />
                            
</asp:BoundField>
                            
<asp:BoundField DataField="VAL01" HeaderText="标准绩效工资" HtmlEncode="False" >
                                
<HeaderStyle Width="12%" />
                                
<ItemStyle Width="12%" />
                            
</asp:BoundField>
                            
<asp:TemplateField HeaderText="二次分配额">
                                
<EditItemTemplate>
                                
</EditItemTemplate>
                                
<ItemTemplate>
                                    
<asp:Label ID="Label1" runat="server" Text='<%# Bind("VAL02") %>' style="display:none;"></asp:Label>

                                    
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("VAL02") %>' Width="100px" onmouseout="tip.style.display='none';"  onmouseover='wfsr(this);this.select();this.focus();'  onclick="wfsr(this);this.select();this.focus();" onchange="setVal02(this);"></asp:TextBox>
                                
</ItemTemplate>
                            
</asp:TemplateField>   
                        
</Columns>
                       
                    
</asp:GridView>
                    
</td>
                
</tr>
                
<tr>
                    
<td style="width: 100px; height: 23px;">
                        合计:
</td>
                    
<td style="width: 100px; height: 23px;">
                    
</td>
                    
<td style="width: 100px; height: 23px;">
                    
</td>
                    
<td style="width: 100px; height: 23px;">
                    
</td>
                    
<td style="width: 100px; height: 23px;">
                        
<asp:TextBox ID="lbVal02" style="border:0px" ReadOnly="true" runat="server"></asp:TextBox></td>
                
</tr>
                
<tr>
                    
<td colspan="5" style="height: 23px">
                        
<hr color="#bed6ff" noshade="noshade" />
                        
<asp:GridView ID="objForm" runat="server" Width="100%" AutoGenerateColumns="False">
                            
<Columns>
                                
<asp:BoundField DataField="SNAME2" HeaderText="人力资源审核人">
                                    
<HeaderStyle Width="30%" />
                                    
<ItemStyle Width="30%" />
                                
</asp:BoundField>
                                
<asp:BoundField DataField="ADVISE" HeaderText="审核意见" />
                            
</Columns>
                        
</asp:GridView>
                    
</td>
                
</tr>
                
<tr>
                    
<td colspan="5" style="height: 69px">
                    
<hr color="#b6d3f1" noshade="noshade" />
                    
<table>
                        
<tr>
                            
<td style="height: 26px"><asp:Button ID="btnSave" runat="server" Text="保 存" OnClick="btnSave_Click" OnClientClick="return Chk_BUDGT02BUDGT03();"/>
                                
<asp:Button ID="btnOK" runat="server" Text="提 交" OnClick="btnOK_Click" OnClientClick="return confirm('是否发起流程');"/>
                                
<asp:Button ID="btnCancel" runat="server" Text="取 消"/></td>
                        
</tr>
                    
</table>
                    
</td>
                
</tr>
            
</table>
        
</div>

    
</form>
</body>
</html>

 

后台: 

//*******************************************************
//*版本:V0.1

//*作者:wyj

//*时间:2008-4-24

//*修改时间:                                                 
//*******************************************************
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using ChamcDoc.HRUser;
using ChamcDoc.HR;

public partial class _Default : System.Web.UI.Page
{
    
public string strORGEH = "50000013"//CurrUser.getCurrUser().DeptID;//这个是经理登陆传过来的部门ID号  触发点(测试点:50000013)
    public string strCTYPE = "BON01";  //这个也是传入的是季度还是年终(BON01/BON02)
    protected string strWhere = "";  //传入的条件
    public string strLbSTEXT = "";   //部门名称
    public string strDEPID = "";
    
public string strPosition = "部门经理填写本部门奖金分配";//当前位置
    public string strLbBUDGT = "";   //上次结余
    public string strLbBUDGT01 = "";    //本部门总额
    public string strLbBUDGT02 = "";
    
public string strLbBUDGT03 = "";
    DataSet ds_Emp 
= new DataSet();  //员工奖金记录信息
    DataSet ds_Dep = new DataSet(); //员工部门记录信息
    public decimal sum_val01 = 0.00m;  //标准绩效工资合计
    public decimal sum_val02 = 0.00m;   //二次分配合计
    protected void Page_Load(object sender, EventArgs e)
    
{
        
if (!IsPostBack)
        
{      
            GetDepDataList(strORGEH);
            strCTYPE 
= this.ddlBonus.SelectedValue.ToString();  //给出列表初始选中状态
            ViewState["CTYPE"= (object)strCTYPE;

            GetDepBonusData_DEP(strORGEH,strCTYPE);

            onInit(strORGEH, strCTYPE);
            GetDepBonusData_EMP(strORGEH,strCTYPE);
        }


    }

    
//得到各部门奖金分配员工列表数据
    private void GetDepBonusData_EMP(string strORGEH,string CTYPE)
    
{
        strWhere 
= " ORGEH = " + strORGEH +" and CTYPE = '" + CTYPE + "'";
        ds_Emp 
= HRBonusEmpList.Instance.GetList(strWhere);
        
this.objGridView.DataSource = ds_Emp.Tables[0].DefaultView;
        objGridView.DataKeyNames 
= new string[] "ID" };//主键(注意DataKeyNames 是复数间接告诉我们这里是可以有多个字段即可以是联合主键)
        this.objGridView.DataBind();
    }

    
//得到各部门奖金分配部门列表数据
    private void GetDepBonusData_DEP(string strORGEH,string CTYPE)
    
{
        strWhere 
= " ORGEH = " + strORGEH + " and CTYPE = '" + CTYPE + "'";
        ds_Dep 
= HRBonusDepList.Instance.GetList(strWhere);
        
if (ds_Dep.Tables[0].Rows.Count > 0)
        
{
            strDEPID 
= ds_Dep.Tables[0].Rows[0]["ID"].ToString(); //部门
            this.lbSText.Text = ds_Dep.Tables[0].Rows[0]["STEXT"].ToString(); //部门
            this.lbBUDGT.Text = ds_Dep.Tables[0].Rows[0]["BUDGT"].ToString(); //上次结余
            this.lbBUDGT01.Text = ds_Dep.Tables[0].Rows[0]["BUDGT01"].ToString(); //本部门总额
            this.lbBUDGT02.Text = ds_Dep.Tables[0].Rows[0]["BUDGT02"].ToString(); //总计
            strLbBUDGT02 = ds_Dep.Tables[0].Rows[0]["BUDGT02"].ToString();
            strLbBUDGT03 
= ds_Dep.Tables[0].Rows[0]["BUDGT03"].ToString();
            ViewState[
"strLbBUDGT02"= (object)strLbBUDGT02;
            ViewState[
"strLbBUDGT03"= (object)strLbBUDGT03;
            ViewState[
"strDEPID"= (object)strDEPID;
        }

    }

    
//得到所有要分配金额的列表
    private void GetDepDataList(string strORGEH)
    
{
        DataSet ds 
= new DataSet();
        strWhere 
= " ORGEH = '" + strORGEH + "' and ID not in (select DEPID from BOUNSWF_PROCESS where MARK = 3 or MARK = 1)";
        ds 
= HRBonusDepList.Instance.GetList_YEREDEP(strWhere);
        
if (ds.Tables[0].Rows.Count > 0)
        
{
            
this.ddlBonus.DataSource = ds;
            ddlBonus.DataTextField 
= "Flag";
            ddlBonus.DataValueField 
= "CTYPE";
            ddlBonus.DataBind();
        }

    }

    
/// <summary>
    
/// 做合计,显示字体标识等
    
/// </summary>
    
/// <param name="sender"></param>
    
/// <param name="e"></param>

    protected void objGridView_RowDataBound(object sender, GridViewRowEventArgs e)
    
{

        
if (e.Row.RowType == DataControlRowType.DataRow)
        
{
            Label lbVal02 
= (Label)e.Row.Cells[4].FindControl("Label1"as Label;
            
if (e.Row.RowIndex >= 0)
            
{
                sum_val01 
+= Convert.ToDecimal(e.Row.Cells[3].Text);
                
if (lbVal02.Text != "")
                
{
                    sum_val02 
+= Convert.ToDecimal(lbVal02.Text);
                }

            }

        }

        
//合计统计
        this.lbVal02.Text = sum_val02.ToString("0.00");
    }

    
/// <summary>
    
/// 保存数据
    
/// </summary>
    
/// <param name="sender"></param>
    
/// <param name="e"></param>

    protected void btnSave_Click(object sender, EventArgs e)
    
{
        
for (int i = 0; i < objGridView.Rows.Count; i++)
        
{
            TextBox txt_val02 
= objGridView.Rows[i].Cells[4].FindControl("TextBox1"as TextBox;

            HRBonusEmpList.Instance.CTYPE 
= ViewState["CTYPE"].ToString();
            HRBonusEmpList.Instance.ORGEH 
= strORGEH.ToString();
            HRBonusEmpList.Instance.VAL02 
= Convert.ToDecimal(txt_val02.Text);    //分配金额
            HRBonusDepList.Instance.BUDGT02 = Convert.ToDecimal(ViewState["strLbBUDGT02"].ToString());
            HRBonusDepList.Instance.BUDGT03 
= Convert.ToDecimal(this.lbVal02.Text);
            HRBonusEmpList.Instance.ID 
= Convert.ToInt32(objGridView.DataKeys[i].Value);  //员工ID
            CreateProcess(0);
            Page.ClientScript.RegisterStartupScript(
this.GetType(), """<script>alert('数据保存成功!')</script>");
        }

    }

    
private void CreateProcess(int P_Mark)
    

            HRBonusDepList.Instance.ID 
= Convert.ToInt32(ViewState["strDEPID"].ToString()); //部门ID
            if (P_Mark == 1)
            
{
                WFProcess.Instance.PROCESSNAME 
= this.ddlBonus.SelectedItem.Text;
                WFProcess.Instance.PROCESSMEMO 
= this.ddlBonus.SelectedItem.Text;
                WFProcess.Instance.SNAME1 
= "登陆者";//登陆者
                WFProcess.Instance.BEGTIME = System.DateTime.Now;//当前时间
                WFProcess.Instance.MARK = 1//开始流程
            }

            
else
            
{
                WFProcess.Instance.PROCESSNAME 
= this.ddlBonus.SelectedItem.Text;
                WFProcess.Instance.PROCESSMEMO 
= this.ddlBonus.SelectedItem.Text;
                WFProcess.Instance.SNAME1 
= "登陆者";//登陆者
                WFProcess.Instance.BEGTIME = System.DateTime.Now;//当前时间
                WFProcess.Instance.MARK = 1//开始流程
            }

            HRBonusEmpList.Instance.Update(P_Mark);  
//保存上次所分配的金额值
    }

    
/// <summary>
    
/// 提交数据开始生成流程
    
/// </summary>
    
/// <param name="sender"></param>
    
/// <param name="e"></param>

    protected void btnOK_Click(object sender, EventArgs e)
    
{
        
for (int i = 0; i < objGridView.Rows.Count; i++)
        
{
            TextBox txt_val02 
= objGridView.Rows[i].Cells[4].FindControl("TextBox1"as TextBox;
            HRBonusEmpList.Instance.CTYPE 
= ViewState["CTYPE"].ToString();
            HRBonusEmpList.Instance.ORGEH 
= strORGEH.ToString();
            HRBonusEmpList.Instance.VAL02 
= Convert.ToDecimal(txt_val02.Text);    //分配金额
            HRBonusDepList.Instance.BUDGT02 = Convert.ToDecimal(ViewState["strLbBUDGT02"].ToString());
            HRBonusDepList.Instance.BUDGT03 
= Convert.ToDecimal(this.lbVal02.Text);
            HRBonusEmpList.Instance.ID 
= Convert.ToInt32(objGridView.DataKeys[i].Value);  //员工ID    
        }

        CreateProcess(
1);
        Response.Redirect(
"HRManageAudt.aspx");
    }

    
/// <summary>
    
/// 生成5位随机数
    
/// </summary>
    
/// <returns></returns>

    private string CreateRandom()
    
{
        Random ran 
= new Random(unchecked((int)DateTime.Now.Ticks));
        
int num = ran.Next(09999+ 10000;
        
return num.ToString();
    }

    
/// <summary>
    
/// 下拉列表框改变时
    
/// </summary>
    
/// <param name="sender"></param>
    
/// <param name="e"></param>

    protected void ddlBonus_SelectedIndexChanged(object sender, EventArgs e)
    
{
        strCTYPE 
= this.ddlBonus.SelectedValue.ToString();
        ViewState[
"CTYPE"= (object)strCTYPE;
        strLbBUDGT02 
= ViewState["strLbBUDGT02"].ToString();
        GetDepBonusData_EMP(strORGEH, strCTYPE);
        GetDepBonusData_DEP(strORGEH, strCTYPE);
        onInit(strORGEH, strCTYPE);
    }

    
//这里主要做页面初始化工作
    private void onInit(string strORGEH, string CTYPE)
    
{

        
if (this.ddlBonus.Items.Count > 0)
        
{
            
if (this.ddlBonus.SelectedItem.Value == "BON01")//当选中的是季度奖金分配
            {
                
this.lbddlBonusText.Text = this.ddlBonus.SelectedItem.Text;
            }

            
else if (this.ddlBonus.SelectedItem.Value == "BON02")  //当选中的年度奖金分配
            {
                
this.lbddlBonusText.Text = this.ddlBonus.SelectedItem.Text;
            }

        }

        strWhere 
= " Mark = 2 and DepID = (select ID from HRBONUS_DEPLIST where ORGEH = " + strORGEH + " and CTYPE = '" + CTYPE + "')";
        
if (WFProcess.Instance.Exit(strWhere) > 0)  //有返回的
        {
            
this.objForm.Visible = true;
            
this.lbPosition.Text = "部门经理修改返回本部门奖金分配";//当前位置
            strWhere = " ProcessID = (select ProcessID from BOUNSWF_Process where Mark=2 and DepID = (select ID from HRBONUS_DEPLIST where ORGEH = " + strORGEH + " and CTYPE = '" + CTYPE + "'))";
            DataSet ds 
= WFForm.Instance.GetList(strWhere);
            
if (ds.Tables[0].Rows.Count > 0)
            
{
                
this.objForm.DataSource = ds.Tables[0].DefaultView;
                
this.objForm.DataBind();
            }

        }

        
else
        
{
            
this.lbPosition.Text = strPosition;//当前位置
            this.objForm.Visible = false;
        }

    }
 
}

 

做得不好,只想给大家提个思路

 

内容概要:本文详细记录了对一个Android ARM64静态ELF文件中字符串加密机制的逆向分析过程。该ELF文件的所有字符串均被加密,无法通过常规strings命令或IDA直接识别。作者通过分析发现,加密字符串存储在.rodata段,其解密所需信息(包括密文地址、长度和16位密钥)保存在.data.rel.ro段的40字节描述符中。核心解密函数sub_10F408采用自反的双pass流密码算法,合固定密钥KEY_TERM(由.data段24字节数据计算得出),实现字节级非线性、位置与长度相关的加密。文章还复现了完整的Python解密脚本,并揭示了该保护机制的本质为代码混淆而非强加密,最终成功批量解密全部956条字符串,暴露程序真实行为,如shell命令模板、设备标识篡改、网络重置等操作。此外,文中还提及未启用的自定义壳框架及其反dump设计。; 适合人群:具备逆向工程基础的安全研究人员、二进制分析人员及对ELF保护技术感兴趣的开发者。; 使用场景及目标:①学习ELF二进制中字符串加密的典型实现方式与逆向突破口;②掌握从构识别、函数追踪到算法还原的完整逆向流程;③理解“绑定二进制”的完整性校验设计及其局限性;④实践编写IDAPython脚本自动化提取与解密敏感数据。; 阅读建议:此资源以实战案例驱动,不仅展示技术细节,更强调逆向思维与验证方法,建议读者合IDA调试环境,逐步跟随文中步骤进行动态分析与算法验证,深入理解每一步的推理依据。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值