⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmattendance.cs

📁 中小企业人力资源管理系统
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace HRP.Wage
{
    public partial class frmAttendance : Form
    {
        public frmAttendance()
        {
            InitializeComponent();
        }
        SqlDataAdapter sda;
        DataSet ds;
        string strMonth;
        BaseClass.SqlClass sqlclass = new HRP.BaseClass.SqlClass();
        string strsql = "select * from tb_Attendance ";
        private void frmAttendance_Load(object sender, EventArgs e)
        {
            this.Bind(strsql);
            if (DateTime.Now.Month.ToString().Length < 2)
            {
                strMonth = "0" + DateTime.Now.Month.ToString();
            }
            else
            {
                strMonth = DateTime.Now.Month.ToString();
            }
            this.Bind(strsql);
        }
        public void Bind(string strsql)
        {
            sda = sqlclass.sqlsda(strsql);
            ds = new DataSet();
            SqlCommandBuilder sb = new SqlCommandBuilder(sda);
            sda.Fill(ds, "tb_Attendance");
            this.dgvAttendance.DataSource = ds.Tables["tb_Attendance"];
        }

        private void t1btnAll_Click(object sender, EventArgs e)
        {
            if (this.t1btnAll.Text == "当前月份")
            {
                strsql = "select * from tb_Attendance where MonthWage='" + DateTime.Now.Year + "-" + strMonth + "'";
                this.t1btnAll.Text = "全部月份";
            }
            else
            {
                strsql = "select * from tb_Attendance ";
                this.t1btnAll.Text = "当前月份";
            }
            this.Bind(strsql);
        }

        private void tlbtnEdit_Click(object sender, EventArgs e)
        {
            if (ds.Tables["tb_Attendance"].GetChanges() != null)
            {
                sda.Update(ds, "tb_Attendance");
                sda.Dispose();
            }
        }

        private void tlClose_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
        {
            e.Graphics.FillRectangle(Brushes.Red,new Rectangle(200, 200, 200, 200));

        }
        private System.Drawing.Printing.PrintDocument document = new System.Drawing.Printing.PrintDocument();
        private void tlbtnPrint_Click(object sender, EventArgs e)
        {
            document.DocumentName = " TreeView1.SelectedNode.Tag.ToString()";


            // Set the PrintPreviewDialog.Document property to
            // the PrintDocument object selected by the user.
            printPreviewDialog1.Document = document;

            // Call the ShowDialog method. This will trigger the document's
            //  PrintPage event.
            printPreviewDialog1.ShowDialog();
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -