Exemple #1
0
        private void btnOK_Click(object sender, System.EventArgs e)
        {
            this.DialogResult = DialogResult.OK;

            clsAbsorptionCoefficient_Find1 = new clsAbsorptionCoefficient_FindDetail();

            clsAbsorptionCoefficient_Find1.strName = edtName.Text;

            clsAbsorptionCoefficient_Find1.strAlpha = edtAlpha.Text;

            clsAbsorptionCoefficient_Find1.str400   = edt400.Text;
            clsAbsorptionCoefficient_Find1.str500   = edt500.Text;
            clsAbsorptionCoefficient_Find1.str630   = edt630.Text;
            clsAbsorptionCoefficient_Find1.str800   = edt800.Text;
            clsAbsorptionCoefficient_Find1.str1000  = edt1000.Text;
            clsAbsorptionCoefficient_Find1.str1250  = edt1250.Text;
            clsAbsorptionCoefficient_Find1.str1600  = edt1600.Text;
            clsAbsorptionCoefficient_Find1.str2000  = edt2000.Text;
            clsAbsorptionCoefficient_Find1.str3150  = edt3150.Text;
            clsAbsorptionCoefficient_Find1.str4000  = edt4000.Text;
            clsAbsorptionCoefficient_Find1.str5000  = edt5000.Text;
            clsAbsorptionCoefficient_Find1.str6300  = edt6300.Text;
            clsAbsorptionCoefficient_Find1.str8000  = edt8000.Text;
            clsAbsorptionCoefficient_Find1.str10000 = edt10000.Text;

            this.Close();
        }
        public void Search(string Category,string IncidenceCondition,string MaterialType,string Option,string Frequency,
			clsAbsorptionCoefficient_FindDetail clsAbsorptionCoefficient_RB,clsAbsorptionCoefficient_FindDetail clsAbsorptionCoefficient_AT,
			clsAbsorptionCoefficient_FindDetail clsAbsorptionCoefficient_TL,clsParameters clsParameters1,clsMultiLayer_Find clsMultiLayer_Find1,string strVendor,
			string strProducing,string strDate,int dMeasured)
        {
            string strIDs = "";
            bool bFlag = false;

            MD_DB MD_DB1 = new MD_DB();

            switch(Option)
            {
                case "Absorption coefficient-rigid backing":
                    dsSearchResult = MD_DB1.Search(Category,IncidenceCondition,MaterialType,Frequency,clsAbsorptionCoefficient_RB.strName,strVendor,strProducing,strDate,dMeasured);
                    strIDs = AbsorptionCoefficient_RigidBackingCheck(dsSearchResult,clsAbsorptionCoefficient_RB);
                    break;
                case "Absorption coefficient-anechoic termination":
                    dsSearchResult = MD_DB1.Search(Category,IncidenceCondition,MaterialType,Frequency,clsAbsorptionCoefficient_AT.strName,strVendor,strProducing,strDate,dMeasured);
                    strIDs = AbsorptionCoefficient_AnechoicTerminationCheck(dsSearchResult,clsAbsorptionCoefficient_AT);
                    break;
                case "Transmission Loss":
                    dsSearchResult = MD_DB1.Search(Category,IncidenceCondition,MaterialType,Frequency,clsAbsorptionCoefficient_TL.strName,strVendor,strProducing,strDate,dMeasured);
                    strIDs = TransmissionLossCheck(dsSearchResult,clsAbsorptionCoefficient_TL);
                    break;
                case "Parameters":
                    dsSearchResult = MD_DB1.Search(Category,IncidenceCondition,MaterialType,Frequency,clsParameters1.strName,strVendor,strProducing,strDate,dMeasured);
                    strIDs = ParametersCheck(dsSearchResult,clsParameters1);

                    pSeries_Search = null;
                    break;
                case "MultiLayer":
                    dsSearchResult = MD_DB1.Search("Multi",IncidenceCondition,MaterialType,Frequency,"",strVendor,strProducing,strDate,dMeasured);
                    Category = "Multi";
                    strIDs = MultiLayerCheck(dsSearchResult,clsMultiLayer_Find1.strName,clsMultiLayer_Find1.strTotalThick);
                    bFlag = true;

                    pSeries_Search = null;
                    break;
                case "Select":
                    dsSearchResult = MD_DB1.Search(Category,IncidenceCondition,MaterialType,Frequency,"",strVendor,strProducing,strDate,dMeasured);
                    bFlag = true;

                    pSeries_Search = null;
                    break;
            }
            if(bFlag == false)
            {
                dsSearchResult = MD_DB1.Search_IDs(Category,strIDs);
            }

            strSingle_Multi = Category;

            lstSearchResultList.Items.Clear();

            if(dsSearchResult != null)
            {
                if(Category != "Single")
                {
                    MultiListSetting();
                }
                else
                {
                    SearchResultList_Init();

                    MeterialTypeChange(this.strMeterialTypeChange);
                }

                for(int i = 0 ; i < dsSearchResult.Tables[0].Rows.Count ; i++)
                {
                    ListViewItem item = new ListViewItem();

                    if(Category == "Single")
                    {
                        item.SubItems[0].Text = dsSearchResult.Tables[0].Rows[i]["SID"].ToString();

                        item.SubItems.Add(dsSearchResult.Tables[0].Rows[i]["Name"].ToString());
                        item.SubItems.Add(dsSearchResult.Tables[0].Rows[i]["Thick"].ToString());
                        item.SubItems.Add(dsSearchResult.Tables[0].Rows[i]["BulkDens"].ToString());
                        item.SubItems.Add(dsSearchResult.Tables[0].Rows[i]["LossFactor"].ToString());
                        item.SubItems.Add(dsSearchResult.Tables[0].Rows[i]["FlowRes"].ToString());
                        item.SubItems.Add(dsSearchResult.Tables[0].Rows[i]["Ymodulus"].ToString());
                        item.SubItems.Add(dsSearchResult.Tables[0].Rows[i]["PoissionR"].ToString());
                        item.SubItems.Add(dsSearchResult.Tables[0].Rows[i]["ThermalCL"].ToString());
                        item.SubItems.Add(dsSearchResult.Tables[0].Rows[i]["ViscousCL"].ToString());
                        item.SubItems.Add(dsSearchResult.Tables[0].Rows[i]["Prosity"].ToString());
                        item.SubItems.Add(dsSearchResult.Tables[0].Rows[i]["Sfactor"].ToString());
                        item.SubItems.Add(dsSearchResult.Tables[0].Rows[i]["EmP1"].ToString());
                        item.SubItems.Add(dsSearchResult.Tables[0].Rows[i]["PRatioP1"].ToString());
                        item.SubItems.Add(dsSearchResult.Tables[0].Rows[i]["DensityP1"].ToString());
                        item.SubItems.Add(dsSearchResult.Tables[0].Rows[i]["EmP2"].ToString());
                        item.SubItems.Add(dsSearchResult.Tables[0].Rows[i]["HP2"].ToString());
                        item.SubItems.Add(dsSearchResult.Tables[0].Rows[i]["HP2"].ToString());
                        item.SubItems.Add(dsSearchResult.Tables[0].Rows[i]["HP1"].ToString());
                        item.SubItems.Add(dsSearchResult.Tables[0].Rows[i]["PRatioP2"].ToString());
                        item.SubItems.Add(dsSearchResult.Tables[0].Rows[i]["MID"].ToString());

                        bIsSingle = true;
                    }
                    else
                    {
                        item.SubItems[0].Text = dsSearchResult.Tables[0].Rows[i]["LID"].ToString();

                        item.SubItems.Add(dsSearchResult.Tables[0].Rows[i]["MultiLayer.Name"].ToString());
                        item.SubItems.Add(dsSearchResult.Tables[0].Rows[i]["TotalThick"].ToString());

                        bIsSingle = false;
                    }

                    lstSearchResultList.Items.Add(item);

                    //strSearchResult_Selected_ID = item.SubItems[0].Text;
                }
            }

            if(dsSearchResult == null || dsSearchResult.Tables[0].Rows.Count == 0)
            {
                MessageBox.Show("�˻� ����� �����ϴ�");
            }

            pnlGraphOption.Enabled = false;
            pnlGraphOption2.Enabled = false;
        }
        private void btnOK_Click(object sender, System.EventArgs e)
        {
            this.DialogResult = DialogResult.OK;

            clsAbsorptionCoefficient_Find1 = new clsAbsorptionCoefficient_FindDetail();

            clsAbsorptionCoefficient_Find1.strName = edtName.Text;

            clsAbsorptionCoefficient_Find1.strAlpha = edtAlpha.Text;

            clsAbsorptionCoefficient_Find1.str400 = edt400.Text;
            clsAbsorptionCoefficient_Find1.str500 = edt500.Text;
            clsAbsorptionCoefficient_Find1.str630 = edt630.Text;
            clsAbsorptionCoefficient_Find1.str800 = edt800.Text;
            clsAbsorptionCoefficient_Find1.str1000 = edt1000.Text;
            clsAbsorptionCoefficient_Find1.str1250 = edt1250.Text;
            clsAbsorptionCoefficient_Find1.str1600 = edt1600.Text;
            clsAbsorptionCoefficient_Find1.str2000 = edt2000.Text;
            clsAbsorptionCoefficient_Find1.str3150 = edt3150.Text;
            clsAbsorptionCoefficient_Find1.str4000 = edt4000.Text;
            clsAbsorptionCoefficient_Find1.str5000 = edt5000.Text;
            clsAbsorptionCoefficient_Find1.str6300 = edt6300.Text;
            clsAbsorptionCoefficient_Find1.str8000 = edt8000.Text;
            clsAbsorptionCoefficient_Find1.str10000 = edt10000.Text;

            this.Close();
        }
        private string TransmissionLossCheck(DataSet ds,clsAbsorptionCoefficient_FindDetail cls)
        {
            string strIDs = "";
            string strFreq = "";
            string strY = "";
            string [] arrFreq;
            string [] arrY;

            string Y_400 = "";
            string Y_500 = "";
            string Y_630 = "";
            string Y_800 = "";
            string Y_1000 = "";
            string Y_1250 = "";
            string Y_1600 = "";
            string Y_2000 = "";
            string Y_3150 = "";
            string Y_4000 = "";
            string Y_5000 = "";
            string Y_6300 = "";
            string Y_8000 = "";
            string Y_10000 = "";

            pSeries_Search = new DataPlotter.DataSeries();
            double [] dimdf_X = new double[14];
            double [] dimdf_Y = new double[14];

            pSeries_Search.Color = Color.SkyBlue;
            pSeries_Search.Name = "Search Axis";

            for(int i = 0 ; i < ds.Tables[0].Rows.Count ; i++)
            {
                bool bResult = true;

                strFreq = ds.Tables[0].Rows[i]["X_Axis"].ToString();
                strY = ds.Tables[0].Rows[i]["Y_TransmissionLoss"].ToString();
                if(strFreq != "" && strY != "")
                {
                    arrFreq = strFreq.Split(",".ToCharArray());
                    arrY = strY.Split(",".ToCharArray());

                    if(arrFreq.Length == arrY.Length)
                    {
                        for(int j = 0 ; j < arrFreq.Length ; j++)
                        {
                            #region DB ���� �� ���ļ����� Y �� ������ ����
                            switch(arrFreq[j].ToString())
                            {
                                case "400" :
                                    Y_400 = arrY[j].ToString();
                                    break;
                                case "500" :
                                    Y_500 = arrY[j].ToString();
                                    break;
                                case "630" :
                                    Y_630 = arrY[j].ToString();
                                    break;
                                case "800" :
                                    Y_800 = arrY[j].ToString();
                                    break;
                                case "1000" :
                                    Y_1000 = arrY[j].ToString();
                                    break;
                                case "1250" :
                                    Y_1250 = arrY[j].ToString();
                                    break;
                                case "1600" :
                                    Y_1600 = arrY[j].ToString();
                                    break;
                                case "2000" :
                                    Y_2000 = arrY[j].ToString();
                                    break;
                                case "3150" :
                                    Y_3150 = arrY[j].ToString();
                                    break;
                                case "4000" :
                                    Y_4000 = arrY[j].ToString();
                                    break;
                                case "5000" :
                                    Y_5000 = arrY[j].ToString();
                                    break;
                                case "6300" :
                                    Y_6300 = arrY[j].ToString();
                                    break;
                                case "8000" :
                                    Y_8000 = arrY[j].ToString();
                                    break;
                                case "10000" :
                                    Y_10000 = arrY[j].ToString();
                                    break;
                            }
                            #endregion
                        }

                        #region ������ ����� üũ ������ ���� �ʴ°� �ϳ��� ������ false
                        double temp_cls = 0.0;
                        double temp_db = 0.0;

                        if(cls.str400 != "")
                        {
                            if(cls.strAlpha == "")
                            {
                                temp_cls = double.Parse(cls.str400);
                            }
                            else
                            {
                                temp_cls = double.Parse(cls.strAlpha);
                                temp_cls = Math.Log10(400) + temp_cls;
                            }

                            temp_db = double.Parse(Y_400);
                            if(temp_cls > temp_db)
                            {
                                bResult = false;
                            }

                            dimdf_X[0] = 400;
                            dimdf_Y[0] = temp_cls;
                        }
                        if(cls.str500 != "")
                        {
                            if(cls.strAlpha == "")
                            {
                                temp_cls = double.Parse(cls.str500);
                            }
                            else
                            {
                                temp_cls = double.Parse(cls.strAlpha);
                                temp_cls = Math.Log10(500) + temp_cls;
                            }

                            temp_db = double.Parse(Y_500);
                            if(temp_cls > temp_db)
                            {
                                bResult = false;
                            }

                            dimdf_X[1] = 500;
                            dimdf_Y[1] = temp_cls;
                        }
                        if(cls.str630 != "")
                        {
                            if(cls.strAlpha == "")
                            {
                                temp_cls = double.Parse(cls.str630);
                            }
                            else
                            {
                                temp_cls = double.Parse(cls.strAlpha);
                                temp_cls = Math.Log10(630) + temp_cls;
                            }

                            temp_db = double.Parse(Y_630);
                            if(temp_cls > temp_db)
                            {
                                bResult = false;
                            }

                            dimdf_X[2] = 630;
                            dimdf_Y[2] = temp_cls;
                        }
                        if(cls.str800 != "")
                        {
                            if(cls.strAlpha == "")
                            {
                                temp_cls = double.Parse(cls.str800);
                            }
                            else
                            {
                                temp_cls = double.Parse(cls.strAlpha);
                                temp_cls = Math.Log10(800) + temp_cls;
                            }

                            temp_db = double.Parse(Y_800);
                            if(temp_cls > temp_db)
                            {
                                bResult = false;
                            }

                            dimdf_X[3] = 800;
                            dimdf_Y[3] = temp_cls;
                        }
                        if(cls.str1000 != "")
                        {
                            if(cls.strAlpha == "")
                            {
                                temp_cls = double.Parse(cls.str1000);
                            }
                            else
                            {
                                temp_cls = double.Parse(cls.strAlpha);
                                temp_cls = Math.Log10(1000) + temp_cls;
                            }

                            temp_db = double.Parse(Y_1000);
                            if(temp_cls > temp_db)
                            {
                                bResult = false;
                            }

                            dimdf_X[4] = 1000;
                            dimdf_Y[4] = temp_cls;
                        }
                        if(cls.str1250 != "")
                        {
                            if(cls.strAlpha == "")
                            {
                                temp_cls = double.Parse(cls.str1250);
                            }
                            else
                            {
                                temp_cls = double.Parse(cls.strAlpha);
                                temp_cls = Math.Log10(1250) + temp_cls;
                            }

                            temp_db = double.Parse(Y_1250);
                            if(temp_cls > temp_db)
                            {
                                bResult = false;
                            }

                            dimdf_X[5] = 1250;
                            dimdf_Y[5] = temp_cls;
                        }
                        if(cls.str1600 != "")
                        {
                            if(cls.strAlpha == "")
                            {
                                temp_cls = double.Parse(cls.str1600);
                            }
                            else
                            {
                                temp_cls = double.Parse(cls.strAlpha);
                                temp_cls = Math.Log10(1600) + temp_cls;
                            }

                            temp_db = double.Parse(Y_1600);
                            if(temp_cls > temp_db)
                            {
                                bResult = false;
                            }

                            dimdf_X[6] = 1600;
                            dimdf_Y[6] = temp_cls;
                        }
                        if(cls.str2000 != "")
                        {
                            if(cls.strAlpha == "")
                            {
                                temp_cls = double.Parse(cls.str2000);
                            }
                            else
                            {
                                temp_cls = double.Parse(cls.strAlpha);
                                temp_cls = Math.Log10(2000) + temp_cls;
                            }

                            temp_db = double.Parse(Y_2000);
                            if(temp_cls > temp_db)
                            {
                                bResult = false;
                            }

                            dimdf_X[7] = 2000;
                            dimdf_Y[7] = temp_cls;
                        }
                        if(cls.str3150 != "")
                        {
                            if(cls.strAlpha == "")
                            {
                                temp_cls = double.Parse(cls.str3150);
                            }
                            else
                            {
                                temp_cls = double.Parse(cls.strAlpha);
                                temp_cls = Math.Log10(3150) + temp_cls;
                            }

                            temp_db = double.Parse(Y_3150);
                            if(temp_cls > temp_db)
                            {
                                bResult = false;
                            }

                            dimdf_X[8] = 3150;
                            dimdf_Y[8] = temp_cls;
                        }
                        if(cls.str4000 != "")
                        {
                            if(cls.strAlpha == "")
                            {
                                temp_cls = double.Parse(cls.str4000);
                            }
                            else
                            {
                                temp_cls = double.Parse(cls.strAlpha);
                                temp_cls = Math.Log10(4000) + temp_cls;
                            }

                            temp_db = double.Parse(Y_4000);
                            if(temp_cls > temp_db)
                            {
                                bResult = false;
                            }

                            dimdf_X[9] = 4000;
                            dimdf_Y[9] = temp_cls;
                        }
                        if(cls.str5000 != "")
                        {
                            if(cls.strAlpha == "")
                            {
                                temp_cls = double.Parse(cls.str5000);
                            }
                            else
                            {
                                temp_cls = double.Parse(cls.strAlpha);
                                temp_cls = Math.Log10(5000) + temp_cls;
                            }

                            temp_db = double.Parse(Y_5000);
                            if(temp_cls > temp_db)
                            {
                                bResult = false;
                            }

                            dimdf_X[10] = 5000;
                            dimdf_Y[10] = temp_cls;
                        }
                        if(cls.str6300 != "")
                        {
                            if(cls.strAlpha == "")
                            {
                                temp_cls = double.Parse(cls.str6300);
                            }
                            else
                            {
                                temp_cls = double.Parse(cls.strAlpha);
                                temp_cls = Math.Log10(6300) + temp_cls;
                            }

                            temp_db = double.Parse(Y_6300);
                            if(temp_cls > temp_db)
                            {
                                bResult = false;
                            }

                            dimdf_X[11] = 6300;
                            dimdf_Y[11] = temp_cls;
                        }
                        if(cls.str8000 != "")
                        {
                            if(cls.strAlpha == "")
                            {
                                temp_cls = double.Parse(cls.str8000);
                            }
                            else
                            {
                                temp_cls = double.Parse(cls.strAlpha);
                                temp_cls = Math.Log10(8000) + temp_cls;
                            }

                            temp_db = double.Parse(Y_8000);
                            if(temp_cls > temp_db)
                            {
                                bResult = false;
                            }

                            dimdf_X[12] = 8000;
                            dimdf_Y[12] = temp_cls;
                        }
                        if(cls.str10000 != "")
                        {
                            if(cls.strAlpha == "")
                            {
                                temp_cls = double.Parse(cls.str10000);
                            }
                            else
                            {
                                temp_cls = double.Parse(cls.strAlpha);
                                temp_cls = Math.Log10(10000) + temp_cls;
                            }

                            temp_db = double.Parse(Y_10000);
                            if(temp_cls > temp_db)
                            {
                                bResult = false;
                            }

                            dimdf_X[13] = 10000;
                            dimdf_Y[13] = temp_cls;
                        }
                        #endregion
                    }
                    else
                    {
                        bResult = false;
                    }
                }
                else
                {
                    bResult = false;
                }

                if(bResult == true) // ���ǿ� �����ϸ�ID �� �߰��Ѵ�
                {
                    strIDs = strIDs + ds.Tables[0].Rows[i]["SGID"].ToString() + ",";
                }
            }

            if(strIDs != "")
            {
                strIDs = strIDs.Substring(0,strIDs.Length - 1);
            }

            pSeries_Search.XData = dimdf_X;
            pSeries_Search.YData = dimdf_Y;

            return strIDs;
        }