Ejemplo n.º 1
0
    private void GetData()
    {
        if (!Mgr.CheckLogin(this, 3))
        {
            return;
        }

        string s = "SELECT d1.rkey ,d2.employeecode as 工号, d2.chinesename as 姓名,  ";

        s += " (case reqstate when 0 then '未提交' when 1 then '已提交' when 2 then '已审核' when 3 then '退回' end) as 状态, reqinfo as 备注, reqperson as 提交人,";
        s += " reqtime as 提交时间, (case reqtype when 0 then '补卡' when 1 then '请假' when 2 then '修改工时' end ) as 类型, req_cardtime as 时间, req_starttime as 始,";
        s += " req_endtime as 终, zbhour as 正班, jbhour as 加班, dealperson as 受理人, dealtime as 受理时间 , d1.Cardno, d1.employeeid , d1.AskForLeaveRK, d3.LeaveType";
        s += " FROM Req d1 INNER JOIN employeemsg d2 ON d1.employeeid = d2.rkey ";
        s += " LEFT JOIN AskForLeave d3 ON d1.AskForLeaveRK = d3.RKey ";
        s += " WHERE Reqtime BETWEEN " + Mgr.QuoteStr(BeginTime.Text) + " AND ";
        s += " dateadd(day,2," + Mgr.QuoteStr(EndTime.Text) + ") " + " AND ReqState = " + cbx_type.SelectedValue.ToString( );
        if (!string.IsNullOrEmpty(tbxEmployID.Text))
        {
            if (!Mgr.CheckInt(tbxEmployID.Text))
            {
                Mgr.ShowAlert(this, "工号只能是数字!");
                return;
            }
            s += " AND d2.employeecode=" + tbxEmployID.Text;
        }
        s += " ORDER BY 工号";
        DBBase    db = new DBBase( );
        DataTable tb = new DataTable( );

        tb = db.SqlOpen(s);
        ReqDataView.DataSource = tb;
        ReqDataView.DataBind( );
    }
Ejemplo n.º 2
0
    private void GetSelectData()
    {
        DBBase db = new DBBase( );

        if (!Mgr.CheckDate(BeginTime.Text) || !Mgr.CheckDate(EndTime.Text))
        {
            Mgr.ShowAlert(this, "时间格式不正确");
            return;
        }

        string s = "SELECT top 100 d2.chinesename AS 姓名,d2.employeecode AS 工号, d1.CheckDate AS 日期, d1.OnDutytime1 AS 签到1 , d1.OffDutytime1 AS 签退1, d1.OnDutytime2 AS 签到2 , d1.OffDutytime2 AS 签退2,d1.OnDutytime3 AS 签到3 , d1.OffDutytime3 AS 签退3, d1.YTNote AS 异常, d1.RWT AS 正班 , d1.ROT AS 加班 , d1.SWT AS 需正, d1.OWT AS 需加  FROM OnOffDutyData d1 ";

        s += "INNER JOIN employeemsg d2 ON d1.EmployeeID = d2.Rkey ";
        s += "  LEFT JOIN class d4 ON d1.ClassID = d4.RKey ";
        s += " LEFT JOIN resttypemsg d3 ON d1.RestType = d3.rkey ";
        s += " INNER JOIN datadepartment d5 ON d2.departmentid = d5.RKey ";
        s += " WHERE d1.CheckDate BETWEEN " + Mgr.QuoteStr(BeginTime.Text) + " AND " + Mgr.QuoteStr(EndTime.Text);
        if (!string.IsNullOrEmpty(tbx_GH.Text))
        {
            s += " AND d2.employeecode = " + Mgr.QuoteStr(tbx_GH.Text);
        }
        s += " AND d5.RKey=" + cbx_depart.SelectedValue.ToString( );
        DataTable dt = new DataTable( );

        dt = db.SqlOpen(s);
        NaturalView.DataSource = dt;
        NaturalView.DataBind();
    }
Ejemplo n.º 3
0
    protected void Btn_login_Click1(object sender, EventArgs e)
    {
        string username = Tbx_userID.Text;
        string pwd      = Tbx_userpwd.Text;

        if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(pwd))
        {
            Mgr.ShowAlert(this, "用户名或密码为空");
            return;
        }

        if (!Mgr.CheckStr(username) || !Mgr.CheckStr(pwd))
        {
            Mgr.ShowAlert(this, "包含非法字符");
            return;
        }

        if (Mgr.Login(this, Tbx_userID.Text, Tbx_userpwd.Text))
        {
            Response.Redirect("Navigate.aspx");
        }
        else
        {
            //Lbl_message.Text = "用户名或密码错误";
        }
    }
Ejemplo n.º 4
0
    private void Reqsub(int n)
    {
        if (!checkuser(tbx_EmpName.Text, tbx_EmpID.Text))
        {
            Mgr.ShowAlert(this, "姓名工号不匹配");
            return;
        }

        string s = " ";

        switch (cbx_ReqType.SelectedIndex)
        {
        //补卡
        case 0:
            if (!Mgr.CheckDate(tbx_time1.Text))
            {
                Mgr.ShowAlert(this, "时间格式错误");
                return;
            }
            s = "INSERT INTO Req VALUES(" + rkey.ToString( ) + ", " + Mgr.QuoteStr(Cardno.ToString( )) + ", getdate(), " + Mgr.QuoteStr(Session["USER_FULL_NAME"].ToString( )) + "," + Mgr.QuoteStr(tbx_ReqNote.Text) + "," + n.ToString() + "," + cbx_ReqType.SelectedValue.ToString( ) + ",null,null,null,null," + Mgr.QuoteStr(tbx_time1.Text) + ",null,null,null)";
            break;

        //请假
        case 1:
            if (!Mgr.CheckDate(tbx_time1.Text) || !Mgr.CheckDate(tbx_time2.Text))
            {
                Mgr.ShowAlert(this, "时间格式错误");
                return;
            }
            s = "INSERT INTO Req VALUES(" + rkey.ToString( ) + ", " + Mgr.QuoteStr(Cardno.ToString( )) + ", getdate(), " + Mgr.QuoteStr(Session["USER_FULL_NAME"].ToString( )) + "," + Mgr.QuoteStr(tbx_ReqNote.Text) + "," + n.ToString( ) + "," + cbx_ReqType.SelectedValue.ToString( ) + ",null,null," + Mgr.QuoteStr(tbx_time1.Text) + "," + Mgr.QuoteStr(tbx_time2.Text) + ",null,null,null," + cbx_RestType.SelectedValue.ToString( ) + ")";
            break;

        //手动修改工时
        case 2:
            if (!Mgr.CheckDate(tbx_date.Text))
            {
                Mgr.ShowAlert(this, "日期格式不正确");
                return;
            }
            if (!Mgr.CheckDoule(tbx_ZB.Text) || !Mgr.CheckDoule(tbx_JB.Text))
            {
                Mgr.ShowAlert(this, "工时不正确");
                return;
            }
            s = "INSERT INTO Req VALUES(" + rkey.ToString( ) + ", " + Mgr.QuoteStr(Cardno.ToString( )) + ", getdate(), " + Mgr.QuoteStr(Session["USER_FULL_NAME"].ToString( )) + "," + Mgr.QuoteStr(tbx_ReqNote.Text) + "," + n.ToString( ) + "," + cbx_ReqType.SelectedValue.ToString( ) + ",null,null,null,null," + Mgr.QuoteStr(tbx_date.Text) + "," + tbx_ZB.Text.ToString( ) + "," + tbx_JB.Text.ToString( ) + ",null)";

            break;
        }
        DBBase db = new DBBase( );

        if (db.SqlExec(s) == 1)
        {
            Mgr.ShowAlert(this, "添加成功");
            Response.Write("<script>window.location.href='ReqSubmit.aspx'</script>");
        }
        else
        {
            Mgr.ShowAlert(this, "添加失败");
        }
    }
Ejemplo n.º 5
0
    protected void Btn_PostBack_Click(object sender, EventArgs e)
    {
        if (!Mgr.CheckLogin(this, 2))
        {
            return;
        }
        bool   b = false;
        string errstr = "", s;
        int    nSucc  = 0;
        int    ntotal = 0;

        for (int nn = 0; nn < ReqDataView.Rows.Count; nn++)
        {
            GridViewRow row  = ReqDataView.Rows[nn];
            Control     ctrl = row.FindControl("CheckBox1");
            if ((ctrl as CheckBox).Checked)
            {
                ntotal++;
                int n = row.RowIndex;
                //TableCellCollection cell = row.Cells;
                int    ReqRkey = Convert.ToInt32(ReqDataView.DataKeys[n].Values[0].ToString( ));
                int    nState  = Mgr.GetReqState(ReqRkey);
                string estr    = "";
                if (!Mgr.CheckState(nState, new int[] { 1 }, ref estr))
                {
                    errstr += "第 " + ntotal.ToString( ) + " 条 " + estr + "\\n";
                }
                else
                {
                    s = "UPDATE Req SET reqstate = 3 WHERE RKey= " + ReqRkey.ToString( );
                    DBBase db = new DBBase( );
                    if (db.SqlExec(s) <= 0)
                    {
                        errstr += "第 " + ntotal.ToString( ) + "条 返回0,操作失败 \\n";
                    }
                    else
                    {
                        nSucc++;
                        errstr += "第 " + ntotal.ToString( ) + "条 操作成功 \\n";
                    }
                }
                b = true;
            }
        }
        if (!b)
        {
            errstr = "数据为空";
        }
        else
        {
            errstr += "总共: " + ntotal.ToString( ) + "条    成功:" + nSucc.ToString( ) + "条";
        }
        Mgr.ShowAlert(this, errstr);
        GetData( );
    }
Ejemplo n.º 6
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        DBBase    db = new DBBase( );
        string    s  = "";
        DataTable dt = new DataTable( );

        switch (SelectType.SelectedIndex)
        {
        case 0:
            if (!Mgr.CheckStr(GH.Text))
            {
                Mgr.ShowAlert(this, "工号不正确");
                return;
            }
            s  = "select departmentname AS '部门名字', employeecode AS '工号', chinesename AS '姓名',ondutytime AS '入职日期',qualified as '休假资格',year_s3 as '年假产生年',year_s1 AS '休假年',shouldhav AS '年假天数', h_used AS '已休天数',h_left AS '剩余天数' from  dbo.V_employee_yearholiday ";
            s += " WHERE employeecode = " + GH.Text;
            s += " AND year_s1 = " + Mgr.QuoteStr(Convert.ToDateTime(YearTime.Text).Year.ToString( ));
            s += " order By employeecode ASC";
            dt = db.SqlOpen(s);
            GridView1.DataSource = dt;
            GridView1.DataBind( );
            break;

        case 1:
            s  = "select departmentname AS '部门名字', employeecode AS '工号', chinesename AS '姓名',ondutytime AS '入职日期',qualified as '休假资格',year_s3 as '年假产生年',year_s1 AS '休假年',shouldhav AS '年假天数', h_used AS '已休天数',h_left AS '剩余天数' from  dbo.V_employee_yearholiday ";
            s += " WHERE departmentname = " + Mgr.QuoteStr(cbx_depart.SelectedItem.Text);
            s += " AND year_s1 = " + Mgr.QuoteStr(Convert.ToDateTime(YearTime.Text).Year.ToString( ));
            s += " order By employeecode ASC";
            dt = db.SqlOpen(s);
            GridView1.DataSource = dt;
            GridView1.DataBind( );
            break;

        default:
            break;
        }
    }