コード例 #1
0
ファイル: TMSPlayer.aspx.cs プロジェクト: guriiii/TMSSystem
        protected void grd_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int    rowIndex  = Convert.ToInt32(e.CommandArgument.ToString());
            string teacherid = this.grd.DataKeys[rowIndex]["ID"].ToString();

            if (e.CommandName == "updates")
            {
                ListToDatatable lsttodt = new ListToDatatable();
                var             lst     = _service.PlayerListGetByID(Convert.ToInt32(teacherid));
                DataTable       dt      = lsttodt.ToDataTable(lst);
                if (dt != null && dt.Rows.Count > 0)
                {
                    HiddenField1.Value = dt.Rows[0]["Id"].ToString();
                    TeamID.Text        = dt.Rows[0]["TeamID"].ToString();
                    txtName.Text       = dt.Rows[0]["Name"].ToString();
                    Position.Text      = dt.Rows[0]["Position"].ToString();
                    GenderList.Text    = dt.Rows[0]["Gender"].ToString();
                    btnSave.Text       = "Update";
                }
                else
                {
                    //do nothing
                    btnSave.Text = "Save";
                }
            }
            else
            {
                DataTable dt     = new DataTable();
                bool      result = _service.DelPlayer(Convert.ToInt32(teacherid));
                if (result)
                {
                    bindGrid();
                }
            }
        }
コード例 #2
0
        private void BtnLoadCsv_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(TxtCsvFile.Text))
            {
                string strPath = Path.GetExtension(TxtCsvFile.Text);
                if (strPath != ".csv")
                {
                    MessageBox.Show("Path does not contain a valid *.CSV file!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    if (File.Exists(TxtCsvFile.Text))
                    {
                        var output = Classes.CSVReader.ReadFile(TxtCsvFile.Text);
                        _dtPrimaryCsvData = ListToDatatable.ToDataTable(output);

                        DgvData.DataSource         = _dtPrimaryCsvData;
                        DgvData.Columns[1].Visible = false;
                        DgvData.Columns[4].Visible = false;

                        CreateTree(_dtPrimaryCsvData);
                    }
                    else
                    {
                        MessageBox.Show("CSV Doesn't Exist.");
                    }
                }
            }
        }
コード例 #3
0
        protected void grd_RowCommand(object sender, GridViewCommandEventArgs e)//row cammand for updating method
        {
            int    rowIndex  = Convert.ToInt32(e.CommandArgument.ToString());
            string teacherid = this.grd.DataKeys[rowIndex]["ID"].ToString();

            if (e.CommandName == "updates")
            {
                ListToDatatable lsttodt = new ListToDatatable();
                var             lst     = _serviceCoach.GetCoachListByID(Convert.ToInt32(teacherid));
                DataTable       dt      = lsttodt.ToDataTable(lst);
                if (dt != null && dt.Rows.Count > 0)
                {
                    HiddenField1.Value = dt.Rows[0]["ID"].ToString();
                    txtCoachName.Text  = dt.Rows[0]["CoachName"].ToString();
                    btnSave.Text       = "Update";
                }
                else
                {
                    //do nothing
                    btnSave.Text = "Save";
                }
            }
            else
            {
                DataTable dt     = new DataTable();
                bool      result = _serviceCoach.DeleteCoach(Convert.ToInt32(teacherid));
                if (result)
                {
                    bindGrid();
                }
            }
        }
コード例 #4
0
        protected void grd_RowCommand(object sender, GridViewCommandEventArgs e)//Row command erforming the functionalities in gridview like update and delete
        {
            int    rowIndex  = Convert.ToInt32(e.CommandArgument.ToString());
            string teacherid = this.grd.DataKeys[rowIndex]["ID"].ToString();

            if (e.CommandName == "updates")
            {
                ListToDatatable lsttodt = new ListToDatatable();
                var             lst     = _serviceCoach.GetTeamListByID(Convert.ToInt32(teacherid));
                DataTable       dt      = lsttodt.ToDataTable(lst);
                if (dt != null && dt.Rows.Count > 0)
                {
                    HiddenField1.Value = dt.Rows[0]["Id"].ToString();
                    CoachID.Text       = dt.Rows[0]["CoachID"].ToString();
                    txtTeamName.Text   = dt.Rows[0]["TeamName"].ToString();
                    State.Text         = dt.Rows[0]["State"].ToString();
                    City.Text          = dt.Rows[0]["City"].ToString();
                    btnSave.Text       = "Update";
                }
                else
                {
                    //do nothing
                    btnSave.Text = "Save";
                }
            }
            else
            {
                DataTable dt     = new DataTable();
                bool      result = _serviceCoach.DeleteTeam(Convert.ToInt32(teacherid));
                if (result)
                {
                    bindGrid();
                }
            }
        }
コード例 #5
0
ファイル: TMSPlayer.aspx.cs プロジェクト: guriiii/TMSSystem
        protected void bindGrid()
        {
            ListToDatatable lsttodt = new ListToDatatable();
            var             lst     = _service.GetPlayerList();
            DataTable       dt      = lsttodt.ToDataTable(lst);

            if (dt != null && dt.Rows.Count > 0)
            {
                grd.DataSource = dt;
                grd.DataBind();
            }
            else
            {
                grd.DataBind();
            }
        }
コード例 #6
0
        protected void bindGrid()//This is method for binding the grid view
        {
            ListToDatatable lsttodt = new ListToDatatable();
            var             lst     = _serviceCoach.GetCoachList();
            DataTable       dt      = lsttodt.ToDataTable(lst);

            if (dt != null && dt.Rows.Count > 0)
            {
                grd.DataSource = dt;
                grd.DataBind();
            }
            else
            {
                grd.DataBind();
            }
        }