void bindingExpressionEditor(int iExpressionType) { try { clsDataSource clsDSOBJ = new clsDataSource(); // DataTable dt = clsDSOBJ.fnGetTreDetails(Common.strTableName); DataTable dt = clsDSOBJ.fnGetTreDetails("Tre_Random"); DataTableReader dr = new DataTableReader(dt); DataTable dtSchema = dr.GetSchemaTable(); using (var frm = new frmExpressEditor(iExpressionType, "Tre_Random", strPtnlFilter)) { frm._fieldDict = Common.GetDict(dt); frm.AvailableFields = frm._fieldDict.ToList <KeyValuePair <string, Type> >(); frm.dtSource = dtSchema; var res = frm.ShowDialog(); if (res == System.Windows.Forms.DialogResult.OK) { strPtnlFilter = frm.strExpression; Common.strPtnlFilter = strPtnlFilter; } } } catch (Exception ex) { Telerik.WinControls.RadMessageBox.Show(this, ex.Message, ex.TargetSite.Name.ToString(), MessageBoxButtons.OK, RadMessageIcon.Error, MessageBoxDefaultButton.Button1); } }
private void fnLoadPreview() { try { if (Common.bIsConnectionStringEstablish) { lblError.Visible = false; if (!bPreviewLoaded) { //DataTable dt = clsDSObj.fnGetTreDetails(Common.strTableName); DataTable dt = clsDSObj.fnGetTreDetails("Tre_Random"); grdPreview.DataSource = dt; this.grdPreview.MasterTemplate.Refresh(null); grdPreview.Refresh(); grdPreview.AllowAddNewRow = false; grdPreview.ShowRowHeaderColumn = false; grdPreview.EnableGrouping = false; grdPreview.ShowFilteringRow = false; grdPreview.AutoSizeRows = false; grdPreview.AllowEditRow = false; grdPreview.MasterTemplate.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.None; grdPreview.MasterTemplate.BestFitColumns(); grdPreview.AutoScroll = true; } } else { grdPreview.Visible = false; lblError.Visible = true; } } catch (Exception ex) { Telerik.WinControls.RadMessageBox.Show(this, ex.Message, ex.TargetSite.Name.ToString(), MessageBoxButtons.OK, RadMessageIcon.Error, MessageBoxDefaultButton.Button1); } }
void bindingExpressionEditor(int iExpressionType, string CalaculatedColumnValue = "", string strColname = "") { try { clsDataSource clsObj = new clsDataSource(); DataTable dtSource = clsObj.fnGetColMappingData(Common.iProjectID); DataTable dt = clsDSOBJ.fnGetTreDetails(Common.strTableName); DataTableReader dr = new DataTableReader(dt); DataTable dtSchema = dr.GetSchemaTable(); string strExpression = ""; if (iExpressionType == (int)Enums.ExpressionType.Filter) { strExpression = clsObj.fnselectFilterCondition(Common.iProjectID); } else { strExpression = ""; } if (iExpressionType == (int)Enums.ExpressionType.CalaculatedColumn) { strExpression = CalaculatedColumnValue; } using (var frm = new frmExpressEditor(iExpressionType, Common.strTableName, strExpression)) { frm._fieldDict = Common.GetDict(dt); frm.AvailableFields = frm._fieldDict.ToList <KeyValuePair <string, Type> >(); frm.dtSource = dtSchema; var res = frm.ShowDialog(); if (res == System.Windows.Forms.DialogResult.OK) { if (iExpressionType == (int)Enums.ExpressionType.Filter) { clsObj.fnInserFilter(frm.strExpression, Common.iProjectID); } else if (iExpressionType == (int)Enums.ExpressionType.AddColumn) { // Common.strfiltertxt = ""; string strColName = frm.strColName; string strMsg = ""; strExpression = frm.strExpression; if (!clsObj.fnAddCalaculatedColumn(Common.strTableName, strColName, strExpression, ref strMsg, Common.iProjectID)) { if (strMsg != "") { Telerik.WinControls.RadMessageBox.Show(this, strMsg, "Information", MessageBoxButtons.OK, RadMessageIcon.Error, MessageBoxDefaultButton.Button1); } return; } } else if (iExpressionType == (int)Enums.ExpressionType.CalaculatedColumn) { if (!clsObj.fnUpdateCalaculatedColumn(Common.strTableName, strColname, frm.strExpression, Common.iProjectID)) { } } dtmain = (DataTable)dataschemaGrid.DataSource; dataschemaGridbinding(); } } } catch (Exception ex) { Telerik.WinControls.RadMessageBox.Show(this, ex.Message, ex.TargetSite.Name.ToString(), MessageBoxButtons.OK, RadMessageIcon.Error, MessageBoxDefaultButton.Button1); } }