private void bindingExpressionEditor(int iExpressionType) { string str; try { DataTable dataTable = clsObjcampaign.fnGetEffectiveTable(Common.iProjectID, out str, Common.strTableName); DataTable schemaTable = (new DataTableReader(dataTable)).GetSchemaTable(); using (frmExpressEditor _frmExpressEditor = new frmExpressEditor(iExpressionType, string.Concat("(", str, ")"), strEligibility)) { _frmExpressEditor._fieldDict = Common.GetDict(dataTable); _frmExpressEditor.AvailableFields = _frmExpressEditor._fieldDict.ToList <KeyValuePair <string, Type> >(); _frmExpressEditor.dtSource = schemaTable; if (_frmExpressEditor.ShowDialog() == DialogResult.OK) { Common.strfiltertxt = _frmExpressEditor.strExpression; } } } catch (Exception exception1) { Exception exception = exception1; RadMessageBox.Show(this, exception.Message, exception.TargetSite.Name.ToString(), MessageBoxButtons.OK, RadMessageIcon.Error, MessageBoxDefaultButton.Button1); } }
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); } }
void bindingExpressionEditor(int iExpressionType) { try { // DataTable dt = clsDSOBJ.fnGetTreDetails("ETS_TRE_BASE3"); string tblQuery; DataTable dt = clsObjcampaign.fnGetEffectiveTable(Common.iProjectID, out tblQuery, Common.strTableName); DataTableReader dr = new DataTableReader(dt); DataTable dtSchema = dr.GetSchemaTable(); // string strExpression = ""; using (var frm = new frmExpressEditor(iExpressionType, "(" + tblQuery + ")", strEligibility)) { 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) { Common.strfiltertxt = frm.strExpression; } } } catch (Exception ex) { Telerik.WinControls.RadMessageBox.Show(this, ex.Message, ex.TargetSite.Name.ToString(), MessageBoxButtons.OK, RadMessageIcon.Error, MessageBoxDefaultButton.Button1); } }
private void pctFormula_Click(object sender, EventArgs e) { try { clsDataSource clsObj = new clsDataSource(); // frmExpressEditor frm = new frmExpressEditor(); DataTable dtSource = clsObj.fnGetColMappingData(); DataTable dt = new DataTable(); for (int i = 0; i < dtSource.Rows.Count; i++) { if ((dtSource.Rows[i]["TYPE"].ToString() == ((int)Enums.ColType.Key).ToString()) || (dtSource.Rows[i]["TYPE"].ToString() == ((int)Enums.ColType.Input).ToString() && dtSource.Rows[i]["ISREQUIRED"].ToString() == "1")) { if (dtSource.Rows[i]["COLDATATYPE"].ToString().ToUpper() == "System.Decimal".ToUpper()) { dt.Columns.Add(new DataColumn(dtSource.Rows[i]["COLNAME"].ToString(), typeof(decimal))); } else if (dtSource.Rows[i]["COLDATATYPE"].ToString().ToUpper() == "System.DateTime".ToUpper()) { dt.Columns.Add(new DataColumn(dtSource.Rows[i]["COLNAME"].ToString(), typeof(DateTime))); } else if (dtSource.Rows[i]["COLDATATYPE"].ToString().ToUpper() == "System.String".ToUpper()) { dt.Columns.Add(new DataColumn(dtSource.Rows[i]["COLNAME"].ToString(), typeof(string))); } else if (dtSource.Rows[i]["COLDATATYPE"].ToString().ToUpper() == "System.int".ToUpper() || dtSource.Rows[i]["COLDATATYPE"].ToString().ToUpper() == "System.Int16".ToUpper() || dtSource.Rows[i]["COLDATATYPE"].ToString().ToUpper() == "System.Int32".ToUpper() || dtSource.Rows[i]["COLDATATYPE"].ToString().ToUpper() == "System.Int64".ToUpper()) { dt.Columns.Add(new DataColumn(dtSource.Rows[i]["COLNAME"].ToString(), typeof(int))); } } } dt.Columns.Add(new DataColumn("OPPValue", typeof(decimal))); using (var frm = new frmExpressEditor((int)Enums.ExpressionType.Opp_ptnl, Common.strTableName, strExpression)) { frm._fieldDict = GetDict(dt); frm.AvailableFields = frm._fieldDict.ToList <KeyValuePair <string, Type> >(); frm.dtSource = dtSource; var res = frm.ShowDialog(); if (res == System.Windows.Forms.DialogResult.OK) { strExpression = frm.strExpression; } } } catch (Exception ex) { Telerik.WinControls.RadMessageBox.Show(this, ex.Message, ex.TargetSite.Name.ToString(), MessageBoxButtons.OK, RadMessageIcon.Error, MessageBoxDefaultButton.Button1); } }
private void pctPotential_Click(object sender, EventArgs e) { try { clsOpportunities clsObj = new clsOpportunities(); // frmExpressEditor frm = new frmExpressEditor(); DataTable dt = new DataTable(); DataTable dtSource = clsObj.fnGetBaseColumns(ref dt); //if (dtSource.Rows.Count == 0) //{ // Telerik.WinControls.RadMessageBox.Show(this, " First you need to set Threshold. ", "Information", MessageBoxButtons.OK, RadMessageIcon.Error, MessageBoxDefaultButton.Button1); // //pgVRecommendation.SelectedPage = pgThresholds; // return; //} // dtSource.Columns.Add(new DataColumn("OPPValue", typeof(decimal))); using (var frm = new frmExpressEditor((int)Enums.ExpressionType.Opp_ptnl, "ETS_TRE_BASE2", strPntlExpression)) { frm._fieldDict = Common.GetDict(dtSource); frm.AvailableFields = frm._fieldDict.ToList <KeyValuePair <string, Type> >(); frm.dtSource = dt; var res = frm.ShowDialog(); if (res == System.Windows.Forms.DialogResult.OK) { bIsPtnlModified = true; strPntlExpression = frm.strExpression.Replace("FIELD.", "").Trim(); strPntlExpression = frm.strExpression.Replace("FIELD!", "").Trim(); //clsTre_Details clsTObj = new clsTre_Details(); //clsTObj.fnSaveOPPPotential(Common.sOpportunityName, iOpportunityId, Common.strTableName, strPntlExpression); } } } 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); } }