DeleteChart() public method

public DeleteChart ( string chartID ) : void
chartID string
return void
示例#1
0
        public void deleteChartAndItsContent(string chartID1, string chart_resp_nodeid, string chart_resp_lineID)
        {
            //if (dataGridView1.CurrentCell.RowIndex > -1 && dataGridView1.CurrentCell.RowIndex < f1.chartDetailList.Count)//Header is selected..
            if (chartID1 != "" && chart_resp_nodeid != "" && chart_resp_lineID != "")//Header is selected..
            {
                //int selectedItemIndex = index;//dataGridView1.CurrentCell.RowIndex; //int.Parse(dataGridView1.Rows[indexSelectedForDeletion].Cells[0].Value.ToString());

                //we need to find the corresponding tables for deletion.

                //int id = selectedItemIndex;

                string chartID = chartID1;                           //f1.chartDetailList[selectedItemIndex].chartID;
                string chart_respective_node_ID = chart_resp_nodeid; //f1.chartDetailList[selectedItemIndex].chart_respective_nodeID;
                string chart_respective_line_ID = chart_resp_lineID; //f1.chartDetailList[selectedItemIndex].chart_respective_lineID;
                //First read the node values for particular chart
                f1.ReadNodeInfoToDelete(chart_respective_node_ID);

                //For all node delete the device list
                if (f1.deleteNodeDetailList.Count > 0)
                {
                    //if there is data then delete the device infor
                    foreach (var item in f1.deleteNodeDetailList)
                    {
                        if ((item.temperature_source == "Device") || (item.humidity_source == "Device"))
                        {
                            f1.DeleteNodeDeviceInfo(item.id);
                        }
                    }
                }

                //After this deletion lets delete the line info
                f1.DeleteLine(chart_respective_line_ID);//This deletes the line

                //now delete comfort zone..
                f1.DeleteComfortZoneSettingForChart(chartID);

                //now delete the node value
                f1.DeleteNode(chart_respective_node_ID);

                //Delete the mix node info
                f1.DeleteMixNodeInfo(chartID);

                //Now delete the chart itself
                f1.DeleteChart(chartID);
            }//Close of if
        }