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


C# TableRow.GetType方法代码示例

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


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

示例1: populateTable

    /*
     * void populateTable()
     * @params: none
     * @return: none
     * This method populates the list of requests from the user for the administrator to approve
     * The user can see the requests he has made and see its status, whether approved, rjected or pending
     */
    protected void populateTable()
    {
        using (System.Data.SqlClient.SqlConnection con = new System.Data.SqlClient.SqlConnection(conString))
        {
            com = new SqlCommand("SELECT * FROM REQUEST_VIEW WHERE [email protected] ORDER BY STATUS DESC,BOOKING_DATE", con);
            con.Open();
            string username = HttpContext.Current.User.Identity.Name;
            com.Parameters.Add("@username", SqlDbType.VarChar).Value = username ;
            SqlDataReader reader = com.ExecuteReader();
            TableRow t = new TableRow();
            Array controlls = Array.CreateInstance(t.GetType(), 100);
            Table1.Rows.CopyTo(controlls, 0);
            Table1.Rows.Clear();
            Table1.Rows.Add(((TableRow)controlls.GetValue(0)));

            while (reader.Read())
            {
                string requestId = reader["REQUEST_ID"].ToString();
                string familyname = reader["FAMILY_NAME"].ToString();
                string bookingdate = ((DateTime)reader["BOOKING_DATE"]).ToShortDateString();
                string title = reader["TITLE"].ToString();
                string status = reader["STATUS"].ToString();
                TableRow r = new TableRow();
                TableCell c = new TableCell();
                c.Text = familyname;
                r.Cells.Add(c);
                c = new TableCell();
                c.Text = title;
                r.Cells.Add(c);
                c = new TableCell();
                c.Text = bookingdate;
                r.Cells.Add(c);
                c = new TableCell();
                if (status.Equals("APPROVED"))
                {
                    Label b = new Label();
                    b.Text = "Approved";
                    b.Width = Unit.Pixel(30);
                    b.Height = Unit.Pixel(30);
                    c.Controls.Add(b);
                }
                else if (status.Equals("REJECTED"))
                {
                    Label b = new Label();
                    b.Text = "Rejected";
                    b.Width = Unit.Pixel(30);
                    b.Height = Unit.Pixel(30);
                    c.Controls.Add(b);
                }
                else
                {
                    Label b = new Label();
                    b.Text = "Not Approved";
                    b.Width = Unit.Pixel(30);
                    b.Height = Unit.Pixel(30);
                    c.Controls.Add(b);
                }
                r.Cells.Add(c);
                Table1.Rows.Add(r);
            }
            reader.Close();
        }
    }
开发者ID:nikhilgv9,项目名称:BasilicaSoft,代码行数:70,代码来源:ViewRequest.aspx.cs

示例2: populateTable

    /*
     * void populateTable()
     * @params: none
     * @return: none
     * This method populates the list of requests from the user for the administrator to approve
     * Admin can view different request and aprove them as he wish
     */
    protected void populateTable()
    {
        using (System.Data.SqlClient.SqlConnection con = new System.Data.SqlClient.SqlConnection(conString))
        {
            com = new SqlCommand("SELECT * FROM REQUEST_VIEW ORDER BY STATUS DESC,BOOKING_DATE", con);
            con.Open();
            SqlDataReader reader = com.ExecuteReader();
            TableRow t = new TableRow();
            Array controlls = Array.CreateInstance(t.GetType(), 100);
            Table1.Rows.CopyTo(controlls, 0);
            Table1.Rows.Clear();
            Table1.Rows.Add(((TableRow)controlls.GetValue(0)));

            while (reader.Read())
            {
                string requestId = reader["REQUEST_ID"].ToString();
                string familyname = reader["FAMILY_NAME"].ToString();
                string bookingdate = ((DateTime)reader["BOOKING_DATE"]).ToShortDateString();
                string title = reader["TITLE"].ToString();
                string status = reader["STATUS"].ToString();
                TableRow r = new TableRow();
                TableCell c = new TableCell();
                c.Text = familyname;
                r.Cells.Add(c);
                c = new TableCell();
                c.Text = title;
                r.Cells.Add(c);
                c = new TableCell();
                c.Text = bookingdate;
                r.Cells.Add(c);
                c = new TableCell();
                if (status.Equals("APPROVED"))
                {
                    Label b = new Label();
                    b.Text = "Approved";
                    b.Width = Unit.Pixel(30);
                    b.Height = Unit.Pixel(30);
                    c.Controls.Add(b);
                }
                else if (status.Equals("REJECTED"))
                {
                    Label b = new Label();
                    b.Text = "Rejected";
                    b.Width = Unit.Pixel(30);
                    b.Height = Unit.Pixel(30);
                    c.Controls.Add(b);
                }
                else
                {
                    ImageButton b = new ImageButton();
                    b.ImageUrl = "images/button_ok.png";
                    b.ID = "ButtonA_" + requestId;
                    b.Click += new ImageClickEventHandler(this.ButtonA_Click);
                    b.Width = Unit.Pixel(30);
                    b.Height = Unit.Pixel(30);
                    c.Controls.Add(b);

                    b = new ImageButton();
                    b.ImageUrl = "images/DeleteRed.png";
                    b.ID = "ButtonR_" + requestId;
                    b.Click += new ImageClickEventHandler(this.ButtonR_Click);
                    b.Width = Unit.Pixel(30);
                    b.Height = Unit.Pixel(30);
                    c.Controls.Add(b);
                }
                r.Cells.Add(c);
                Table1.Rows.Add(r);
            }
            reader.Close();
        }
    }
开发者ID:nikhilgv9,项目名称:BasilicaSoft,代码行数:78,代码来源:ApproveRequest.aspx.cs


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