當前位置: 首頁>>代碼示例>>C#>>正文


C# WebApplication1.List類代碼示例

本文整理匯總了C#中WebApplication1.List的典型用法代碼示例。如果您正苦於以下問題:C# List類的具體用法?C# List怎麽用?C# List使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


List類屬於WebApplication1命名空間,在下文中一共展示了List類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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\">&times;</button> Password Update Success</div>";
                 }
             }
             if (found == false)
             {
                 ltrlmsg.Text = "<div class=\"alert alert-danger\"><button type=\"button\" class=\"close\" data-dismiss=\"alert\">&times;</button> Old Password Error</div>";
             }
         }
         catch (Exception ex)
         {
             ltrlmsg.Text = "<div class=\"alert alert-danger\"><button type=\"button\" class=\"close\" data-dismiss=\"alert\">&times;</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


注:本文中的WebApplication1.List類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。