| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 623 人关注过本帖
标题:做了个考勤系统,现在审核页面有问题
只看楼主 加入收藏
水晶心
Rank: 1
等 级:新手上路
帖 子:69
专家分:0
注 册:2010-7-27
结帖率:80%
收藏
已结贴  问题点数:20 回复次数:1 
做了个考勤系统,现在审核页面有问题
public partial class LoginAdmin_ShenHe : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (!Page.IsPostBack)
            {
                if (Session["User"] == null || Session["User"].ToString() == "")
                {
                    Response.Write("<script>alert('超时,请重新登录!');top.location.href='../Login.aspx'</script>"); return;
                }
            }
            if (Session["User"] == null || Session["User"].ToString() == "")
            {
                Response.Write("<script>alert('超时,请重新登录!');top.location.href='../Login.aspx'</script>"); return;
            }
            Bind();
        }
    }

   

    #region 绑定Gridview

    public void Bind()
    {
        IList<Kaoqin> list = KaoqinManager.GetKaoqinByState();
        this.GridView1.DataSource = list;
        this.GridView1.DataBind();
    }
       //员工名称
    public string UserName(object userid)
    {
        int id = Convert.ToInt32(userid.ToString());
        User user = UserManager.GetUserByUserid(id);
        if (user != null)
        {
            return user.Username;
        }
        else
        {
            return "";
        }
    }
    //休假时间
    public string XiujiaName(object XiujiaId)
    {
        int id = Convert.ToInt32(XiujiaId.ToString());
        if (id != 0)
        {
            Xiujia xiujia = XiujiaManager.GetXiujiaByXid(id);
            return xiujia.Xname;
        }
        else
        {
            return "";
        }
    }
    //时间
    public string Time(object time, object outTime)
    {
        DateTime name = Convert.ToDateTime(time);
        if (name.ToString() == outTime.ToString())
        {
            return "";
        }
        else if (name.Year > 2009)
        {
            return time.ToString();
        }
        else
        {
            return "";
        }

    }

   
        
    #region 查询
    protected void btnSelect_Click(object sender, EventArgs e)
    {
        List<Kaoqin> kaoqinList = new List<Kaoqin>();
        string userName = this.txtSelectUserName.Text.Trim();
        List<User> list = UserManager.GetUserByUserName(userName);
        if (list != null)
        {
            foreach (User user in list)
            {
                List<Kaoqin> kq = KaoqinManager.GetKaoqinByUserId(user.Userid);
                foreach (Kaoqin kaoqin in kq)
                {
                    kaoqinList.Add(kaoqin);
                }
            }
        }
        this.GridView1.DataSource = kaoqinList;
        this.GridView1.DataBind();
    }
    #endregion
    protected void Button1_Click(object sender, EventArgs e)
    {
        foreach (GridViewRow row in GridView1.Rows)
        {
            CheckBox checkBox = row.FindControl("cboCheck") as CheckBox;
            if (checkBox.Checked)
            {
                int id = Convert.ToInt32(GridView1.DataKeys[row.RowIndex].Value);
                Kaoqin kaoqin=new Kaoqin();
                kaoqin.Kid=id;
                kaoqin.State=1;
                KaoqinManager.ModifyKaoqinByStatus(kaoqin);
                this.ClientScript.RegisterStartupScript(this.GetType(),"","alert('审核成功!');",true);
                Response.Redirect("ShenHe.aspx");
            }

        }
    }


这是管审核的类

    #region 查询未通过审核的考勤记录
        public static List<Kaoqin> GetKaoqinByState()
        {
            string sql = "select * from kaoqin where state=0 order by kid desc";
            List<Kaoqin> list = new List<Kaoqin>();

            try
            {
                DataTable table = DBHelper.GetDataSet(sql);

                foreach (DataRow row in table.Rows)
                {
                    Kaoqin kaoqin = new Kaoqin();

                    if (!Convert.IsDBNull(row["kid"]))
                        kaoqin.Kid = (int)row["kid"];
                    if (!Convert.IsDBNull(row["userid"]))
                        kaoqin.Userid = (int)row["userid"];
                    if (!Convert.IsDBNull(row["kintime"]))
                        kaoqin.Kintime = (DateTime)row["kintime"];
                    if (!Convert.IsDBNull(row["kouttime"]))
                        kaoqin.Kouttime = (DateTime)row["kouttime"];
                    if (!Convert.IsDBNull(row["xiujiaid"]))
                        kaoqin.Xiujiaid = (int)row["xiujiaid"];
                    if (!Convert.IsDBNull(row["state"]))
                        kaoqin.State = (int)row["state"];
                    list.Add(kaoqin);
                }

                return list;
            }

现在是这样一种状态,领导审核的时候所有部门的员工考勤信息都显示出来了,我需要把员工的考勤信息按照部门显示,并且审核。具体比如:“登录的考勤记录员是信息科的,那么审核页面里显示的都是信息科的考勤记录。”这样的话代码如何修改啊,需要修改审核的类啊,还是需要修绑定数据,考勤表中没有部门id,只有考勤id和用户id 。
搜索更多相关主题的帖子: 考勤系统 页面 审核 
2010-10-22 10:31
筱晓绾
Rank: 10Rank: 10Rank: 10
来 自:湖南
等 级:贵宾
威 望:12
帖 子:512
专家分:1736
注 册:2010-9-1
收藏
得分:20 
看样子不是代码的问题,而是业务逻辑的问题吧!信息科的考勤记录员登录,就显示信息科的考勤记录,这与权限有关吧!你的后台系统是怎么弄的?用户对应角色,角色对应模块吗?呵呵,我也有点糊涂了!慢慢等高手出现吧!
2010-10-22 11:07
快速回复:做了个考勤系统,现在审核页面有问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017022 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved