protected void btaddIndicators_Click(object sender, EventArgs e) { if (Session["IndicatorsSuccess"] == null) { DataTable dt1 = new DataTable(); dt1.Columns.Add("id"); dt1.Columns.Add("Sort"); dt1.Columns.Add("IndicatorsName"); DataRow dr; dr = dt1.NewRow(); dr["id"] = dr.Table.Rows.Count; dr["Sort"] = txtSortIndicators.Text; dr["IndicatorsName"] = txtIndicators2.Text; dt1.Rows.Add(dr); dvIndicators = dt1.DefaultView; Session["IndicatorsSuccess"] = dt1; } else { DataTable dt1 = new DataTable(); dt1 = (DataTable)Session["IndicatorsSuccess"]; if (txtid.Text == "") { DataView ckdv = ((DataTable)Session["IndicatorsSuccess"]).DefaultView; DataRow dr; dr = dt1.NewRow(); dr["id"] = dr.Table.Rows.Count; dr["Sort"] = txtSortIndicators.Text; dr["IndicatorsName"] = txtIndicators2.Text; dt1.Rows.Add(dr); } else { Int32 i = Convert.ToInt32(txtid.Text); dt1.Rows[i]["Sort"] = txtSortIndicators.Text; dt1.Rows[i]["IndicatorsName"] = txtIndicators2.Text; } dvIndicators = dt1.DefaultView; Session["IndicatorsSuccess"] = dt1; } //dvBudget.Sort = "YearE DESC"; ClearIndicators(); GridViewIndicators.DataSource = dvIndicators; GridViewIndicators.CheckListDataField = "id"; GridViewIndicators.DataBind(); if (dvIndicators.Count > 0) { btDelIndicators.Visible = true; GridViewIndicators.Visible = true; } }
private void ClearAll() { Session.Remove("IndicatorsSuccess"); txtStrategies.Text = ""; txtSearch.Text = ""; GridViewIndicators.DataSource = null; GridViewIndicators.DataBind(); btDelIndicators.Visible = false; GridViewIndicators.Visible = false; }
private void GetData(string id) { if (string.IsNullOrEmpty(id)) { return; } DataView dv = Conn.Select(string.Format("Select * From Strategies Where StrategiesCode = '" + id + "'")); if (dv.Count != 0) { ddlYearS.SelectedValue = dv[0]["StudyYear"].ToString(); txtStrategies.Text = dv[0]["StrategiesName"].ToString(); txtSort.Text = dv[0]["Sort"].ToString(); btc.getCreateUpdateUser(lblCreate, lblUpdate, "Strategies", "StrategiesCode", id); string strSql = " Select CorporateStrategyID, Sort As id, CorporateStrategyName " + " From CorporateStrategy " + " Where StrategiesCode = '{0}' "; dvIndicators = Conn.Select(string.Format(strSql + " Order By Sort ", id)); if (dvIndicators.Count != 0) { btDelIndicators.Visible = true; if (Session["IndicatorsSuccess"] == null) { DataTable dt1 = new DataTable(); dt1.Columns.Add("id"); dt1.Columns.Add("IndicatorsName"); DataRow dr; for (int i = 0; i < dvIndicators.Count; i++) { dr = dt1.NewRow(); dr["id"] = dvIndicators[i]["id"].ToString(); dr["IndicatorsName"] = dvIndicators[i]["CorporateStrategyName"].ToString(); dt1.Rows.Add(dr); } dvIndicators = dt1.DefaultView; Session["IndicatorsSuccess"] = dt1; } GridViewIndicators.Visible = true; GridViewIndicators.DataSource = dvIndicators; GridViewIndicators.CheckListDataField = "id"; GridViewIndicators.DataBind(); } else { btDelIndicators.Visible = false; GridViewIndicators.Visible = false; } } }
private void ClearAll() { Session.Remove("IndicatorsSuccess"); Session.Remove("Goals"); txtStrategies.Text = ""; txtSearch.Text = ""; GridViewIndicators.DataSource = null; GridViewIndicators.DataBind(); btDelIndicators.Visible = false; GridViewIndicators.Visible = false; btc.GenSortNotDelFlag(txtSortIndicators, "StrategiesIndicators", "StrategiesCode = '" + Request.QueryString["id"] + "'"); gridViewGoals.DataSource = null; gridViewGoals.DataBind(); btDelGoals.Visible = false; gridViewGoals.Visible = false; btc.GenSortNotDelFlag(txtSortGoals, "StrategiesGoals", "StrategiesCode = '" + Request.QueryString["id"] + "'"); }
protected void btDelIndicators_Click(object sender, EventArgs e) { if (GridViewIndicators.SelectedItems.Length == 0) { return; } DataTable dt1 = new DataTable(); dt1 = (DataTable)Session["IndicatorsSuccess"]; DataRow[] dra = dt1.Select("id in (" + string.Join(",", GridViewIndicators.SelectedItems) + ")"); foreach (DataRow dr in dra) { dr.Delete(); } dt1.AcceptChanges(); dvIndicators = dt1.DefaultView; Session["IndicatorsSuccess"] = dt1; GridViewIndicators.DataSource = dvIndicators; GridViewIndicators.DataBind(); if (dvIndicators.Count == 0) { btDelIndicators.Visible = false; } }