protected void Check_User(object sender, EventArgs e)
        {
            string exception = "";
            string evaluated = UserID.Value;

            List<Evaluator> model = new List<Evaluator>();
            if (EvaluatorBLL.SelectByID(model, evaluated, ref exception))
            {
                this.pass.Text = "未审核";
                foreach (Evaluator er in model)
                {
                    if (er.Pass == 1)
                    {
                        this.pass.Text = "已审核";
                        break;
                    }
                }
                DataTable table = new DataTable();
                table = model.ListToDataTable();
                adjustTable(table, ref exception); //为表格加上用户名显示
                string json = JSON.DataTableToJson(table);
                JsonList.Value = json;
                ClientScript.RegisterStartupScript(this.GetType(), "", "showList1()", true);
                return;
            }
            Errors.Value = "考评人名单尚未制定";
            this.Chose.Value = "submit";
            ClientScript.RegisterStartupScript(this.GetType(), "", "tanchuang()", true);
        }
        protected void Dao_Click(object sender, EventArgs e)
        {
            List<PostResponseBook> prb = new List<PostResponseBook>();
            if (Passed.Value.Equals(DBNull.Value) || Passed.Value == "")
            {
                Errors.Value = "无可导出岗位责任书!";
                ClientScript.RegisterStartupScript(this.GetType(), "", "tanchuang()", true);
                return;
            }
            exception = "";
            PostResponseBookBLL.Select(UserID.Value, ref prb, ref exception);

            System.Data.DataTable table = new System.Data.DataTable();
            table = prb.ListToDataTable<PostResponseBook>();

            Generator g = new Generator(table);
            g.Generate();

            //下载
            Response.ContentType =  "application/msword";
            //Response.AddHeader("Content-Disposition", "attachment;filename=岗位责任书.doc");
            string filename = Server.MapPath("../../uploadfile/岗位责任书.doc");
            //指定编码 防止中文文件名乱码
            Response.HeaderEncoding = System.Text.Encoding.GetEncoding("gb2312");
            Response.TransmitFile(filename);

            System.Data.DataTable table1 = new System.Data.DataTable();
            table1 = searchSql();

            string json = JSON.DataTableToJson(table1);
            JsonData.Value = json;
            ClientScript.RegisterStartupScript(this.GetType(), "", "load_userinfo()", true);
        }
        protected void Check_User(object sender, EventArgs e)
        {
            exception = "";
            string evaluated = UserID.Value;

            List<Evaluator> model = new List<Evaluator>();

            LUserName1.Text = UserName.Value; //显示被考评人姓名
            pass1.Text = Passed.Value;
            LComment1.Text = Comment.Value;

            if(EvaluatorBLL.SelectByID(model, evaluated, ref exception))
            {
                DataTable table = new DataTable();
                table = model.ListToDataTable();
                adjustTable(table, ref exception); //为表格加上用户名显示
                string json = JSON.DataTableToJson(table);
                JsonList.Value = json;
                ClientScript.RegisterStartupScript(this.GetType(), "", "showList()", true);
                return;
            }
            Errors.Value = "考评人名单尚未制定";
            this.Chose.Value = "submit";
            ClientScript.RegisterStartupScript(this.GetType(), "", "tanchuang()", true);
        }
 protected DataTable search()
 {
     exception = "";
     string userName = (string)Session["username"];
     List<Message> messages = new List<Message>();
     MessageBLL.Select(userName, ref messages, ref exception);
     if (messages.Count == 0)
         return null;
     DataTable table = new DataTable();
     table = messages.ListToDataTable();
     return table;
 }
        protected void Dao_Click(object sender, EventArgs e)
        {
            string exception = "";
            string evaluated = UserID.Value;
            if (evaluated.Length <= 0)
            {
                Errors.Value = "没有选中考评人名单";
                this.Chose.Value = "submit";
                ClientScript.RegisterStartupScript(this.GetType(), "", "tanchuang()", true);
                return;
            }

            List<Evaluator> model = new List<Evaluator>();

            exception = "";
            if (EvaluatorBLL.Select(ref model, evaluated, 1, ref exception))
            {
                DataTable table = new DataTable();
                table = model.ListToDataTable();
                string filename = evaluated + "的考评人名单(已通过审核)";
                Export(filename, table);

                return;
            }

            exception = "";
            if (EvaluatorBLL.Select(ref model, evaluated, 0, ref exception))
            {
                DataTable table = new DataTable();
                table = model.ListToDataTable();
                string filename = evaluated + "的考评人名单(未通过审核)";
                Export(filename, table);
                return;
            }
            Errors.Value = "考评人名单尚未制定";
            this.Chose.Value = "submit";
            ClientScript.RegisterStartupScript(this.GetType(), "", "tanchuang()", true);
        }
 protected DataTable Search1()
 {
     List<Manager> managers = new List<Manager>();
     exception = "";
     string type = "__1%";
     if (Department.SelectedValue == "0")
     {
         ManagerBLL.SelectByType(type, ref managers, ref exception);
     }
     else
     {
         string mDepartment = Department.Text;
         ManagerBLL.Select(mDepartment, type, ref managers, ref exception);
     }
     if (managers.Count == 0)
         return null;
     DataTable table = new DataTable();
     table = managers.ListToDataTable();
     return table;
 }
 protected System.Data.DataTable searchSql()
 {
     string exception = "";
     string department = Department.SelectedValue;
     List<UserInfo> userinfo = new List<UserInfo>();
     string type = "____1%";
     if (department == "0")
     {
         UserInfoBLL.SelectByType(type, ref userinfo, ref exception);
         Title.Text = "所有被考评者名单:";
     }
     else
     {
         UserInfoBLL.Select(department, type, ref userinfo, ref exception);
         Title.Text = department + "被考评者名单:";
     }
     if (userinfo == null)
         return null;
     System.Data.DataTable table = new System.Data.DataTable();
     table = userinfo.ListToDataTable();
     return table;
 }
        protected DataTable searchSql()
        {
            exception = "";
            string department = Department.SelectedValue;
            List<UserInfo> userinfo = new List<UserInfo>();
            string type = "____1%";
            if (department == "0")
            {
                UserInfoBLL.SelectByType(type, ref userinfo, ref exception);
            }
            else
            {
                UserInfoBLL.Select(department, type, ref userinfo, ref exception);
            }

            DataTable table = new DataTable();
            table = userinfo.ListToDataTable();
            return table;
        }
        protected DataTable searchSql()
        {
            exception = "";
            //获取管理员部门
            string mID = (string)Session["username"];
            List<Manager> managers = new List<Manager>();
            ManagerBLL.SelectByID(mID, ref managers, ref exception);
            string department = managers[0].MDepartment;

            List<EvaluatorInfo> evaluatorinfo = new List<EvaluatorInfo>();
            EvaluatorInfoBLL.SelectByDepartment(evaluatorinfo, department, ref exception);

            DataTable table = new DataTable();
            table = evaluatorinfo.ListToDataTable();
            return table;
        }
        protected void Search(object sender, EventArgs e)
        {
            string username = (string)Session["username"];
            //string username = "******";
            string uiDepart = "";
            List<Manager> manager = new List<Manager>();
            exception = "";
            if (ManagerBLL.SelectByID(username, ref manager, ref exception))
            {
                uiDepart = manager.ElementAt(0).MDepartment;
                Session["ManagerDepartment"] = uiDepart;
                Title.Text = uiDepart + "被考评人名单:";
                List<UserInfo> Evaluated = new List<UserInfo>();
                string type = "____1%";
                bool b = UserInfoBLL.Select(uiDepart, type, ref Evaluated, ref exception);
                if (b)
                {
                    DataTable table = new DataTable();
                    table = Evaluated.ListToDataTable();

                    //给table添加prbComment栏
                    adjustTable(table, ref exception);
                    int sumCount = 0, unPassCount = 0, passCount = 0, savedCount = 0, unMakeCount = 0;

                    countNumber(table, ref sumCount, ref unPassCount, ref passCount, ref savedCount, ref unMakeCount);//做汇总

                    Title.Text += "( 未制作:" + unMakeCount + ", 已保存:" + savedCount + ", 已提交:" + unPassCount + ", 已审核:" + passCount + "\\总人数:" + sumCount + " )";

                    table.DefaultView.Sort = "PrbPassed desc"; //给table按状态排序
                    table = table.DefaultView.ToTable();

                    string json = JSON.DataTableToJson(table);
                    JsonData.Value = json;
                    ClientScript.RegisterStartupScript(this.GetType(), "", "load_userinfo()", true);
                    return;

                }

                else
                {
                    Errors.Value = "本部门尚无被考评人!";
                    ClientScript.RegisterStartupScript(this.GetType(), "", "tanchuang()", true);
                    return;
                }
            }
            else
            {
                Errors.Value = "您无此操作权限!";
                ClientScript.RegisterStartupScript(this.GetType(), "", "tanchuang()", true);
                return;
            }
        }
 protected DataTable searchSql()
 {
     exception = "";
     string department = Depart.Value;
     List<Manager> managers = new List<Manager>();
     string type = "__1%";
     if (department == "0")
     {
         ManagerBLL.SelectByType(type, ref managers, ref exception);
         fname = "所有二级管理员名单:";
     }
     else
     {
         ManagerBLL.Select(department, type, ref managers, ref exception);
         fname = department + "二级管理员名单:";
     }
     DataTable table = new DataTable();
     table = managers.ListToDataTable();
     return table;
 }
        //获取考评名单
        protected void LoadEvaluateUserData()
        {
            string name=(string)Session["username"];
            string e = "";

            //EvaluatorBLL.GetEvaluationInfo(name, dt, ref e);
            //获取全部名单
            List<Evaluator> evaluators=new List<Evaluator>();
            if (!EvaluatorBLL.Select(name, 1, ref evaluators, ref e)||e!=""||evaluators.Count<=0)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "error", "f_alert('error','获取数据失败,请重试');", true);
                return;
            }
            DataTable table = new DataTable();
            table = evaluators.ListToDataTable();
            //加入被考评人信息
            int evaluatedNum=0;
            adjustTable(table, ref evaluatedNum,ref e);
            //显示统计信息
            int totalNum = table.Rows.Count;
            Title.Text = "共有" + totalNum.ToString() + "人需要考评,已完成" + evaluatedNum.ToString() + "人";
            string json = JSON.DataTableToJson(table);
            JsonData.Value = json;
            ScriptManager.RegisterStartupScript(BFinishEvaluate,this.GetType(), "fun", "ShowAllEavluateUsers();", true);
        }
        //搜索考评者
        private bool searchEvaluator()
        {
            exception = "";
            string username = (string)Session["username"];
            //string username = "******";
            string mDepart = "";
            string evaluatedID = UserID.Value;
            List<Manager> managers = new List<Manager>();

            if (ManagerBLL.SelectByID(username, ref managers, ref exception))
            {
                mDepart = managers.ElementAt(0).MDepartment;
                List<EvaluatorInfo> evi = new List<EvaluatorInfo>();
                exception = "";
                EvaluatorInfoBLL.SelectByDepartment(evi, mDepart, ref exception);

                if (evi.Count <= 0)
                    return false;
                DataTable table = new DataTable();
                table = evi.ListToDataTable();
                string json = JSON.DataTableToJson(table);
                JsonEvaluator.Value = json;
                return true;

            }
            else
                return false;
        }
        private bool searchEvaluated()
        {
            exception = "";
            string username = (string)Session["username"];
            //string username = "******";
            string uiDepart = "";

            List<Manager> managers = new List<Manager>();

            if (ManagerBLL.SelectByID(username, ref managers, ref exception))
            {
                uiDepart = managers.ElementAt(0).MDepartment;
                Title.Text = uiDepart + "被考评人名单:";
                List<UserInfo> Evaluated = new List<UserInfo>();
                string type = "____1%";
                bool b = UserInfoBLL.Select(uiDepart, type, ref Evaluated, ref exception);
                if (b)
                {
                    DataTable table = new DataTable();
                    table = Evaluated.ListToDataTable();
                    //给table增加Comment和Passed栏
                    adjustTable2(table, ref exception);
                    int sumCount = 0, unPassCount = 0, passCount = 0, unMakeCount = 0;

                    countNumber(table, ref sumCount, ref unPassCount, ref passCount, ref unMakeCount);//做汇总
                    //Title.Text += "(总人数:" + sumCount + " \\未制作:" + unMakeCount + " \\已保存:" + savedCount + " \\已提交:" + unPassCount + " \\已审核:" + passCount + ")";
                    Title.Text += "( 未制作:" + unMakeCount + ", 已提交:" + unPassCount + ", 已审核:" + passCount + ", 总人数:" + sumCount + " )";

                    table.DefaultView.Sort = "Passed desc"; //给table按状态排序
                    table = table.DefaultView.ToTable();

                    string json = JSON.DataTableToJson(table);
                    JsonData.Value = json;
                    return true;

                }

                else
                {
                    Errors.Value = "本部门尚无被考评人!";
                    //
                    return false;
                }
            }
            else
            {
                Errors.Value = "您无此操作权限!";
                return false;
            }
        }