本文整理汇总了C#中Model.List.ElementAt方法的典型用法代码示例。如果您正苦于以下问题:C# List.ElementAt方法的具体用法?C# List.ElementAt怎么用?C# List.ElementAt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Model.List
的用法示例。
在下文中一共展示了List.ElementAt方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Insert
public static bool Insert(User[] model, ref string e)
{
int count = model.Length;
for (int i = 0; i < count; i++)
{
string sql = "insert into tb_User values(@uID,@uPassword,@uType)";
SqlParameter[] parameters =
{
new SqlParameter("@uID", SqlDbType.VarChar,10),
new SqlParameter("@uPassword",SqlDbType.Char,6),
new SqlParameter("@uType", SqlDbType.VarChar,10)
};
//获取身份证号作密码
List<EvaluatorInfo> evis = new List<EvaluatorInfo>();
if (!EvaluatorInfoBLL.Select(evis, model[i].UID, ref e))
{
return false;
}
parameters[0].Value = evis.ElementAt(0).EvID;
parameters[1].Value = evis.ElementAt(0).EvMobPhone.Substring(5, 6);
parameters[2].Value = "00010";
string exception = db.InsertExec(sql, parameters);
if (exception != "" && exception != null)
{
e = exception;
return false;
}
}
return true;
}
示例2: Delete_Click
protected void Delete_Click(object sender, EventArgs e)
{
exception = "";
List<EvaluatorInfo> evaluatorinfo = new List<EvaluatorInfo>();
evaluatorinfo = JSON.isEfect1(UserID.Value);
EvaluatorInfo deleted = evaluatorinfo.ElementAt(0);
EvaluatorInfoBLL.Delete(deleted.EvID, ref exception);
DataTable table = new DataTable();
table = searchSql();
string json = JSON.DataTableToJson(table);
JsonData.Value = json;
ClientScript.RegisterStartupScript(this.GetType(), "", "load_userinfo()", true);
return;
}
示例3: Delete_Click
protected void Delete_Click(object sender, EventArgs e)
{
exception = "";
List<UserInfo> userinfo = new List<UserInfo>();
userinfo = JSON.isEfect(UserID.Value);
UserInfo deleted = userinfo.ElementAt(0);
deleted.UiType = deleted.UiType.Remove(4, 1).Insert(4, "0");
UserInfoBLL.Update(deleted, ref exception);
DataTable table = new DataTable();
table = searchSql();
string json = JSON.DataTableToJson(table);
JsonData.Value = json;
ClientScript.RegisterStartupScript(this.GetType(), "", "load_userinfo()", true);
return;
}
示例4: Delete_Click
protected void Delete_Click(object sender, EventArgs e)
{
exception = "";
string userID = "";
string userType = "-1";
List<UserInfo> userinfo = new List<UserInfo>();
userinfo = JSON.isEfect(UserID.Value);
UserInfo deleted = userinfo.ElementAt(0);
userID = deleted.UiID;
userType = deleted.UiType;
//if (userType == 2 || userType == 6)
if(userType.Substring(2, 5) == "100")
{
UserBLL.Delete(userID, ref exception);
}
else
{
List<User> model = new List<Model.User>();
if (UserBLL.Select(deleted.UiID, ref model, ref exception))
{
User user = model.ElementAt(0);
user.UType = user.UType.Remove(2, 1).Insert(2, "1");
UserBLL.Update(user, ref exception);
}
}
deleted.UiType = deleted.UiType.Remove(2, 1).Insert(2, "1");
UserInfoBLL.Update(deleted, ref exception);
DataTable table = new DataTable();
table = searchSql();
if (table == null)
return;
string json = JSON.DataTableToJson(table);
JsonData.Value = json;
ClientScript.RegisterStartupScript(this.GetType(), "", "load_userinfo()", true);
return;
}
示例5: SearchPost_Click
protected void SearchPost_Click(object sender, EventArgs e)
{
exception = "";
prbUserID = UserID.Value;
LUserName.Text = "被考评人姓名:" + UserName.Value;
List<PostResponseBook> post = new List<PostResponseBook>();
if (PostResponseBookBLL.Select(prbUserID, ref post, ref exception))
{
PostResponseBook prb = new PostResponseBook();
prb = post.ElementAt(0);
if (prb.PrbPassed == 1)
{
pass.Text = "已审核!";
Passed.Value = "1";
}
else
{
pass.Text = "未审核!";
Passed.Value = "0";
}
if (prb.PrbComment != "")
{
Comment.Text = prb.PrbComment;
}
else
{
Comment.Text = "";
}
if (prb.PrbEmployer == ERadioButton1.Text)
{
ERadioButton1.Checked = true;
}
else
{
ERadioButton2.Checked = true;
}
prbLaborUnit.Text = prb.PrbLaborUnit;
prbLaborDep.Text = prb.PrbLaborDep;
prbPostName.Text = prb.PrbPostName;
if (prb.PrbPostType == PTRadioButton1.Text)
{
PTRadioButton1.Checked = true;
}
else if (prb.PrbPostType == PTRadioButton2.Text)
{
PTRadioButton2.Checked = true;
}
else if (prb.PrbPostType == PTRadioButton3.Text)
{
PTRadioButton3.Checked = true;
}
else if (prb.PrbPostType == PTRadioButton4.Text)
{
PTRadioButton4.Checked = true;
}
else
{
PTRadioButton5.Checked = true;
}
prbEduBg.Text = prb.PrbEduBg;
prbCertificate.Text = prb.PrbCertificate;
prbExperience.Text = prb.PrbExperience;
prbSkill.Text = prb.PrbSkill;
prbPersonality.Text = prb.PrbPersonality;
prbPhycond.Text = prb.PrbPhyCond;
prbWorkOutline.Text = prb.PrbWorkOutline;
prbWorkContentRequest.Value = prb.PrbWorkContntRequest;
prbPower.Text = prb.PrbPower;
prbResponse.Text = prb.PrbResponse;
prbDirectLeader.Text = prb.PrbDirectLeader;
prbSubordinate.Text = prb.PrbSubordinate;
prbColleague.Text = prb.PrbColleague;
prbServices.Text = prb.PrbServices;
prbRelations.Text = prb.PrbReleations;
prbWorkEnter.Text = prb.PrbWorkEnter;
prbPostAssess.Text = prb.PrbPostAssess;
prbOthers.Text = prb.PrbOthers;
}
else
{
pass.Text = "尚未制定!";
Passed.Value = "-1";
//prbEmployer.Text = "";
prbLaborUnit.Text = (string)Session["ManagerDepartment"];
prbLaborDep.Text = "";
prbPostName.Text = "";
//prbPostType.Text = "";
prbEduBg.Text = "";
prbCertificate.Text = "";
prbExperience.Text = "";
prbSkill.Text = "";
prbPersonality.Text = "";
prbPhycond.Text = "";
prbWorkOutline.Text = "";
prbWorkContentRequest.Value = "";
prbPower.Text = "";
prbResponse.Text = "";
prbDirectLeader.Text = "";
//.........这里部分代码省略.........
示例6: 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;
}
}
示例7: SearchPost_Click
protected void SearchPost_Click(object sender, EventArgs e)
{
prbUserID = UserID.Value;
List<PostResponseBook> post1 = new List<PostResponseBook>();
exception = "";
LUserName.Text = "被考评人姓名:" + UserName.Value;
if (PostResponseBookBLL.Select(prbUserID, ref post1, ref exception))
{
PostResponseBook prb = new PostResponseBook();
prb = post1.ElementAt(0);
if (prb.PrbPassed == 1)
{
passYoN.Text = "已通过审核!";
Passed.Value = "1";
}
else
{
passYoN.Text = "未通过审核!";
Passed.Value = "0";
}
if (prb.PrbComment != "")
{
Comment.Text = prb.PrbComment;
}
else
{
Comment.Text = "";
}
prbEmployer.Text = prb.PrbEmployer;
prbLaborUnit.Text = prb.PrbLaborUnit;
prbLaborDep.Text = prb.PrbLaborDep;
prbPostName.Text = prb.PrbPostName;
prbPostType.Text = prb.PrbPostType;
prbEduBg.Text = prb.PrbEduBg;
prbCertificate.Text = prb.PrbCertificate;
prbExperience.Text = prb.PrbExperience;
prbSkill.Text = prb.PrbSkill;
prbPersonality.Text = prb.PrbPersonality;
prbPhycond.Text = prb.PrbPhyCond;
prbWorkOutline.Text = prb.PrbWorkOutline;
prbWorkContentRequestTemp.Value = prb.PrbWorkContntRequest;
prbWorkContentRequest.Text = prbWorkContentRequestTemp.Value.Replace("&", "\n").Replace("$", "\n").Replace("*", "");
prbPower.Text = prb.PrbPower;
prbResponse.Text = prb.PrbResponse;
prbDirectLeader.Text = prb.PrbDirectLeader;
prbSubordinate.Text = prb.PrbSubordinate;
prbColleague.Text = prb.PrbColleague;
prbServices.Text = prb.PrbServices;
prbRelations.Text = prb.PrbReleations;
prbWorkEnter.Text = prb.PrbWorkEnter;
prbPostAssess.Text = prb.PrbPostAssess;
prbOthers.Text = prb.PrbOthers;
}
else
{
passYoN.Text = "尚未制定!";
Comment.Text = "";
Passed.Value = "-1";
prbEmployer.Text = "";
prbLaborUnit.Text = "";
prbLaborDep.Text = "";
prbPostName.Text = "";
prbPostType.Text = "";
prbEduBg.Text = "";
prbCertificate.Text = "";
prbExperience.Text = "";
prbSkill.Text = "";
prbPersonality.Text = "";
prbPhycond.Text = "";
prbWorkOutline.Text = "";
prbWorkContentRequest.Text = "";
prbPower.Text = "";
prbResponse.Text = "";
prbDirectLeader.Text = "";
prbSubordinate.Text = "";
prbColleague.Text = "";
prbServices.Text = "";
prbRelations.Text = "";
prbWorkEnter.Text = "";
prbPostAssess.Text = "";
prbOthers.Text = "";
}
ClientScript.RegisterStartupScript(this.GetType(), "", "EditPost()", true);
}
示例8: Insert
public static bool Insert(AssessTable[] at, ref string e)
{
int count = at.Length;
for (int i = 0; i < count; i++)
{
List<AssessTable> model = new List<AssessTable>();
if (Select(at[i].AtUserID, at[i].AtDep, at[i].AtDate, ref model, ref e))
{
if (model.ElementAt(0).AtPass == 0)
e = "部门 " + at[i].AtDep + " " + at[i].AtDate + " 的考核表已存在,尚未通过审核";
else
{
e = "部门 " + at[i].AtDep + " " + at[i].AtDate + " 的考核表已存在,并通过审核";
}
return false;
}
string sql = "insert into tb_AssessTable values(@atUserID,@atDep,@atDate,@atPass,"
+ "@atKeyResponse1,@atKeyResponse2,@atKeyResponse3,@atKeyResponse4,@atKeyResponse5,"
+ "@atKeyAbility1,@atKeyAbility2,@atKeyAbility3,@atKeyAbility4,@atKeyAbility5,"
+ "@atKeyAttitude1,@atKeyAttitude2,@atKeyAttitude3,@atKeyAttitude4,@atKeyAttitude5,"
+ "@atResponse1,@atResponse2,@atResponse3,@atResponse4,@atResponse5,"
+ "@atAbility1,@atAbility2,@atAbility3,@atAbility4,@atAbility5,"
+ "@atAttitude1,@atAttitude2,@atAttitude3,@atAttitude4,@atAttitude5,"
+ "@atVeto1,@atVeto2,@atVeto3,@atVeto4,@atVeto5,@atVetoOthers,@atComment)";
SqlParameter[] parameters =
{
new SqlParameter("@atUserID", SqlDbType.VarChar,10),
new SqlParameter("@atDep", SqlDbType.NVarChar,50),
new SqlParameter("@atDate", SqlDbType.DateTime),
new SqlParameter("@atPass", SqlDbType.Int,4),
new SqlParameter("@atKeyResponse1", SqlDbType.NVarChar,int.MaxValue),
new SqlParameter("@atKeyResponse2", SqlDbType.NVarChar,int.MaxValue),
new SqlParameter("@atKeyResponse3", SqlDbType.NVarChar,int.MaxValue),
new SqlParameter("@atKeyResponse4", SqlDbType.NVarChar,int.MaxValue),
new SqlParameter("@atKeyResponse5", SqlDbType.NVarChar,int.MaxValue),
new SqlParameter("@atKeyAbility1", SqlDbType.Int,4),
new SqlParameter("@atKeyAbility2", SqlDbType.Int,4),
new SqlParameter("@atKeyAbility3", SqlDbType.Int,4),
new SqlParameter("@atKeyAbility4", SqlDbType.Int,4),
new SqlParameter("@atKeyAbility5", SqlDbType.Int,4),
new SqlParameter("@atKeyAttitude1", SqlDbType.Int,4),
new SqlParameter("@atKeyAttitude2", SqlDbType.Int,4),
new SqlParameter("@atKeyAttitude3", SqlDbType.Int,4),
new SqlParameter("@atKeyAttitude4", SqlDbType.Int,4),
new SqlParameter("@atKeyAttitude5", SqlDbType.Int,4),
new SqlParameter("@atResponse1", SqlDbType.NVarChar,int.MaxValue),
new SqlParameter("@atResponse2", SqlDbType.NVarChar,int.MaxValue),
new SqlParameter("@atResponse3", SqlDbType.NVarChar,int.MaxValue),
new SqlParameter("@atResponse4", SqlDbType.NVarChar,int.MaxValue),
new SqlParameter("@atResponse5", SqlDbType.NVarChar,int.MaxValue),
new SqlParameter("@atAbility1", SqlDbType.Int,4),
new SqlParameter("@atAbility2", SqlDbType.Int,4),
new SqlParameter("@atAbility3", SqlDbType.Int,4),
new SqlParameter("@atAbility4", SqlDbType.Int,4),
new SqlParameter("@atAbility5", SqlDbType.Int,4),
new SqlParameter("@atAttitude1", SqlDbType.Int,4),
new SqlParameter("@atAttitude2", SqlDbType.Int,4),
new SqlParameter("@atAttitude3", SqlDbType.Int,4),
new SqlParameter("@atAttitude4", SqlDbType.Int,4),
new SqlParameter("@atAttitude5", SqlDbType.Int,4),
new SqlParameter("@atVeto1", SqlDbType.Int,4),
new SqlParameter("@atVeto2", SqlDbType.Int,4),
new SqlParameter("@atVeto3", SqlDbType.Int,4),
new SqlParameter("@atVeto4", SqlDbType.Int,4),
new SqlParameter("@atVeto5", SqlDbType.Int,4),
new SqlParameter("@atVetoOthers", SqlDbType.NVarChar,int.MaxValue),
new SqlParameter("@atComment", SqlDbType.NVarChar, 50)
};
parameters[0].Value = at[i].AtUserID;
parameters[1].Value = at[i].AtDep;
parameters[2].Value = at[i].AtDate;
parameters[3].Value = at[i].AtPass;
parameters[4].Value = at[i].AtKeyResponse1;
parameters[5].Value = at[i].AtKeyResponse2;
parameters[6].Value = at[i].AtKeyResponse3;
parameters[7].Value = at[i].AtKeyResponse4;
parameters[8].Value = at[i].AtKeyResponse5;
parameters[9].Value = at[i].AtKeyAbility1;
parameters[10].Value = at[i].AtKeyAbility2;
parameters[11].Value = at[i].AtKeyAbility3;
parameters[12].Value = at[i].AtKeyAbility4;
parameters[13].Value = at[i].AtKeyAbility5;
parameters[14].Value = at[i].AtKeyAttitude1;
parameters[15].Value = at[i].AtKeyAttitude2;
parameters[16].Value = at[i].AtKeyAttitude3;
parameters[17].Value = at[i].AtKeyAttitude4;
parameters[18].Value = at[i].AtKeyAttitude5;
parameters[19].Value = at[i].AtResponse1;
parameters[20].Value = at[i].AtResponse2;
parameters[21].Value = at[i].AtResponse3;
parameters[22].Value = at[i].AtResponse4;
parameters[23].Value = at[i].AtResponse5;
parameters[24].Value = at[i].AtAbility1;
parameters[25].Value = at[i].AtAbility2;
parameters[26].Value = at[i].AtAbility3;
parameters[27].Value = at[i].AtAbility4;
parameters[28].Value = at[i].AtAbility5;
parameters[29].Value = at[i].AtAttitude1;
//.........这里部分代码省略.........
示例9: Update1
//更新通过,同时要更新User
public static bool Update1(Evaluator model, ref string e)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("update tb_Evaluator set ");
strSql.Append("[email protected]");
strSql.Append(" where [email protected] and [email protected]");
SqlParameter[] parameters =
{
new SqlParameter("@pass", SqlDbType.Int,4),
new SqlParameter("@uiID", SqlDbType.VarChar,10),
new SqlParameter("@EvaluatedID",SqlDbType.VarChar,10)
};
parameters[0].Value = model.Pass;
parameters[1].Value = model.UiID;
parameters[2].Value = model.EvaluatedID;
//更新Evaluator表
e = db.QueryExec(strSql.ToString(), parameters);
if (e != "" && e != null)
{
return false;
}
//更新User表
if (model.Pass == 1)
{
List<User> users = new List<User>();
if (UserBLL.Select(model.UiID, ref users, ref e))
{
e = "";
User user = new Model.User();
user = users.ElementAt(0);
user.UType = user.UType.Remove(3, 1).Insert(3, "1");
if (!UserBLL.Update(user, ref e))
{
return false;
}
}
else
{
e = "";
User[] user = new User[1];
user[0] = new User();
user[0].UID = model.UiID;
user[0].UType = "00010";//考评者
if (!UserBLL.Insert(user, ref e))
{
return false;
}
}
if (e != "" && e != null)
{
return false;
}
}
else
{
List<Evaluator> evaluators = new List<Evaluator>();
if (EvaluatorBLL.Select1(ref evaluators, model.UiID, 1, ref e))
{
//更新User表,
string UID = model.UiID;
UserBLL.Delete(UID, ref e);
}
}
return true;
}
示例10: 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;
}
示例11: 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;
}
}