int getNextRow() { int i = 0; DataTable Dt = null; SearchCriteria objSearch = new SearchCriteria(); objSearch.Query = _Query; objSearch.WhereString = _Where; objSearch.SearchOn = _FilterCol; objSearch.SearchValue = this.Text; objSearch.MaximumRows = 2; objSearch.IsMoveUp = false; CommonClient oDMCommon = new CommonClient(); Dt = oDMCommon.GetDataSet_Search(objSearch, GetCompanyDBIndex(this).ToString()).Tables[0]; oDMCommon.Close(); if (Dt.Rows.Count > 1) { //if (!((DataView)this.ItemsSource).Table.Rows.Contains(Dt.Rows[1][0])) //{ ((DataView)this.ItemsSource).Table.Rows.RemoveAt(0); DataRow dr = ((DataView)this.ItemsSource).Table.NewRow(); for (int j = 0; j < ((DataView)this.ItemsSource).Table.Columns.Count; j++) { dr[j] = Dt.Rows[1][j]; } ((DataView)this.ItemsSource).Table.Rows.Add(dr); // } } return(i); }
protected override void OnInitialized(EventArgs e) { base.OnInitialized(e); CommonClient oDMCommon = new CommonClient(); DataTable dt = oDMCommon.GetDataTable("SELECT * FROM AdmnLayoutLists WHERE ID=" + FeatureID, CompanyDBIndex.ToString()); oDMCommon.Close(); strTable = dt.Rows[0]["TableName"].ToString(); strPrimaryKey = dt.Rows[0]["PrimaryKey"].ToString(); _Where = dt.Rows[0]["WhereClause"].ToString(); XmlDocument xDoc = new XmlDocument(); xDoc.LoadXml(dt.Rows[0]["LayoutXML"].ToString()); XmlNodeList xList = xDoc.SelectNodes("XML/Columns/TreeColumn"); TreeColumn oCol; oColumns = new List <TreeColumn>(); _Query = "SELECT " + strPrimaryKey; this.IsEditable = true; DataGridTextColumn dgCol; dgCol = new DataGridTextColumn(); dgCol.Header = strPrimaryKey; dgCol.Binding = new Binding(strPrimaryKey); dgCol.Visibility = System.Windows.Visibility.Hidden; this.Columns.Add(dgCol); for (int i = 0; i < xList.Count; i++) { oCol = (TreeColumn)PACTSerializer.FromXml(xList[i].OuterXml, typeof(TreeColumn)); _Query += "," + oCol.Name; dgCol = new DataGridTextColumn(); dgCol.Header = oCol.Label; dgCol.Width = oCol.Width; dgCol.Binding = new Binding(oCol.Name); iWidth += oCol.Width; this.Columns.Add(dgCol); oColumns.Add(oCol); } _Query += " FROM " + strTable; if (this.SelectedValue != null) { valueSelected = true; } //this.SelectedValue = new Binding(strPrimaryKey); this.SelectedValuePath = strPrimaryKey; }
int getPrevRow() { int i = 0; DataTable Dt = null; SearchCriteria objSearch = new SearchCriteria(); objSearch.Query = _Query; objSearch.WhereString = _Where; objSearch.SearchOn = _FilterCol; objSearch.SearchValue = this.Text; objSearch.MaximumRows = 2; objSearch.IsMoveUp = true; CommonClient oDMCommon = new CommonClient(); Dt = oDMCommon.GetDataSet_Search(objSearch, CompanyDBIndex.ToString()).Tables[0]; oDMCommon.Close(); if (Dt.Rows.Count > 0) { if (!((DataView)this.ItemsSource).Table.Rows.Contains(Dt.Rows[0][0])) { DataRow dr = ((DataView)this.ItemsSource).Table.NewRow(); for (int j = 0; j < ((DataView)this.ItemsSource).Table.Columns.Count; j++) { dr[j] = Dt.Rows[0][j]; } ((DataView)this.ItemsSource).Table.Rows.InsertAt(dr, 0); ((DataView)this.ItemsSource).Table.Rows.RemoveAt(((DataView)this.ItemsSource).Table.Rows.Count - 1); } } return(i); }
int getPrevRow() { int i = 0; DataTable Dt = null; SearchCriteria objSearch = new SearchCriteria(); objSearch.Query = _Query; objSearch.WhereString = _Where; objSearch.SearchOn = _FilterCol; objSearch.SearchValue = this.Text; objSearch.MaximumRows = 2; objSearch.IsMoveUp = true; CommonClient oDMCommon = new CommonClient(); Dt = oDMCommon.GetDataSet_Search(objSearch, GetCompanyDBIndex(this).ToString()).Tables[0]; oDMCommon.Close(); if (Dt.Rows.Count > 0) { //if (!((DataView)this.ItemsSource).Table.Rows.Contains(Dt.Rows[0][0])) //{ DataRow dr = ((DataView)this.ItemsSource).Table.NewRow(); for (int j = 0; j < ((DataView)this.ItemsSource).Table.Columns.Count; j++) { dr[j] = Dt.Rows[0][j]; } ((DataView)this.ItemsSource).Table.Rows.InsertAt(dr, 0); ((DataView)this.ItemsSource).Table.Rows.RemoveAt(((DataView)this.ItemsSource).Table.Rows.Count - 1); // } } return i; }
void FillListBox() { DataTable Dt = null; SearchCriteria objSearch = new SearchCriteria(); objSearch.Query = _Query; objSearch.WhereString = _Where; objSearch.SearchOn = _FilterCol; objSearch.SearchValue = this.Text; objSearch.MaximumRows = PageSize; objSearch.IsMoveUp = false; if (valueSelected) { objSearch.SelectedValueQuery = "select @SearchValue=" + _FilterCol + " from " + strTable + " where " + strPrimaryKey + " = " + this.SelectedValue.ToString(); valueSelected = false; } else objSearch.SelectedValueQuery = ""; if (_Where.Trim() != "") _Query = _Query + " where " + _Where; CommonClient oDMCommon = new CommonClient(); if (GetIsPartiralData(this)) Dt = oDMCommon.GetDataTable_Search(objSearch, GetCompanyDBIndex(this).ToString()); else Dt = oDMCommon.GetDataTable(_Query, GetCompanyDBIndex(this).ToString()); oDMCommon.Close(); IstextChanged = true; if (Dt != null && Dt.Rows.Count > 0) { if (this.ItemsSource == null) { this.ItemsSource = Dt.DefaultView; // ((DataView)this.ItemsSource).Table.PrimaryKey = new DataColumn[] { ((DataView)this.ItemsSource).Table.Columns[0] }; } else { ((DataView)this.ItemsSource).Table.Rows.Clear(); //Dt.PrimaryKey = new DataColumn[] { Dt.Columns[0] }; //for (int i = 0; i < ((DataView)this.ItemsSource).Table.Rows.Count; i++) //{ // if (!Dt.Rows.Contains(((DataView)this.ItemsSource).Table.Rows[i][0])) // { // ((DataView)this.ItemsSource).Table.Rows.RemoveAt(i); // i--; // } //} for (int i = 0; i < Dt.Rows.Count; i++) { //if (((DataView)this.ItemsSource).Table.Rows.Contains(Dt.Rows[i][0])) // continue; DataRow dr = ((DataView)this.ItemsSource).Table.NewRow(); for (int j = 0; j < ((DataView)this.ItemsSource).Table.Columns.Count; j++) { dr[j] = Dt.Rows[i][j]; } // if (((DataView)this.ItemsSource).Table.Rows.Count == i) ((DataView)this.ItemsSource).Table.Rows.Add(dr); //else // ((DataView)this.ItemsSource).Table.Rows.InsertAt(dr, i); } //if (popupDataGrid.Items.Count > 0) // popupDataGrid.SelectedItem = popupDataGrid.Items[0]; } //if (txt != this.Text) //{ // IstextChanged = true; // this.Text = txt; // for (int i = 0; i < popupDataGrid.Items.Count; i++) // { // if (this.Text == ((DataRowView)popupDataGrid.Items[i]).Row.ItemArray[SearchColumn].ToString()) // { // popupDataGrid.SelectedItem = popupDataGrid.Items[i]; // return; // } // } //} } IstextChanged = false; }
protected override void OnInitialized(EventArgs e) { base.OnInitialized(e); if (GetFeatureID(this) == 0) return; CommonClient oDMCommon = new CommonClient(); DataTable dt = oDMCommon.GetDataTable("SELECT * FROM AdmnLayoutLists WHERE ID=" + GetFeatureID(this).ToString(), GetCompanyDBIndex(this).ToString()); oDMCommon.Close(); strTable = dt.Rows[0]["TableName"].ToString(); strPrimaryKey = dt.Rows[0]["PrimaryKey"].ToString(); _Where = dt.Rows[0]["WhereClause"].ToString(); XmlDocument xDoc = new XmlDocument(); xDoc.LoadXml(dt.Rows[0]["LayoutXML"].ToString()); XmlNodeList xList = xDoc.SelectNodes("XML/Columns/TreeColumn"); TreeColumn oCol; oColumns = new List<TreeColumn>(); _Query = "SELECT " + strPrimaryKey; this.IsEditable = true; Microsoft.Windows.Controls.DataGridTextColumn dgCol; dgCol = new Microsoft.Windows.Controls.DataGridTextColumn(); dgCol.Header = strPrimaryKey; dgCol.Binding = new Binding(strPrimaryKey); dgCol.Visibility = System.Windows.Visibility.Hidden; this.Columns.Add(dgCol); for (int i = 0; i < xList.Count; i++) { oCol = (TreeColumn)PACTSerializer.FromXml(xList[i].OuterXml, typeof(TreeColumn)); _Query += "," + oCol.Name; dgCol = new Microsoft.Windows.Controls.DataGridTextColumn(); dgCol.Header = oCol.Label; if (xList.Count == 1) { if (this.Width > 0) dgCol.Width = this.Width; else dgCol.Width = oCol.Width; } else dgCol.Width = oCol.Width; dgCol.CanUserResize = false; dgCol.CanUserSort = false; dgCol.Binding = new Binding(oCol.Name); iWidth += oCol.Width; this.Columns.Add(dgCol); oColumns.Add(oCol); } _Query += " FROM " + strTable; if (this.SelectedValue != null) valueSelected = true; //this.SelectedValue = new Binding(strPrimaryKey); this.SelectedValuePath = strPrimaryKey; }
void FillListBox() { DataTable Dt = null; SearchCriteria objSearch = new SearchCriteria(); objSearch.Query = _Query; objSearch.WhereString = _Where; objSearch.SearchOn = _FilterCol; objSearch.SearchValue = this.Text; objSearch.MaximumRows = PageSize; objSearch.IsMoveUp = false; if (valueSelected) { objSearch.SelectedValueQuery = "select @SearchValue=" + _FilterCol + " from " + strTable + " where " + strPrimaryKey + " = " + this.SelectedValue.ToString(); valueSelected = false; } else { objSearch.SelectedValueQuery = ""; } if (_Where.Trim() != "") { _Query = _Query + " where " + _Where; } CommonClient oDMCommon = new CommonClient(); if (GetIsPartiralData(this)) { Dt = oDMCommon.GetDataTable_Search(objSearch, GetCompanyDBIndex(this).ToString()); } else { Dt = oDMCommon.GetDataTable(_Query, GetCompanyDBIndex(this).ToString()); } oDMCommon.Close(); IstextChanged = true; if (Dt != null && Dt.Rows.Count > 0) { if (this.ItemsSource == null) { this.ItemsSource = Dt.DefaultView; // ((DataView)this.ItemsSource).Table.PrimaryKey = new DataColumn[] { ((DataView)this.ItemsSource).Table.Columns[0] }; } else { ((DataView)this.ItemsSource).Table.Rows.Clear(); //Dt.PrimaryKey = new DataColumn[] { Dt.Columns[0] }; //for (int i = 0; i < ((DataView)this.ItemsSource).Table.Rows.Count; i++) //{ // if (!Dt.Rows.Contains(((DataView)this.ItemsSource).Table.Rows[i][0])) // { // ((DataView)this.ItemsSource).Table.Rows.RemoveAt(i); // i--; // } //} for (int i = 0; i < Dt.Rows.Count; i++) { //if (((DataView)this.ItemsSource).Table.Rows.Contains(Dt.Rows[i][0])) // continue; DataRow dr = ((DataView)this.ItemsSource).Table.NewRow(); for (int j = 0; j < ((DataView)this.ItemsSource).Table.Columns.Count; j++) { dr[j] = Dt.Rows[i][j]; } // if (((DataView)this.ItemsSource).Table.Rows.Count == i) ((DataView)this.ItemsSource).Table.Rows.Add(dr); //else // ((DataView)this.ItemsSource).Table.Rows.InsertAt(dr, i); } //if (popupDataGrid.Items.Count > 0) // popupDataGrid.SelectedItem = popupDataGrid.Items[0]; } //if (txt != this.Text) //{ // IstextChanged = true; // this.Text = txt; // for (int i = 0; i < popupDataGrid.Items.Count; i++) // { // if (this.Text == ((DataRowView)popupDataGrid.Items[i]).Row.ItemArray[SearchColumn].ToString()) // { // popupDataGrid.SelectedItem = popupDataGrid.Items[i]; // return; // } // } //} } IstextChanged = false; }
void FillListBox() { IstextChanged = true; DataTable Dt = null; SearchCriteria objSearch = new SearchCriteria(); objSearch.Query = _Query; objSearch.WhereString = _Where; objSearch.SearchOn = _FilterCol; objSearch.SearchValue = this.Text; objSearch.MaximumRows = PageSize; objSearch.IsMoveUp = false; if (valueSelected) { objSearch.SelectedValueQuery = "select @SearchValue=" + _FilterCol + " from " + strTable + " where " + strPrimaryKey + " = " + this.SelectedValue.ToString(); valueSelected = false; } CommonClient oDMCommon = new CommonClient(); Dt = oDMCommon.GetDataTable_Search(objSearch, CompanyDBIndex.ToString()); oDMCommon.Close(); if (Dt != null && Dt.Rows.Count > 0) { if (this.ItemsSource == null) { this.ItemsSource = Dt.AsDataView(); ((DataView)this.ItemsSource).Table.PrimaryKey = new DataColumn[] { ((DataView)this.ItemsSource).Table.Columns[0] }; } else { Dt.PrimaryKey = new DataColumn[] { Dt.Columns[0] }; for (int i = 0; i < ((DataView)this.ItemsSource).Table.Rows.Count; i++) { if (!Dt.Rows.Contains(((DataView)this.ItemsSource).Table.Rows[i][0])) { ((DataView)this.ItemsSource).Table.Rows.RemoveAt(i); i--; } } for (int i = 0; i < Dt.Rows.Count; i++) { if (((DataView)this.ItemsSource).Table.Rows.Contains(Dt.Rows[i][0])) { continue; } DataRow dr = ((DataView)this.ItemsSource).Table.NewRow(); for (int j = 0; j < ((DataView)this.ItemsSource).Table.Columns.Count; j++) { dr[j] = Dt.Rows[i][j]; } if (((DataView)this.ItemsSource).Table.Rows.Count == i) { ((DataView)this.ItemsSource).Table.Rows.Add(dr); } else { ((DataView)this.ItemsSource).Table.Rows.InsertAt(dr, i); } } //if (popupDataGrid.Items.Count > 0) // popupDataGrid.SelectedItem = popupDataGrid.Items[0]; } } IstextChanged = false; }
int getNextRow() { int i = 0; DataTable Dt = null; SearchCriteria objSearch = new SearchCriteria(); objSearch.Query = _Query; objSearch.WhereString = _Where; objSearch.SearchOn = _FilterCol; objSearch.SearchValue = this.Text; objSearch.MaximumRows = 2; objSearch.IsMoveUp = false; CommonClient oDMCommon = new CommonClient(); Dt = oDMCommon.GetDataSet_Search(objSearch, CompanyDBIndex.ToString()).Tables[0]; oDMCommon.Close(); if (Dt.Rows.Count > 1) { if (!((DataView)this.ItemsSource).Table.Rows.Contains(Dt.Rows[1][0])) { ((DataView)this.ItemsSource).Table.Rows.RemoveAt(0); DataRow dr = ((DataView)this.ItemsSource).Table.NewRow(); for (int j = 0; j < ((DataView)this.ItemsSource).Table.Columns.Count; j++) { dr[j] = Dt.Rows[1][j]; } ((DataView)this.ItemsSource).Table.Rows.Add(dr); } } return i; }
void FillListBox() { IstextChanged = true; DataTable Dt = null; SearchCriteria objSearch = new SearchCriteria(); objSearch.Query = _Query; objSearch.WhereString = _Where; objSearch.SearchOn = _FilterCol; objSearch.SearchValue = this.Text; objSearch.MaximumRows = PageSize; objSearch.IsMoveUp = false; if (valueSelected) { objSearch.SelectedValueQuery = "select @SearchValue=" + _FilterCol + " from " + strTable + " where " + strPrimaryKey + " = " + this.SelectedValue.ToString(); valueSelected = false; } CommonClient oDMCommon = new CommonClient(); Dt = oDMCommon.GetDataTable_Search(objSearch, CompanyDBIndex.ToString()); oDMCommon.Close(); if (Dt != null && Dt.Rows.Count > 0) { if (this.ItemsSource == null) { this.ItemsSource = Dt.AsDataView(); ((DataView)this.ItemsSource).Table.PrimaryKey = new DataColumn[] { ((DataView)this.ItemsSource).Table.Columns[0] }; } else { Dt.PrimaryKey = new DataColumn[] { Dt.Columns[0] }; for (int i = 0; i < ((DataView)this.ItemsSource).Table.Rows.Count; i++) { if (!Dt.Rows.Contains(((DataView)this.ItemsSource).Table.Rows[i][0])) { ((DataView)this.ItemsSource).Table.Rows.RemoveAt(i); i--; } } for (int i = 0; i < Dt.Rows.Count; i++) { if (((DataView)this.ItemsSource).Table.Rows.Contains(Dt.Rows[i][0])) continue; DataRow dr = ((DataView)this.ItemsSource).Table.NewRow(); for (int j = 0; j < ((DataView)this.ItemsSource).Table.Columns.Count; j++) { dr[j] = Dt.Rows[i][j]; } if (((DataView)this.ItemsSource).Table.Rows.Count == i) ((DataView)this.ItemsSource).Table.Rows.Add(dr); else ((DataView)this.ItemsSource).Table.Rows.InsertAt(dr, i); } //if (popupDataGrid.Items.Count > 0) // popupDataGrid.SelectedItem = popupDataGrid.Items[0]; } } IstextChanged = false; }