本文整理匯總了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);
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
}