/// <summary> /// Converts the column header texts for language conversion /// </summary> private void ChangeLanguage() { try { string strTmp = ""; clsLanguage objLang = new clsLanguage(); for (int i = 0; i < dtSource.Columns.Count; i++) { if (strLangID[i] != null) { strTmp = objLang.LanguageString(strLangID[i]); if (strTmp != "*****") strHeadings[i] = strTmp + " "; } } objLang.Dispose(); } catch (Exception ex) { string test = ex.Message; } }
public bool DesignGridFromDataTable(DataTable tableToBeDesigned, ref string strErr) { try { //Changing For New Component // _BSource = new BindingSource(tableToBeDesigned, null); this.AutoGenerateColumns = false; strProcName = null; intColCount = tableToBeDesigned.Columns.Count; strColNames = new string[intColCount]; string[] strHeadings = new string[intColCount]; for (int i = 0; i < intColCount; i++) { strColNames[i] = tableToBeDesigned.Columns[i].ColumnName; } #region Comments ////**** Creating the Header text by replacing the Underscore(_) ////**** Symbol with the Space ( ). #endregion Comments #region Header Text for (int i = 0; i < intColCount; i++) { string tmp = ""; string[] m_strSplit = strColNames[i].Split(new char[] { '_' }, strColNames[i].Length); for (int m = 0; m <= m_strSplit.GetUpperBound(0); m++) tmp = tmp.Trim() + " " + m_strSplit[m].Trim(); strHeadings[i] = tmp; if (strLangID != null) { if (strLangID.Length >= intColCount) { clsLanguage objLang = new clsLanguage(); string strTmp = objLang.LanguageString(strLangID[i]); if (strTmp == "*****") strHeadings[i] = "** " + strHeadings[i]; else strHeadings[i] = strTmp; objLang.Dispose(); } else { if (strLangID.Length > i) { clsLanguage objLang = new clsLanguage(); string strTmp = objLang.LanguageString(strLangID[i]); if (strTmp == "*****") strHeadings[i] = "** " + strHeadings[i]; else strHeadings[i] = strTmp; objLang.Dispose(); } else { strHeadings[i] = "** " + strHeadings[i]; } } } else { strHeadings[i] = "** " + strHeadings[i]; } } #endregion ////**** Creating a new Table Style to include the TextBoxes in the Datagrid ////**** If the Default design is false then setting Colors for that Grid //Changing For New Component //this.DataSource = _BSource; this.DataSource = tableToBeDesigned; //this.DataSource = tableToBeDesigned; #region Set Default Not in Use if (SetDefault == true) { //DataGridViewCellStyle headerstyle = new DataGridViewCellStyle(); //headerstyle.BackColor = System.Drawing.Color.Linen; //headerstyle.ForeColor = System.Drawing.Color.Navy; //this.GridColor = System.Drawing.Color.Silver; //this.ColumnHeadersDefaultCellStyle.ApplyStyle(headerstyle); } else { //this.ColumnHeadersDefaultCellStyle.BackColor = System.Drawing.Color.LightSteelBlue; //this.ColumnHeadersDefaultCellStyle.ForeColor = System.Drawing.Color.Navy; //this.GridColor = System.Drawing.Color.Silver; } #endregion Set Default Not in Use ////**** To incorporate the Font the in DataGrid Cell. intVisibleColumnCount = 0; for (int i = 0; i < intColCount; i++) { if (strColNames[i].ToUpper().IndexOf("MASK") == 0) continue; intVisibleColumnCount++; DataGridViewTextBoxColumn dgTBCol = new DataGridViewTextBoxColumn(); dgTBCol.DataPropertyName = tableToBeDesigned.Columns[i].ColumnName; dgTBCol.HeaderText = strHeadings[i]; this.Columns.Add(dgTBCol); } //BindingCompleted = true; //this.Font = new Font(this.Font, FontStyle.Regular); this.AutoSize = true; // clsReadOnlyGrid_BindingContextChanged(null, null); return true; } catch (Exception ex) { strErr = ex.Message + " - " + ex.Source; return false; } }
public bool DesignGridFromSQL(string sqlParam, ref string strErr) { try { strSQL = sqlParam; Query objQuery = new Query(); DataSet ds = objQuery.ExecuteQueryCommand(strSQL); dtReadOnlyGrid = ds.Tables[0].Copy(); dtReadOnlyGrid.TableName = "Table"; ds.Dispose(); //Changing For New Component //_BSource = new BindingSource(dtReadOnlyGrid, null); intColCount = dtReadOnlyGrid.Columns.Count; strColNames = new string[intColCount]; for (int i = 0; i < intColCount; i++) strColNames[i] = dtReadOnlyGrid.Columns[i].ColumnName; ///***Displaying data from a Table to a Grid and aligning the Columns*** intColCount = dtReadOnlyGrid.Columns.Count; strColNames = new string[intColCount]; for (int i = 0; i < intColCount; i++) strColNames[i] = dtReadOnlyGrid.Columns[i].ColumnName; string[] strHeadings = new string[intColCount]; ////**** Creating the Header text by replacing the Underscore(_) ////**** Symbol with the Space ( ). clsLanguage objLang = new clsLanguage(); for (int i = 0; i < intColCount; i++) { strHeadings[i] = strColNames[i].Replace("_", " "); if (strLangID != null && strColNames[i].IndexOf("MASK_") < 0) { if (strLangID.Length >= intColCount) { string strTmp = objLang.LanguageString(strLangID[i]); if (strTmp == "*****") strHeadings[i] = "** " + strHeadings[i]; else strHeadings[i] = strTmp; } else { if (strLangID.Length > i) { string strTmp = objLang.LanguageString(strLangID[i]); if (strTmp == "*****") strHeadings[i] = "** " + strHeadings[i]; else strHeadings[i] = strTmp; } else { strHeadings[i] = "** " + strHeadings[i]; } } } else { strHeadings[i] = "** " + strHeadings[i]; } } if (objLang != null) objLang.Dispose(); ////**** Creating a new Table Style to include the TextBoxes in the Datagrid //this.DataSource =_BSource; this.DataSource = dtReadOnlyGrid; if (SetDefault == true) { //DataGridViewCellStyle headerstyle = new DataGridViewCellStyle(); //headerstyle.BackColor = System.Drawing.Color.Linen; //headerstyle.ForeColor = System.Drawing.Color.Navy; //this.GridColor = System.Drawing.Color.Silver; //this.ColumnHeadersDefaultCellStyle.ApplyStyle(headerstyle); } else { //this.ColumnHeadersDefaultCellStyle.BackColor = System.Drawing.Color.LightSteelBlue; //this.ColumnHeadersDefaultCellStyle.ForeColor = System.Drawing.Color.Navy; //this.GridColor = System.Drawing.Color.Silver; } ////**** To incorporate the Font the in DataGrid Cell. intVisibleColumnCount = 0; if (this.Columns.Count > 0) { this.Columns.Clear(); } for (int i = 0; i < intColCount; i++) { if (strColNames[i].ToUpper().IndexOf("MASK") == 0) continue; intVisibleColumnCount++; DataGridViewTextBoxColumn dgTBCol = new DataGridViewTextBoxColumn(); dgTBCol.DataPropertyName = dtReadOnlyGrid.Columns[i].ColumnName; dgTBCol.HeaderText = strHeadings[i]; this.Columns.Add(dgTBCol); } //***************************** AutoSizeCol(); if (boolLevelSearch == true) { //this.KeyDown += new KeyEventHandler(BackSpaceKeyDown); arlHierarchyLevel = new ArrayList(); arlHierarchyValue = new ArrayList(); arlPrimKey = new ArrayList(); } this.AllowSorting = true; //*************************** //BindingCompleted = true; clsReadOnlyGrid_BindingContextChanged(null, null); //this.Font = new Font(this.Font, FontStyle.Regular); // this.AutoSize = true; return true; } catch (Exception ex) { strErr = ex.Message + " - " + ex.Source; return false; } }
private void SetMessageForLabel(clsLabel _label, string strMsgID) { clsLanguage objMessage; if (strMsgID.StartsWith("$")) { _label.Text = strMsgID.Substring(1, strMsgID.Length - 1).ToString(); return; } if (strMsgID.Trim() == "") { if (_label.Text.Trim() != "") { _label.Text = "** " + _label.Text; } return; } objMessage = new clsLanguage(); string strTemp = objMessage.LanguageString(strMsgID); if (strTemp == "*****") { _label.ForeColor = System.Drawing.Color.Orange; _label.Text = "**" + _label.Text; } else { _label.Text = strTemp; } objMessage.Dispose(); objMessage = null; }
public bool DesignGrid(string strProcedureName, ref string strErr) { try { this.AutoGenerateColumns = false; strProcName = strProcedureName; Query objQuery = new Query(); if (ProcParamNames.Count > 0) { string[] arrStrProcParamNames = new string[ProcParamNames.Count]; string[] arrStrProcParamValues = new string[ProcParamNames.Count]; for (int i = 0; i < ProcParamNames.Count; i++) { arrStrProcParamNames[i] = ProcParamNames[i].ToString(); arrStrProcParamValues[i] = ProcParamValues[i].ToString(); } objQuery.SetInputParameterNames(strProcedureName, arrStrProcParamNames); objQuery.SetInputParameterValues(arrStrProcParamValues); } objQuery.SetOutputParameterNames(strProcedureName, "CRITERIA"); DataSet ds = objQuery.ExecuteQueryProcedure(strProcedureName); dtReadOnlyGrid = ds.Tables[0].Copy(); ds.Dispose(); //Changing For New Component //_BSource = new BindingSource(dtReadOnlyGrid, null); intColCount = dtReadOnlyGrid.Columns.Count; strColNames = new string[intColCount]; for (int i = 0; i < intColCount; i++) strColNames[i] = dtReadOnlyGrid.Columns[i].ColumnName; string[] strHeadings = new string[intColCount]; ////**** Creating the Header text by replacing the Underscore(_) ////**** Symbol with the Space ( ). clsLanguage objLang = new clsLanguage(); for (int i = 0; i < intColCount; i++) { strHeadings[i] = strColNames[i].Replace("_", " "); if (strLangID != null && strColNames[i].IndexOf("MASK_") < 0) { if (strLangID.Length >= intColCount) { string strTmp = objLang.LanguageString(strLangID[i]); if (strTmp == "*****") strHeadings[i] = "** " + strHeadings[i]; else strHeadings[i] = strTmp; } else { if (strLangID.Length > i) { string strTmp = objLang.LanguageString(strLangID[i]); if (strTmp == "*****") strHeadings[i] = "** " + strHeadings[i]; else strHeadings[i] = strTmp; } else { strHeadings[i] = "** " + strHeadings[i]; } } } else { strHeadings[i] = "** " + strHeadings[i]; } } if (objLang != null) objLang.Dispose(); ////**** If the Default design is false then setting Colors for that Grid //this.reEntrent = true; //Changing For New Component // this.DataSource = dtReadOnlyGrid; //this.DataSource = dtReadOnlyGrid; //this.reEntrent = false; if (SetDefault == true) { //DataGridViewCellStyle headerstyle=new DataGridViewCellStyle(); //headerstyle.BackColor= System.Drawing.Color.Linen; //headerstyle.ForeColor=System.Drawing.Color.Navy; //this.GridColor = System.Drawing.Color.Silver; //this.ColumnHeadersDefaultCellStyle.ApplyStyle(headerstyle); } else { //this.ColumnHeadersDefaultCellStyle.BackColor = System.Drawing.Color.LightSteelBlue; //this.ColumnHeadersDefaultCellStyle.ForeColor = System.Drawing.Color.Navy; //this.GridColor = System.Drawing.Color.Silver; } ////**** To incorporate the Font the in DataGrid Cell. intVisibleColumnCount = 0; if (this.Columns.Count > 0) { this.Columns.Clear(); } for (int i = 0; i < intColCount; i++) { if (strColNames[i].ToUpper().IndexOf("MASK") == 0) continue; intVisibleColumnCount++; DataGridViewTextBoxColumn dgTBCol = new DataGridViewTextBoxColumn(); dgTBCol.DataPropertyName = dtReadOnlyGrid.Columns[i].ColumnName; dgTBCol.HeaderText = strHeadings[i]; this.Columns.Add(dgTBCol); //this.Columns[this.Columns.Count - 1].AutoSizeMode = DataGridViewAutoSizeColumnMode.NotSet; } //Changing For New Component //BindingCompleted = true; //clsReadOnlyGrid_BindingContextChanged(null, null); // this.Font = new Font(this.Font, FontStyle.Regular); this.ScrollBars = ScrollBars.Both; //this.AutoSize = true; this.DataSource = dtReadOnlyGrid; return true; } catch (Exception ex) { strErr = ex.Message + " - " + ex.Source; //return false; if (strErr == "Operation is not valid because it results in a reentrant call to the SetCurrentCellAddressCore function. - System.Windows.Forms") { strErr = ""; return true; } else { return false; } } }
/// <summary> /// Retrieve messages for control /// </summary> /// <param name="objControl"></param> private void SetMessageForControl(System.Windows.Forms.Control objControl,string strMsgID) { clsLanguage objMessage; if(strMsgID.Trim() == "") { if(objControl.Text.Trim() != "") { objControl.Text = "** " + objControl.Text; } return; } objMessage = new clsLanguage(); string strTemp = objMessage.LanguageString(strMsgID); if (strTemp == "*****") { objControl.ForeColor = System.Drawing.Color.Orange; objControl.Text = "**" + objControl.Text; } else { objControl.Text = strTemp; } objMessage.Dispose(); objMessage = null; }
private void SetMessage4ComboItems(clsComboBox objCombo) { try { string[] local0 = new string[objCombo.Items.Count]; for(int i=0; i < objCombo.Items.Count;i++) local0[i] = objCombo.Items[i].ToString(); objCombo.StoreItems(local0); objCombo.Items.Clear(); for(int i=0; i < local0.Length; i++) { clsLanguage objLang = new clsLanguage(); string m_strTemp = objLang.LangEngString(local0[i]); if(m_strTemp != "*****") objCombo.Items.Add(m_strTemp); else objCombo.Items.Add("** " + local0[i]); objLang.Dispose(); } } catch(Exception) { return; } }
private string GetStringVal(string str) { string strTemp = ""; clsLanguage objLang = new clsLanguage(); strTemp = objLang.LangEngString(str,true); objLang.Dispose(); if(strTemp == "*****") return "** " + str; else return strTemp; }
private string GetStringOnID(string strID) { clsLanguage objMessage = new clsLanguage(); string strTemp = objMessage.LanguageString(strID); objMessage.Dispose(); objMessage = null; if (strTemp == "*****") return "** " + this.Text ; else return strTemp; }
private string GetMenuTextByID(string MsgID, string strMenuText) { string strTemp = ""; clsLanguage objLang = new clsLanguage(); strTemp = objLang.LanguageString(MsgID); objLang.Dispose(); if(strTemp == "*****") { if( strMenuText.IndexOf("** ") == -1 ) strMenuText = "** " + strMenuText; return strMenuText; } else return strTemp; }