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(); }
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( ); }
private void GetAllDepart( ) { DBBase db = new DBBase( ); string s = "SELECT Rkey, departmentname FROm datadepartment"; DataTable dt = new DataTable( ); dt = db.SqlOpen(s); cbx_depart.DataSource = dt; cbx_depart.DataTextField = "departmentname"; cbx_depart.DataValueField = "Rkey"; cbx_depart.DataBind( ); }
protected void GetRestType() { string s = "SELECT Rkey,leavetype FROM askforleave"; DBBase db = new DBBase( ); DataTable tb = new DataTable( ); tb = db.SqlOpen(s); cbx_RestType.DataSource = tb; cbx_RestType.DataTextField = "leavetype"; cbx_RestType.DataValueField = "Rkey"; cbx_RestType.DataBind( ); }
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; } }
private bool checkuser(string username, string usercode) { string s = "SELECT Rkey,chinesename, employeecode , Cardno FROM employeemsg WHERE chinesename=" + Mgr.QuoteStr(username) + " AND employeecode=" + Mgr.QuoteStr(usercode); DBBase db = new DBBase( ); DataTable dt = new DataTable( ); dt = db.SqlOpen(s); if (dt.Rows.Count > 0) { Cardno = dt.Rows[0]["Cardno"].ToString( ); rkey = dt.Rows[0]["Rkey"].ToString( ); return(true); } return(false); }
private void GetData() { if (!Mgr.CheckLogin(this, 2)) { 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 受理时间 "; s += " FROM Req d1 INNER JOIN employeemsg d2 ON d1.employeeid = d2.rkey "; s += " WHERE ReqPerson = " + Mgr.QuoteStr(Session["USER_FULL_NAME"].ToString( )) + " AND Reqtime BETWEEN " + Mgr.QuoteStr(BeginTime.Text) + " AND "; s += " dateadd(day,2," + Mgr.QuoteStr(EndTime.Text) + ") " + " AND ReqState = " + cbx_type.SelectedValue.ToString( ); s += " ORDER BY Reqtime"; DBBase db = new DBBase( ); DataTable tb = new DataTable( ); tb = db.SqlOpen(s); ReqDataView.DataSource = tb; ReqDataView.DataBind( ); }