本文整理汇总了C#中WebApplication1.List类的典型用法代码示例。如果您正苦于以下问题:C# List类的具体用法?C# List怎么用?C# List使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
List类属于WebApplication1命名空间,在下文中一共展示了List类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: GridView1_RowCommand
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
List<Matricula> lstMatri = new List<Matricula>();
if (Session["Matri"] != null)
{
lstMatri = ((List<Matricula>)Session["Matri"]);
}
string codigo=GridMatricula.DataKeys[Convert.ToInt32(e.CommandArgument)].Value.ToString();
Matricula MatriculaEncontrada = lstMatri.SingleOrDefault(s => s.Codigo == Convert.ToInt32(codigo));
if (e.CommandName == "Editar")
{
txtCodigo.Text = MatriculaEncontrada.Codigo.ToString();
txtNombre.Text = MatriculaEncontrada.NombreEstud;
txtValor.Text = MatriculaEncontrada.Valor.ToString();
}
if (e.CommandName == "Eliminar")
{
lstMatri.Remove(MatriculaEncontrada);
//int indice = lstFactu.IndexOf(factuEncontrada);
//lstFactu.RemoveAt(indice);
}
GridMatricula.DataSource = lstMatri;
GridMatricula.DataKeyNames = new string[] { "Codigo" };
GridMatricula.DataBind();
}
开发者ID:harry9524,项目名称:ASP.Net-Proyectos,代码行数:33,代码来源:Formulario.aspx.cs
示例2: ProcessRequest
public void ProcessRequest(HttpContext context)
{
var userno = context.Request["userno"];
DateTime myDate = DateTime.Now;
string myDateString = myDate.ToString("yyyy-MM-dd HH:mm:ss");
String time_start = DateTime.UtcNow.AddDays(-365).ToString("yyyy-MM-dd hh:mm:ss");
Console.WriteLine(myDateString, time_start);
List<item_reminder> items = new List<item_reminder>();
using (var sql_conn = new SqlConnection(System.Web.Configuration.WebConfigurationManager.AppSettings["ConnectionStr"]))
{
sql_conn.Open();
using (var sql_cmd = sql_conn.CreateCommand())
{
var comm = string.Format("SELECT [pro_userno],[descr],[CreateDate] FROM HP_reminder WHERE userno = '{0}' and (CreateDate BETWEEN '{1}' AND '{2}') ORDER BY CreateDate DESC ", userno, time_start, myDateString);
sql_cmd.CommandText = comm;
sql_cmd.ExecuteNonQuery();
SqlDataReader sqlite_datareader1 = sql_cmd.ExecuteReader();
while (sqlite_datareader1.Read())
{
items.Add(new item_reminder()
{
pro_userno = sqlite_datareader1["pro_userno"].ToString(),
descr = sqlite_datareader1["descr"].ToString(),
CreateDate = DateTime.Parse(sqlite_datareader1["CreateDate"].ToString()).ToString("yyyy-MM-dd HH:mm:ss")
});
}
String data = JsonConvert.SerializeObject(items);
context.Response.Clear();
context.Response.ContentType = "application/json ; charset =utf-8";
context.Response.Write(data);
context.Response.End();
}
}
}
开发者ID:starboxs,项目名称:wkhm_webservice,代码行数:34,代码来源:wkhm_reminder.ashx.cs
示例3: SubmitBtn_Click
protected void SubmitBtn_Click()
{
CUser user = new CUser();
List<CUser> userList = new List<CUser>();
userList=user.GetUserById(Convert.ToInt32(Session["user_id"]));
MD5 md5hash = MD5.Create();
if (userList.Count > 0 )
{
try
{
bool found = false;
foreach (CUser u in userList)
{
if (u.user_password == user.GetMd5Hash(md5hash, old_password.Text))
{
user.user_id = Convert.ToInt32(Session["user_id"]);
user.updated_by = (string)Session["user_name"];
user.user_password = user.GetMd5Hash(md5hash, new_password.Text);
user.UpdatePassword();
found = true;
ltrlmsg.Text = "<div class=\"alert alert-success\"><button type=\"button\" class=\"close\" data-dismiss=\"alert\">×</button> Password Update Success</div>";
}
}
if (found == false)
{
ltrlmsg.Text = "<div class=\"alert alert-danger\"><button type=\"button\" class=\"close\" data-dismiss=\"alert\">×</button> Old Password Error</div>";
}
}
catch (Exception ex)
{
ltrlmsg.Text = "<div class=\"alert alert-danger\"><button type=\"button\" class=\"close\" data-dismiss=\"alert\">×</button> " + ex.Message + "</div>";
}
}
}
开发者ID:indigomike7,项目名称:insuranceregistration,代码行数:34,代码来源:Password_update_personal.aspx.cs
示例4: GetSeriesString
private string GetSeriesString()
{
List<Expense> expenses = Expense.GetAmountRandomAmountList();
List<string> expensesLinePoints = new List<string>();
StringBuilder seriesString = new StringBuilder();
foreach (Expense expenseItem in expenses)
{
expensesLinePoints.Add(expenseItem.Amount.ToString());
if (expenseItem.Date.Month == 12)
{
if (seriesString.Length > 0)
{
seriesString.Append(",");
}
seriesString.Append("{ ");
seriesString.AppendFormat(@"name: {0},
data: [{1}]", expenseItem.Date.Year, string.Join(",", expensesLinePoints.ToArray()));
seriesString.Append(" }");
expensesLinePoints = new List<string>();
}
}
return seriesString.ToString();
}
开发者ID:sanyaade-fintechnology,项目名称:NinjaTrader,代码行数:28,代码来源:Original.aspx.cs
示例5: PopulateDropDownList
public static List<Customers> PopulateDropDownList()
{
DataTable dt = new DataTable();
List<Customers> objDept = new List<Customers>();
using (SqlConnection con = new SqlConnection(@"Data Source=.\SQLEXPRESS;Initial Catalog=ylena_exercise;Integrated Security=True"))
{
using (SqlCommand cmd = new SqlCommand("SELECT CustomerId, CustomerName, ContactName, Address, City, PostalCode, Country FROM Customers", con))
{
con.Open();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(dt);
if (dt.Rows.Count > 0)
{
for (int i = 0; i < dt.Rows.Count; i++)
{
objDept.Add(new Customers
{
CustomerId = dt.Rows[i]["CustomerId"].ToString(),
CustomerName = dt.Rows[i]["CustomerName"].ToString(),
ContactName = dt.Rows[i]["ContactName"].ToString(),
Address = dt.Rows[i]["Address"].ToString(),
City = dt.Rows[i]["City"].ToString(),
PostalCode = dt.Rows[i]["PostalCode"].ToString(),
Country = dt.Rows[i]["Country"].ToString()
});
}
}
return objDept;
}
}
}
开发者ID:binithapai,项目名称:yleana_exercise,代码行数:32,代码来源:WebForm1.aspx.cs
示例6: databasecall
public DataTable databasecall(string username)
{
var con = ConfigurationManager.ConnectionStrings["DefaultConnection"].ToString();
SqlConnection mycon = new SqlConnection(con);
try
{
DataTable dt = new DataTable();
SqlCommand cmd = new SqlCommand("Select * from Demo where [email protected]", mycon);
cmd.Parameters.AddWithValue("@NAME", username);
mycon.Open();
SqlDataReader DR1 = cmd.ExecuteReader();
{
if (DR1.HasRows)
dt.Load(DR1);
}
//converting it to list
List<DataRow> list = new List<DataRow>();
foreach (DataRow dr in dt.Rows)
{
list.Add(dr);
}
//converting it to list
return dt;
}
catch (Exception e)
{
// cmd.ExecuteScalar();
mycon.Close();
return null;
}
}
开发者ID:hunnydhanda,项目名称:hunny,代码行数:35,代码来源:TestingApplication.aspx.cs
示例7: Marchant
public Marchant()
{
Products = new List<Product>();
Products.Add(new Product("Pen", 25));
Products.Add(new Product("Pencil", 30));
Products.Add(new Product("Notebook", 15));
}
开发者ID:luiseduardohdbackup,项目名称:dotnet-1,代码行数:7,代码来源:Product.cs
示例8: DeviceTable
internal DeviceTable(List<PerformanceCubeResult> resultsArray, List<DeviceInfo> deviceList)
{
foreach(PerformanceCubeResult result in resultsArray)
{
AddIfNew (false, result.DeviceDatabaseId, result.IsMonoTouch, deviceList);
}
}
开发者ID:bholmes,项目名称:IOSSampleApps,代码行数:7,代码来源:DeviceTable.cs
示例9: Button1_Click
protected void Button1_Click(object sender, EventArgs e)
{
int sheet_number = Convert.ToInt32(TextBox1.Text);
int column_number = Convert.ToInt32(TextBox2.Text);
string cell_entry = "";
List<string> list_images = new List<string>();
foreach (Row row in (((Workbook.Worksheets(excel_path)).ElementAtOrDefault(sheet_number-1)).Rows))
{
if (row.Cells.ElementAtOrDefault(column_number-1) != null)
{
cell_entry = (row.Cells.ElementAtOrDefault(column_number-1)).Text;
list_images.Add(cell_entry);
}
}
List<string> distinct_images = list_images.Distinct().ToList();
foreach (var images in distinct_images)
{
System.Drawing.Image image = DownloadImageFromUrl("https://media.loylty.com/Gallery/" + images + ".jpg");
if (image != null)
{
string rootPath = ConfigurationManager.AppSettings["FolderPath1"];
string fileName1 = Server.MapPath(rootPath + images + ".jpg");
image.Save(fileName1);
}
}
}
开发者ID:Rashmi06,项目名称:Downloading-images-from-a-server-URL,代码行数:28,代码来源:Upload.aspx.cs
示例10: ExecutarComando
public static OracleDataReader ExecutarComando(String cmmdText, CommandType cmmdType, List<OracleParameter> listParameter)
{
// Cria comando com os dados passado por parâmetro
OracleCommand command = CriarComando(cmmdText, cmmdType, listParameter);
command.InitialLONGFetchSize = 0;
// Cria objeto de retorno
OracleDataReader objRetorno = null;
try
{
// Abre a Conexão com o banco de dados
command.Connection.Open();
// Retorna um DbDataReader
objRetorno = command.ExecuteReader(CommandBehavior.CloseConnection);
}
catch (Exception ex)
{
throw ex;
}
finally
{
// Sempre fecha a conexão com o BD
//command.Connection.Close();
//command.Connection.Dispose();
//command.Dispose();
//command = null;
}
return objRetorno;
}
开发者ID:carlaofernandesedu,项目名称:suporteinternoci,代码行数:30,代码来源:DataAccessObject.cs
示例11: LinkButton1_Click
protected void LinkButton1_Click(object sender, EventArgs e)
{
char[] trimmer={' '};
List<string> keywords = TextBox2.Text.Split(',').ToList();
List<string> filteredKeywords = new List<string>();
foreach (string word in keywords)
{
string temp = word.ToLower();
temp = temp.TrimEnd(trimmer);
temp = temp.TrimStart(trimmer);
filteredKeywords.Add(temp);
}
float CSMatch = Comparator.matchSpringerCS(filteredKeywords.ToArray());
float ENMatch = Comparator.matchSpringerEngineering(filteredKeywords.ToArray());
float MAMatch = Comparator.matchSpringerMA(filteredKeywords.ToArray());
SCS.Text = " Computer Science: " +CSMatch + "%";
SEN.Text = " Engineering: " + ENMatch + "%";
SMA.Text = " Mathematics: " + MAMatch + "%";
; ;
}
开发者ID:talhahasanzia,项目名称:JournalClassifier,代码行数:26,代码来源:Main.aspx.cs
示例12: checkClassPrereqs
// checks whether student satisfies prereqs for given CourseNumber
// string => bool
protected bool checkClassPrereqs(string CourseNumber)
{
List<string> PrereqSetIDs = new List<string>();
SqlDataReader rdr;
//gets PrereqSetIDs for CourseNumber from server, puts them in PrereqSetIDs
string sql = "SELECT PrereqSetID FROM wi.tbl_prereq_set WHERE CourseNumber = @CourseNumber;";
MyConnection.Open();
SqlCommand cmd = new SqlCommand(sql, MyConnection);
cmd.Parameters.Add("@CourseNumber", System.Data.SqlDbType.VarChar);
cmd.Parameters["@CourseNumber"].Value = CourseNumber;
rdr = cmd.ExecuteReader();
while (rdr.Read())
{
//PrereqSetIDs.Add(rdr.GetString(0));
PrereqSetIDs.Add(rdr.GetValue(0).ToString());
}
if (cmd != null) cmd.Dispose();
if (MyConnection != null) MyConnection.Close();
if (rdr != null) rdr.Dispose();
MyConnection.Close();
//for each PrereqSetID, gets its classes from server and checks whether studenthistory contains them
foreach (string PrereqSetID in PrereqSetIDs)
{
List<string> PrereqSet = new List<string>();
bool setRet = false;
sql = "SELECT Prereq FROM wi.tbl_prereq WHERE PrereqSetID = @PrereqSetID;";
MyConnection.Open();
cmd = new SqlCommand(sql, MyConnection);
cmd.Parameters.Add("@PrereqSetID", System.Data.SqlDbType.VarChar);
cmd.Parameters["@PrereqSetID"].Value = PrereqSetID;
rdr = cmd.ExecuteReader();
while (rdr.Read())
{
//checks if returned classes are in StudentHistory
if (studentHistory.Contains(rdr.GetString(0))) setRet = true;
}
if (cmd != null) cmd.Dispose();
if (MyConnection != null) MyConnection.Close();
if (rdr != null) rdr.Dispose();
MyConnection.Close();
//returns false if the PrereqSet isn't satisfied
if (!setRet) return false;
}
if (cmd != null) cmd.Dispose();
if (MyConnection != null) MyConnection.Close();
if (rdr != null) rdr.Dispose();
MyConnection.Close();
//returns true if no prereqs are missing for the PrereqSets
return true;
}
开发者ID:timerwoolf,项目名称:WhenIfApp,代码行数:62,代码来源:Calculator.aspx.cs
示例13: Unnamed_Click
protected void Unnamed_Click(object sender, EventArgs e)
{
string email = Iemail.Text;
string pass = Ipass.Text;
User u = new User();
List<string> lst = new List<string>();
lst = u.UserLogin(email, pass);
if(lst[0].ToString().Equals("True"))
{
if(lst[3].ToString().Equals("1") || lst[3].ToString().Equals("4"))
{
Application.Add("username", lst[2]);
Application.Add("UserNumber", lst[1]);
Application.Add("UserSecRole", lst[3]);
Response.Redirect("./default");
}
if (lst[3].ToString().Equals("2") || lst[3].ToString().Equals("3"))
{
Application.Add("username", lst[2]);
Application.Add("UserNumber", lst[1]);
Application.Add("UserSecRole", lst[3]);
Response.Redirect("./manager/default");
}
}
else
{
email = "";
pass = "";
failed.Visible = true;
}
}
开发者ID:Davidsobey,项目名称:Tweek-Performance,代码行数:35,代码来源:Login.aspx.cs
示例14: btnAjouter_Click
protected void btnAjouter_Click(object sender, EventArgs e)
{
List<Produit> uneListeDeProduits = new List<Produit>();
MySqlConnection cnx = new MySqlConnection("server=localhost;user=root;password=root;database=magasin");
cnx.Open();
MySqlCommand cmd = cnx.CreateCommand();
cmd.CommandType = CommandType.Text;
/*
cmd.CommandText = "INSERT INTO produit(designation, prixUnitaire, quantiteEnStock) "
+"VALUES ('" + txtDesignation.Text + "'," + txtPrixUnitaire.Text + "," + txtQuantiteEnStock.Text + ")";
*/
// Requêtes paramétrées
cmd.CommandText = "INSERT INTO produit(designation, prixUnitaire, quantiteEnStock) "
+ "VALUES (@designation, @prixUnitaire, @quantiteEnStock)";
cmd.Prepare();
cmd.Parameters.AddWithValue("@designation", txtDesignation.Text);
cmd.Parameters.AddWithValue("@prixUnitaire", txtPrixUnitaire.Text);
cmd.Parameters.AddWithValue("@quantiteEnStock", txtQuantiteEnStock.Text);
using (DbDataReader dbrdr = cmd.ExecuteReader())
{
if (dbrdr.Read()) {}
lblMessage.Text = "BRAVO ! L'insertion a réussi.";
}
cnx.Close();
}
开发者ID:sisowath,项目名称:DatabaseWithAspNetWebForm,代码行数:25,代码来源:WebForm2.aspx.cs
示例15: RegisterCookie
protected void RegisterCookie(List<CUser> userlist)
{
Page page = (Page)HttpContext.Current.Handler;
foreach (CUser user in userlist)
{
HttpCookie aCookie = new HttpCookie("user_name");
aCookie.Value = user.user_name;
aCookie.Expires = DateTime.Now.AddDays(1);
HttpContext.Current.Response.Cookies.Add(aCookie);
HttpCookie aCookie2 = new HttpCookie("user_email");
aCookie2.Value = user.user_email;
aCookie2.Expires = DateTime.Now.AddDays(1);
HttpContext.Current.Response.Cookies.Add(aCookie2);
HttpCookie aCookie3 = new HttpCookie("user_id");
aCookie3.Value = user.user_id.ToString();
aCookie3.Expires = DateTime.Now.AddDays(1);
HttpContext.Current.Response.Cookies.Add(aCookie3);
HttpCookie aCookie4 = new HttpCookie("user_group_id");
aCookie4.Value = user.user_id.ToString();
aCookie4.Expires = DateTime.Now.AddDays(1);
HttpContext.Current.Response.Cookies.Add(aCookie4);
}
}
开发者ID:indigomike7,项目名称:insuranceregistration,代码行数:26,代码来源:Login.aspx.cs
示例16: sqlstringtext
public static string sqlstringtext()
{
string appPath = HttpRuntime.AppDomainAppPath + @"\sql.txt";
//string appPath = @"c:\Users\" + Environment.UserName + @"\Desktop\sql.txt";
List<string> lines = new List<string>();
using (StreamReader r = new StreamReader(appPath, Encoding.Default))
{
string line;
while ((line = r.ReadLine()) != null)
{
lines.Add(line);
}
}
string sqltext = "";
foreach (string s in lines)
{
//string[] words = s;
sqltext = s.Trim();
//words[0] = "";
//words[1] = "";
}
return sqltext;
}
开发者ID:geo7geg,项目名称:WebApplication3,代码行数:27,代码来源:Class1.cs
示例17: ProcessRequest
public void ProcessRequest(HttpContext context)
{
String today = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
List<item_public> items = new List<item_public>();
using (var sql_conn = new SqlConnection(System.Web.Configuration.WebConfigurationManager.AppSettings["ConnectionStr"]))
{
sql_conn.Open();
using (var sql_cmd = sql_conn.CreateCommand())
{
var comm = string.Format("SELECT acttitle, actbdate,actedate, content , name ,telephone ,cellphone FROM hactivity where bucd ='wkhm' and actedate >='{0}' ORDER BY actedate DESC ", today);
sql_cmd.CommandText = comm;
sql_cmd.ExecuteNonQuery();
SqlDataReader sqlite_datareader1 = sql_cmd.ExecuteReader();
while (sqlite_datareader1.Read())
{
items.Add(new item_public()
{
acttitle = sqlite_datareader1["acttitle"].ToString(),
actbdate = DateTime.Parse(sqlite_datareader1["actbdate"].ToString()).ToString("yyyy-MM-dd HH:mm:ss"),
actedate = DateTime.Parse(sqlite_datareader1["actedate"].ToString()).ToString("yyyy-MM-dd HH:mm:ss"),
content = sqlite_datareader1["content"].ToString(),
name = sqlite_datareader1["name"].ToString(),
telephone = sqlite_datareader1["telephone"].ToString(),
cellphone = sqlite_datareader1["cellphone"].ToString()
});
}
String data = JsonConvert.SerializeObject(items);
context.Response.Clear();
context.Response.ContentType = "application/json ; charset =utf-8";
context.Response.Write(data);
context.Response.End();
}
}
}
开发者ID:starboxs,项目名称:wkhm_webservice,代码行数:35,代码来源:wkhm_public.ashx.cs
示例18: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (Request["lang"] != null)
{
if (Request["lang"] == "en")
{
Session["lang"] = "en";
}
else
{
Session["lang"] = "my";
}
}
if (HttpContext.Current.Request.Cookies["user_email"]!=null && Session["user_name"]==null)
{
CUser userObj = new CUser();
List<CUser> lstUser=new List<CUser>();
lstUser=userObj.GetUserByEmail(HttpContext.Current.Request.Cookies["user_email"].Value);
if (lstUser.Count() > 0)
{
RegisterSession(lstUser);
//throw new Exception("cookies");
}
}
if ((string)Session["user_email"] == null)
{
Response.Redirect("Login.aspx");
}
//initz initObj = new initz();
//List<Dictionary<string, Object>> primary_nav = new List<Dictionary<string, object>>();
//primary_nav = initObj.primary_nav;
}
开发者ID:indigomike7,项目名称:insuranceregistration,代码行数:35,代码来源:Site.Master.cs
示例19: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
var myLog = new List<string>();
myLog.Add(string.Format("{0} - Logging Started", DateTime.UtcNow));
logListView.DataSource = myLog;
logListView.DataBind();
}
开发者ID:csharpfritz,项目名称:AddSignalRToWebForms,代码行数:8,代码来源:Default.aspx.cs
示例20: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack) { parameterList = DeserializeXml(@"C:\Users\Роман\Desktop\2008\WebApplication1\WebApplication1\Input.xml");
Control.Validation = new Validation(parameterList);
}
foreach (var parameter in Control.Validation.parameterList)
AddParameter(parameter);
}
开发者ID:RomanErO,项目名称:lab1,代码行数:8,代码来源:Default.aspx.cs
注:本文中的WebApplication1.List类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论