Exemple #1
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);
        }
        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);
        }
        void dataschemaGridbinding()
        {
            try
            {
                DataTable dt            = clsDSOBJ.fnGetTreDetailsSchema(ddlTableName.SelectedValue.ToString());
                DataTable dtcalaculated = clsDSOBJ.fnGetCalaculatedColMappingData(Common.iProjectID, Common.strTableName);
                DataTable dt1           = clsDSOBJ.fnGetColMappingData(Common.iProjectID);
                DataRow   row;

                dt.Columns.Add(new DataColumn("Table", typeof(string)));
                dt.Columns.Add(new DataColumn("Type", typeof(int)));
                dt.Columns.Add(new DataColumn("Required", typeof(bool)));
                foreach (DataRow drcal in dtcalaculated.Rows)
                {
                    row = dt.NewRow();
                    row["ColumnName"] = drcal["COLNAME"].ToString();
                    row["Table"]      = "C";
                    //if (drcal["COLDATATYPE"].ToString() == "NUMBER")
                    //{
                    //    row["DataType"] = typeof(decimal);
                    //}
                    row["DataType"] = drcal["COLDATATYPE"].ToString() == "NUMBER" ? typeof(Decimal) : drcal["COLDATATYPE"].ToString() == "DATE" ? typeof(DateTime) : typeof(String);
                    dt.Rows.Add(row);
                }

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    if (dt1.Rows.Count > 0)
                    {
                        DataRow[] dr = dt1.Select("COLNAME='" + dt.Rows[i][0].ToString() + "'");
                        if (dr.Length > 0 && dr[0]["TABLENAME"].ToString().ToLower() == ddlTableName.SelectedValue.ToString().ToLower())
                        {
                            dt.Rows[i]["Type"]     = dr[0]["Type"];
                            dt.Rows[i]["Required"] = dr[0]["ISREQUIRED"];
                            if (dt.Rows[i]["Table"].ToString() != "C")
                            {
                                dt.Rows[i]["Table"] = "M";
                            }
                        }
                        else
                        {
                            dt.Rows[i]["Type"] = (int)Enums.ColType.None;
                            if (dt.Rows[i]["Table"] != "C")
                            {
                                dt.Rows[i]["Table"] = "M";
                            }
                            dt.Rows[i]["Required"] = false;
                        }
                    }
                    else
                    {
                        dt.Rows[i]["Type"] = (int)Enums.ColType.None;
                        if (dt.Rows[i]["Table"] != "C")
                        {
                            dt.Rows[i]["Table"] = "M";
                        }
                        dt.Rows[i]["Required"] = false;
                    }
                }

                dataschemaGrid.DataSource = dt;
                ////   DataTable dtmain = (DataTable)dataschemaGrid.DataSource;
                //   if (dtmain.Rows.Count > 0)
                //   {
                //       //dtmain.Merge(dt, true);
                //       if (dtmain.Rows.Count != dt.Rows.Count)
                //       {
                //           DataRow dr = dtmain.NewRow();
                //         dr = dt.Rows[dt.Rows.Count - 1] as DataRow;
                //           dt.Rows[dt.Rows.Count - 1].Delete();
                //           dtmain.Rows.Add(dr.ItemArray);
                //           dataschemaGrid.DataSource = dtmain;
                //           dtmain = null;
                //       }
                //   }
                //   else
                //   {
                //       dataschemaGrid.DataSource = dt;
                //   }
                GridViewComboBoxColumn categoryColumn = new GridViewComboBoxColumn();
                categoryColumn.HeaderText    = "Type";
                categoryColumn.ValueMember   = "TypeId";
                categoryColumn.DisplayMember = "Type";
                categoryColumn.FieldName     = "Type";
                categoryColumn.DataSource    = clsDSOBJ.fnCreateColTypes();
                categoryColumn.Width         = 200;
                if (dataschemaGrid.MasterTemplate.Columns.Contains("Type1"))
                {
                    dataschemaGrid.MasterTemplate.Columns.Remove("Type1");
                }
                dataschemaGrid.MasterTemplate.Columns.Add(categoryColumn);
                dataschemaGrid.Columns["ColumnName"].ReadOnly = true;
                dataschemaGrid.Columns["DataType"].ReadOnly   = true;
                dataschemaGrid.Columns["Type"].ReadOnly       = true;
                dataschemaGrid.Columns["Type"].IsVisible      = false;
                dataschemaGrid.Columns["Table"].IsVisible     = true;
                dataschemaGrid.Columns[0].Width = 200;
                // dataschemaGrid.Columns[1].AutoSizeMode = BestFitColumnMode.DisplayedDataCells;
                dataschemaGrid.Columns["DataType"].Width = 300;
                dataschemaGrid.Columns["Required"].Width = 50;
                dataschemaGrid.Columns["Table"].Width    = 30;
                dataschemaGrid.Columns.Remove("NumericPrecision");
                dataschemaGrid.Columns.Remove("NumericScale");
                dataschemaGrid.Columns.Remove("ProviderType");
                dataschemaGrid.Columns.Remove("IsLong");
                dataschemaGrid.Columns.Remove("AllowDBNull");
                dataschemaGrid.Columns.Remove("IsReadOnly");
                dataschemaGrid.Columns.Remove("IsUnique");
                dataschemaGrid.Columns.Remove("IsKey");
                dataschemaGrid.Columns.Remove("IsAutoIncrement");
                dataschemaGrid.Columns.Remove("IsRowVersion");
                dataschemaGrid.Columns.Remove("ColumnMapping");
                dataschemaGrid.Columns.Remove("AutoIncrementSeed");
                dataschemaGrid.Columns.Remove("AutoIncrementStep");
                dataschemaGrid.Columns.Remove("BaseCatalogName");
                dataschemaGrid.Columns.Remove("BaseSchemaName");
                dataschemaGrid.Columns.Remove("BaseTableName");
                dataschemaGrid.Columns.Remove("BaseTableNameSpace");
                dataschemaGrid.Columns.Remove("BaseColumnName");
                dataschemaGrid.Columns.Remove("BaseColumnNameSpace");
                dataschemaGrid.Columns.Remove("Expression");
                dataschemaGrid.Columns.Remove("DefaultValue");
                dataschemaGrid.Columns.Remove("ColumnOrdinal");
                dataschemaGrid.Columns.Remove("ColumnSize");
                dataschemaGrid.MasterTemplate.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
                //dataschemaGrid.MasterTemplate.BestFitColumns();
                dataschemaGrid.CellValueChanged += new GridViewCellEventHandler(dataschemaGrid_CellValueChanged);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #4
0
        void fnRunProject(int iProjectID)
        {
            try
            {
                Common.timePeriods.strtp1 = chkddlTP1.m_TextBox.Text.ToString().Split(';').ToArray();
                Common.timePeriods.strtp2 = cntrlchkDropDowntp2.m_TextBox.Text.ToString().Split(';').ToArray();
                int       TimePeriodId = clstreDetails.fnInsertTREtimePeriodfrmExport(Common.timePeriods.strtp1, Common.timePeriods.strtp2, Common.strTableName, Common.iProjectID);
                string    strColumns   = "";
                DataTable dtcol        = objDatsource.fnGetTreDetailsSchema(Common.strTableName);
                foreach (DataRow dr in dtcol.Rows)
                {
                    strColumns += dr[0].ToString();
                    strColumns += ",";
                }
                dtcol = objDatsource.fnGetCalaculatedColMappingData(Common.iProjectID, Common.strTableName);

                string strMainFilter = objDatsource.fnselectFilterCondition(Common.iProjectID);
                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);
                string strT1String = clstreDetails.fnBuildTimePeriod(Common.timePeriods.strtp1);
                string strT2String = clstreDetails.fnBuildTimePeriod(Common.timePeriods.strtp2);
                //Common.timePeriods.strtp1=
                if (objRanking.fnRankingcriteria(iProjectID).Rows.Count > 0)
                {
                    //if (InvokeRequired)
                    //{
                    //    this.Invoke(new Action(() => fnCheckExport(Common.iProjectID)));

                    if (fnCheckExport(Common.iProjectID))
                    {
                        // clstreDetails.fnDeleteTreOppfrmExport();

                        if (ClsObj.fnRunOPoortunitiesfrmExport(iProjectID, Common.strTableName, strT1String, strT2String, strMainFilter))
                        {
                            objRanking.fnMainRankingfrmExport(iProjectID);
                            objCampaigns.fnDelteCampaignRankingsfrmExport(Common.iProjectID, Common.strTableName);
                            DataTable dt = objExport.fnGetCampaigns(iProjectID);
                            if (dt.Rows.Count > 0)
                            {
                                //foreach (DataRow dr in dt.Rows)
                                //{
                                //    objCampaigns.fnSaveCampaignRankingsfrmExport(dr["ELIGIBILITY"].ToString(), Convert.ToInt16(dr["PROJECT_ID"]), dr["SEGMENT_DESCRIPTION"].ToString(), Convert.ToInt16(dr["CAMPAIGN_ID"]), Common.strTableName, strMainFilter);
                                //}

                                //CntrlOfferLibrary col = new CntrlOfferLibrary(0);
                                //string strPriorVal=col.getPriortiseVal();
                                string strPriorVal = "Avg_Ptnl";
                                int    iPriorVal   = 0;
                                if (strPriorVal == "Avg_Ptnl")
                                {
                                    iPriorVal = 1;
                                }
                                objCampaigns.fnSaveCampaignRankingsfrmExport(iPriorVal, Common.iProjectID, Common.strTableName, strMainFilter);

                                //objCampaigns.fnPrioritizeRankingsfrmExport(Common.iProjectID, "Average");
                                fnExport();
                            }
                            else
                            {
                                Telerik.WinControls.RadMessageBox.Show(this, "There are no campaigns to export", "", MessageBoxButtons.OK, RadMessageIcon.Error, MessageBoxDefaultButton.Button1);
                            }
                        }//
                    }


                    else
                    {
                        MessageBox.Show("Export Settings are not choosen");
                        return;
                    }
                    //}
                }
                else
                {
                    Telerik.WinControls.RadMessageBox.Show(this, "Ranking Criteria is not choosen for Selected Project", "Information", MessageBoxButtons.OK, RadMessageIcon.Error, MessageBoxDefaultButton.Button1);
                    return;
                }
            }
            catch (Exception ex)
            {
                alert.Close();
                MessageBox.Show(ex.Message);
            }
        }