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

📄 manualsignsearch.aspx.cs

📁 办公系统办公系统办公系统办公系统办公系统办公系统办公系统办公系统办公系统办公系统办公系统办公系统办公系统办公系统办公系统
💻 CS
字号:
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 Office.Model;
using Office.BLL;
using System.Collections.Generic;

public partial class ManualSign_ManualSignSearch : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

        if (!Page.IsPostBack)
        {
            BindControl();
            this.ddlBranch.Items.Insert(0, new ListItem("===请选择===="));
            this.ddlDempartment.Items.Insert(0, new ListItem("===请选择===="));
        }
    }
    //搜索  
    protected void imgBtnSearch_Click(object sender, ImageClickEventArgs e)
    {
        String StartTime = txtStartTime.Text;
        String EndTime = txtEndTime.Text;
        if (StartTime == "" && EndTime == "")
        {
            if (radionDay.Checked)
            {
                StartTime += DateTime.Now.ToShortDateString() + " 00:00:00";
                EndTime += DateTime.Now.ToShortDateString() + " 23:59:59";
            }
            else if (radioWeek.Checked)
            {
                Int32 we = (Int32)DateTime.Now.DayOfWeek;
                if (we == 0)
                    StartTime += DateTime.Now.AddDays(-(we + 7) + 1).ToShortDateString() + " 00:00:00";
                else
                    StartTime += DateTime.Now.AddDays(-we + 1).ToShortDateString() + " 00:00:00";
                EndTime += DateTime.Now.AddDays(-we + 7).ToShortDateString() + " 23:59:59";
            }
            else if (radioMonth.Checked)
            {
                StartTime += DateTime.Now.AddDays(-DateTime.Now.Day + 1).ToShortDateString() + " 00:00:00";
                EndTime += DateTime.Now.AddDays(-DateTime.Now.Day).AddMonths(1).ToShortDateString() + " 23:59:59";
            }
            else
            {
                return;
            }
        }
        String BranchName = ddlBranch.SelectedItem.Text;
        if (BranchName == "===请选择====")
            BranchName = "";
        String DepartName = ddlDempartment.SelectedItem.Text;
        if (DepartName == "===请选择====")
            DepartName = "";
        String UserId = txtEmployeeNumber.Text;
        String UserName = txtEmployeeName.Text;

        IList<ViewInfo> list = ViewManager.GetViewInfoByCondition(StartTime, EndTime, BranchName, DepartName, UserId, UserName);
        GridView1.DataSource = list;
        GridView1.DataBind();
    }
    private void BindControl()
    {
        this.ddlBranch.DataSource = BranchInfoManager.GetAllBranchInfos();
        this.ddlBranch.DataTextField = "BranchName";
        this.ddlBranch.DataValueField = "BranchId";
        this.ddlBranch.DataBind();

        this.ddlDempartment.DataSource = DepartInfoManager.GetAllDepartInfos();
        this.ddlDempartment.DataTextField = "DepartName";
        this.ddlDempartment.DataValueField = "DepartId";
        this.ddlDempartment.DataBind();
    }
    private void Bind()
    {
        GridView1.DataSource = ViewManager.GetAllViewInfo();
        GridView1.DataBind();
    }
    //机构
    protected void CheckBox1_CheckedChanged1(object sender, EventArgs e)
    {
        if (CheckBox1.Checked)
            ddlBranch.Enabled = true;
        else
        {
            ddlBranch.Enabled = false;
            ddlBranch.SelectedIndex = 0;
        }
    }
    //部门
    protected void CheckBox2_CheckedChanged(object sender, EventArgs e)
    {
        if (CheckBox2.Checked)
        {
            ddlDempartment.Enabled = true;
        }
        else
        {
            ddlDempartment.Enabled = false;
            ddlDempartment.SelectedIndex = 0;
        }
    }
    //员工
    protected void CheckBox3_CheckedChanged(object sender, EventArgs e)
    {
        if (CheckBox3.Checked)
            txtEmployeeNumber.Enabled = true;
        else
            txtEmployeeNumber.Enabled = false;
    }
    //姓名
    protected void CheckBox4_CheckedChanged(object sender, EventArgs e)
    {
        if (CheckBox4.Checked)
            txtEmployeeName.Enabled = true;
        else
            txtEmployeeName.Enabled = false;
    }
    //选择事件
    protected void ddlBranch_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (ddlDempartment.Enabled == true)
        {
            Int32 branchId = Int32.Parse(ddlBranch.SelectedValue);
            this.ddlDempartment.Items.Clear();
            this.ddlDempartment.DataSource = DepartInfoManager.GetDepartInfoByBranchId(branchId);
            this.ddlDempartment.DataTextField = "DepartName";
            this.ddlDempartment.DataValueField = "DepartId";
            this.ddlDempartment.DataBind();
        }
    }

    public String SetString(string SignTag)
    {
        if (SignTag == "1")
            return "签到";
        else
            return "签退";
    }
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        //if (e.Row.RowType == DataControlRowType.DataRow)
        //{
        //    //int count1 = 0;
        //    //int count2 = 0;
        //    //int count3 = 0;
        //    for (int i = 0; i < GridView1.Rows.Count; i++)
        //    {
        //        if (GridView1.Rows.Count > 1 && (i + 1) < GridView1.Rows.Count)
        //        {
        //            Label lab = (Label)e.Row.FindControl("Label1");
        //            if (lab.Text == ((Label)GridView1.Rows[i + 1].FindControl("Label1")).Text)
        //            {
        //                e.Row.Cells[0].Controls.Remove(lab);
        //                e.Row.Cells[0].Attributes.Add("rowspan",i.ToString());
        //                //count1++;
        //            }
        //            Label lab1 = (Label)e.Row.FindControl("Label5");
        //            if (lab1.Text == ((Label)GridView1.Rows[i + 1].FindControl("Label5")).Text)
        //            {
        //                e.Row.Cells[4].Controls.Remove(lab1);
        //                e.Row.Cells[4].Attributes.Add("rowspan", i.ToString());
        //                //count2++;
        //            }
        //            Label lab2 = (Label)e.Row.FindControl("Label6");
        //            if (lab2.Text == ((Label)GridView1.Rows[i + 1].FindControl("Label6")).Text)
        //            {
        //                e.Row.Cells[5].Controls.Remove(lab2);
        //                e.Row.Cells[5].Attributes.Add("rowspan", i.ToString());
        //                //count3++;
        //            }
        //        }
        //    }
        //    //if (GridView1.Rows.Count > 1)
        //    //{
        //    //    GridView1.Rows[0].Cells[0].Attributes.Add("rowspan", count1.ToString());
        //    //    GridView1.Rows[0].Cells[4].Attributes.Add("rowspan", count2.ToString());
        //    //    GridView1.Rows[0].Cells[5].Attributes.Add("rowspan", count3.ToString());
        //    //}
        //    //e.Row.Cells[0].Attributes.Add("rowspan",count1.ToString());
        //    //e.Row.Cells[4].Attributes.Add("rowspan",count2.ToString());
        //    //e.Row.Cells[5].Attributes.Add("rowspan",count3.ToString());
        //}
    }
}

⌨️ 快捷键说明

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