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);
            }
        }
예제 #2
0
        private void fnCreateView()
        {
            string        str            = "";
            clsDataSource _clsDataSource = new clsDataSource();

            this.strMainFilter = _clsDataSource.fnselectFilterCondition(Common.iProjectID);
            DataTable dataTable = _clsDataSource.fnGetTreDetailsSchema(Common.strTableName);

            foreach (DataRow row in dataTable.Rows)
            {
                str = string.Concat(str, row[0].ToString());
                str = string.Concat(str, ",");
            }
            dataTable = _clsDataSource.fnGetCalaculatedColMappingData(Common.iProjectID, Common.strTableName);
            foreach (DataRow dataRow in dataTable.Rows)
            {
                str = string.Concat(str, dataRow["COMBINE_COLUMNS"].ToString(), " ", dataRow["COLNAME"].ToString());
                str = string.Concat(str, ",");
            }
            if (str.Length > 0)
            {
                str = str.Remove(str.Length - 1, 1);
            }
            this.clstreDetails.fnCreateTableView(Common.strTableName, str, this.strMainFilter);
        }
예제 #3
0
        private void fnFillSource()
        {
            try
            {
                clsDataSource clsObj   = new clsDataSource();
                DataTable     dtSource = clsObj.fnGetColMappingData(Common.iProjectID);
                DataRow[]     dr       = dtSource.Select("TYPE=" + ((int)Enums.ColType.Input).ToString() + " And ISREQUIRED=1");

                DataTable dt = dr.CopyToDataTable();

                ddlSource.DataSource    = dt;
                ddlSource.ValueMember   = "COLNAME";
                ddlSource.DisplayMember = "COLNAME";

                ddlSource.SelectedIndex = 0;
                foreach (string opptype in OpportunityTypes)
                {
                    ddlOpportunityType.Items.Add(opptype);
                }
                ddlOpportunityType.SelectedIndex = 0;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        void fnCreateView()
        {
            string        strColumns   = "";
            clsDataSource objDatsource = new clsDataSource();

            strMainFilter = objDatsource.fnselectFilterCondition(Common.iProjectID);

            DataTable dtcol = objDatsource.fnGetTreDetailsSchema(Common.strTableName);

            foreach (DataRow dr in dtcol.Rows)
            {
                strColumns += dr[0].ToString();
                strColumns += ",";
            }
            dtcol = objDatsource.fnGetCalaculatedColMappingData(Common.iProjectID, Common.strTableName);
            foreach (DataRow dr in dtcol.Rows)
            {
                strColumns += dr["COMBINE_COLUMNS"].ToString() + " " + dr["COLNAME"].ToString();
                strColumns += ",";
            }
            if (strColumns.Length > 0)
            {
                strColumns = strColumns.Remove(strColumns.Length - 1, 1);
            }
            clstreDetails.fnCreateTableTab(Common.strTableName, strColumns, strMainFilter);
        }
예제 #5
0
        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);
            }
        }
예제 #6
0
        private bool fnValidateExpression(ref string strString, ref bool bIsNotCaseExpression)
        {
            try
            {
                strString = txtExpression.Text.Replace("Field.", "").Trim().ToUpper();

                if (strString.StartsWith("="))
                {
                    strString = strString.Substring(1);
                }
                if (strString == "")
                {
                    strString = "1=1";
                }

                clsDataSource clsObj = new clsDataSource();

                DataTable dtSource = clsObj.fnValidateExpressEditor(strString, strTabName, iExpressionFor);

                if (dtSource != null)
                {
                    LabelParserResult.Text = "Success!";
                    LabelParserError.Text  = "";
                    if (strString == "1=1")
                    {
                        strString          = "";
                        txtExpression.Text = "=";
                    }
                    return(true);
                }

                return(false);
            }
            catch (Exception ex)
            {
                LabelParserResult.Text = "Constant: Failed!";
                LabelParserError.Text  = "Exception: " + ex.Message;
                throw ex;
            }
        }
예제 #7
0
        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);
            }
        }
예제 #8
0
 // Constructor
 public clsGetAdmins()
 {
     Model  = new clsDataSource();
     myBank = new clsBank();
 }