当前位置: 首页>>代码示例>>C#>>正文


C# List.ListToDataTable方法代码示例

本文整理汇总了C#中Model.List.ListToDataTable方法的典型用法代码示例。如果您正苦于以下问题:C# List.ListToDataTable方法的具体用法?C# List.ListToDataTable怎么用?C# List.ListToDataTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Model.List的用法示例。


在下文中一共展示了List.ListToDataTable方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Check_User

        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);
        }
开发者ID:cntimothy,项目名称:TJEvaluationSystem,代码行数:29,代码来源:CheckEvaluator.aspx.cs

示例2: Dao_Click

        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);
        }
开发者ID:cntimothy,项目名称:TJEvaluationSystem,代码行数:33,代码来源:CheckPost.aspx.cs

示例3: Check_User

        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);
        }
开发者ID:cntimothy,项目名称:TJEvaluationSystem,代码行数:25,代码来源:ManageEvaluator.aspx.cs

示例4: search

 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;
 }
开发者ID:cntimothy,项目名称:TJEvaluationSystem,代码行数:12,代码来源:OutBox.aspx.cs

示例5: Dao_Click

        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);
        }
开发者ID:cntimothy,项目名称:TJEvaluationSystem,代码行数:38,代码来源:CheckEvaluator.aspx.cs

示例6: Search1

 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;
 }
开发者ID:cntimothy,项目名称:TJEvaluationSystem,代码行数:20,代码来源:ResetPassword.aspx.cs

示例7: searchSql

 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;
 }
开发者ID:cntimothy,项目名称:TJEvaluationSystem,代码行数:22,代码来源:ManageCurrentEvaluation.aspx.cs

示例8: searchSql

        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;
        }
开发者ID:cntimothy,项目名称:TJEvaluationSystem,代码行数:19,代码来源:EvaluationResult.aspx.cs

示例9: searchSql

        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;
        }
开发者ID:cntimothy,项目名称:TJEvaluationSystem,代码行数:16,代码来源:SelectEvaluator.aspx.cs

示例10: Search

        protected void Search(object sender, EventArgs e)
        {
            string username = (string)Session["username"];
            //string username = "admin2";
            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;
            }
        }
开发者ID:cntimothy,项目名称:TJEvaluationSystem,代码行数:52,代码来源:MakePostBook.aspx.cs

示例11: searchSql

 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;
 }
开发者ID:cntimothy,项目名称:TJEvaluationSystem,代码行数:20,代码来源:SelectSecond.aspx.cs

示例12: LoadEvaluateUserData

        //获取考评名单
        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);
        }
开发者ID:cntimothy,项目名称:TJEvaluationSystem,代码行数:26,代码来源:Evaluate.aspx.cs

示例13: searchEvaluator

        //搜索考评者
        private bool searchEvaluator()
        {
            exception = "";
            string username = (string)Session["username"];
            //string username = "admin2";
            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;
        }
开发者ID:cntimothy,项目名称:TJEvaluationSystem,代码行数:29,代码来源:ManageEvaluator.aspx.cs

示例14: searchEvaluated

        private bool searchEvaluated()
        {
            exception = "";
            string username = (string)Session["username"];
            //string username = "admin2";
            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;
            }
        }
开发者ID:cntimothy,项目名称:TJEvaluationSystem,代码行数:50,代码来源:ManageEvaluator.aspx.cs


注:本文中的Model.List.ListToDataTable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。