Esempio n. 1
0
        /// <summary>
        /// Save data to ROLLUP_CONTROL
        /// </summary>
        /// <returns></returns>
        private bool SaveSegmentRollup()
        {
            List <RollupSegmentObject> listRollupSegment = new List <RollupSegmentObject>();

            foreach (DataGridViewRow row in dgvSegmentRollup.Rows)
            {
                RollupSegmentObject rollupSegment = new RollupSegmentObject();
                rollupSegment.Attribute     = row.Cells[0].Value.ToString();
                rollupSegment.RollupMethod  = row.Cells[1].Value.ToString();
                rollupSegment.SegmentMethod = row.Cells[2].Value.ToString();
                listRollupSegment.Add(rollupSegment);
            }

            try
            {
                GlobalDatabaseOperations.SetSegmentRollup(listRollupSegment, Network.NetworkID);
            }
            catch (Exception except)
            {
                OutputWindow.WriteOutput("Error: Updating ROLLUP_CONTROL table. " + except.Message);
                return(false);
            }
            if (!CreateDynamicSegmentation(listRollupSegment))
            {
                return(false);
            }

            return(true);
        }
Esempio n. 2
0
        /// <summary>
        /// Add all non-blank Segment Criteria for a given NETWORK. For IMAGEVIEW.  (USE TRY/CATCH)
        /// </summary>
        /// <param name="strNetworkID"></param>
        /// <param name="rollupSegment"></param>
        public static void SaveCriteriaSegmentForNetwork(String strNetworkID, RollupSegmentObject rollupSegment)
        {
            String strMethod = "";

            if (rollupSegment.SegmentMethod == " Any Record")
            {
                strMethod = "Anyrecord";
            }
            else
            {
                strMethod = "Anychange";
            }

            String strFamilyName = rollupSegment.Attribute + "_" + strNetworkID + "_" + rollupSegment.SegmentMethod;

            String strInsert = "INSERT INTO CRITERIA_SEGMENT (NETWORKID, FAMILY_NAME, FAMILY_EXPRESSION) VALUES ('" + strNetworkID + "','" + strFamilyName + "','" + strMethod.ToUpper() + "[" + rollupSegment.Attribute + "]')";

            DBMgr.ExecuteNonQuery(strInsert);

            strInsert = "INSERT INTO NETWORK_TREE (NETWORKID,NODES) VALUES('" + strNetworkID + "','" + strFamilyName + "')";
            DBMgr.ExecuteNonQuery(strInsert);
        }
Esempio n. 3
0
        private void LoadGridViewAttributes()
        {
            m_bUpdate = false;
            dgvSegmentRollup.Rows.Clear();
            List <AttributeObject>     listAttribute = null;
            List <RollupSegmentObject> listRollup    = null;

            try
            {
                listAttribute = GlobalDatabaseOperations.GetAttributes();
            }
            catch (Exception except)
            {
                OutputWindow.WriteOutput("Error: Loading ATTRIBUTE table. " + except.Message);
                return;
            }

            try
            {
                listRollup = GlobalDatabaseOperations.GetSegmentRollup(this.Network.NetworkID);
            }
            catch (Exception except)
            {
                OutputWindow.WriteOutput("Error: Loading ROLLUP_CONTROL table. " + except.Message);
                return;
            }



            foreach (AttributeObject attribute in listAttribute)
            {
                if (attribute.Calculated == false)
                {
                    int nRow = dgvSegmentRollup.Rows.Add(attribute.Attribute);
                    DataGridViewComboBoxCell combo = (DataGridViewComboBoxCell)dgvSegmentRollup[1, nRow];
                    dgvSegmentRollup.Rows[nRow].Cells[0].ReadOnly = true;
                    if (attribute.Type == "NUMBER")
                    {
                        combo.Items.Add("None");
                        combo.Items.Add("Average");
                        combo.Items.Add("Predominant");
                        combo.Items.Add("Median");
                        combo.Items.Add("Maximum");
                        combo.Items.Add("Minimum");
                        combo.Items.Add("Median");
                        combo.Items.Add("Absolute Maximum");
                        combo.Items.Add("Absolute Minimum");
                        combo.Items.Add("Standard Deviation");
                        combo.Items.Add("Sum");
                    }
                    else
                    {
                        combo.Items.Add("None");
                        combo.Items.Add("Average");
                        combo.Items.Add("Predominant");
                    }

                    RollupSegmentObject rollup = listRollup.Find(delegate(RollupSegmentObject rso) { return(rso.Attribute == attribute.Attribute); });
                    if (rollup != null)
                    {
                        dgvSegmentRollup.Rows[nRow].Cells[1].Value = rollup.RollupMethod;
                        dgvSegmentRollup.Rows[nRow].Cells[2].Value = rollup.SegmentMethod;
                    }
                    else
                    {
                        if (attribute.Type == "STRING")
                        {
                            dgvSegmentRollup.Rows[nRow].Cells[1].Value = "Predominant";
                        }
                        else
                        {
                            dgvSegmentRollup.Rows[nRow].Cells[1].Value = "Average";
                        }
                        dgvSegmentRollup.Rows[nRow].Cells[2].Value = "-";
                    }
                }
            }
            m_bUpdate = true;
        }