Example #1
0
        private void save()
        {
            gvWeather.Focus();
            Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;

            //ed.WriteMessage("EnterSave"+"\n");
            Atend.Base.Design.DWeather weather = new Atend.Base.Design.DWeather();
            for (int i = 0; i < gvWeather.Rows.Count; i++)
            {
                //ed.WriteMessage("i: "+i.ToString() + "\n");
                //ed.WriteMessage("Cells[0]:" + gvWeather.Rows[i].Cells[0].Value.ToString() + "\n");
                weather.Code        = Convert.ToInt32(gvWeather.Rows[i].Cells[0].Value.ToString());
                weather.Temp        = Convert.ToDouble(gvWeather.Rows[i].Cells["Column3"].Value.ToString());
                weather.WindSpeed   = Convert.ToDouble(gvWeather.Rows[i].Cells["Column5"].Value.ToString());
                weather.IceDiagonal = Convert.ToDouble(gvWeather.Rows[i].Cells["Column4"].Value.ToString());
                weather.SaftyFactor = Convert.ToDouble(gvWeather.Rows[i].Cells["Column6"].Value.ToString());;

                //
                if (weather.AccessUpdate())
                {
                    ed.WriteMessage("اطلاعات به درستی به روز رسانی شد");
                }
                else
                {
                    //ed.WriteMessage("اطلاعات به درستی به روز رسانی نشد");
                }
            }
        }
Example #2
0
        //***********************WithOutHalter***********************


        //******************************EndOfCalcHalter*****************************


        public double ComputeTotalWeight(Atend.Base.Design.DWeather weather)
        {
            Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
            //Atend.Base.Equipment.EConductor conductor = Atend.Base.Equipment.EConductor.SelectByCode(cond.ProductCode);


            //ed.WriteMessage("#Weather.Code = " +weather.Code.ToString() + "\n");

            double iceWeight   = Math.Round(913 * Math.PI * weather.IceDiagonal * (weather.IceDiagonal + Atend.Global.Calculation.Mechanical.CCommon.Diagonal) * 1e-6, 2);     //Wic=913*3.14*i[i+d]*1e-6
            double windWeight  = Math.Round(Math.Pow(weather.WindSpeed, 2) / 16 * (Atend.Global.Calculation.Mechanical.CCommon.Diagonal + 2 * weather.IceDiagonal) * 1e-3, 2); //Ww=v^2/16*(d+2i)*10^-3
            double totalWeight = Math.Round(Math.Sqrt(Math.Pow(Atend.Global.Calculation.Mechanical.CCommon.WC + iceWeight, 2) + Math.Pow(windWeight, 2)), 2);

            //ed.WriteMessage("###IceWeight= " + iceWeight.ToString() + "\n");
            //ed.WriteMessage("##WindWeight= " + windWeight.ToString() + "\n");
            // ed.WriteMessage("#TotalWeight= " + totalWeight.ToString() + "\n");
            return(totalWeight);
        }
Example #3
0
        public double ComputeTension(Atend.Base.Design.DWeather baseCase, double temp,
                                     double baseH, double baseSpan)
        {
            //ed.WriteMessage("BaseCAse= " + baseCase.Code +" Span= "+baseSpan+" BaseH ="+baseH+ "\n");
            //ed.WriteMessage("CrossSectionAre= " + conductorSection.CrossSectionArea + " Alastisity= " + conductorSection.Alasticity + "Alpha= "+conductorSection.Alpha+" Temp= "+temp+ "\n");

            double baseTotalWeight = ComputeTotalWeight(baseCase);
            //ed.WriteMessage("BaseToTalWeight= " + baseTotalWeight.ToString() + "\n");
            double k1 = (Atend.Global.Calculation.Mechanical.CCommon.CrossSectionArea * Atend.Global.Calculation.Mechanical.CCommon.Alasticity * Math.Pow(baseSpan, 2) * Math.Pow(baseTotalWeight, 2)) /
                        (24 * Math.Pow(baseH, 2)) - baseH;
            // ed.WriteMessage("K1= " + k1.ToString() + "\n");
            double k2 = k1 + Atend.Global.Calculation.Mechanical.CCommon.Alpha * Atend.Global.Calculation.Mechanical.CCommon.CrossSectionArea * Atend.Global.Calculation.Mechanical.CCommon.Alasticity *
                        (temp - baseCase.Temp);
            //ed.WriteMessage("K2=" + k2.ToString() + "\n");
            double totalWeight = ComputeTotalWeight(baseCase);

            double k3 = (Atend.Global.Calculation.Mechanical.CCommon.CrossSectionArea * Atend.Global.Calculation.Mechanical.CCommon.Alasticity * Math.Pow(baseSpan, 2) * Math.Pow(totalWeight, 2)) / 24;
            //ed.WriteMessage("K3= " + k3.ToString() + "\n");
            double H = findBiggestRealRoot(1, k2, 0, -k3, baseH, 0.1);

            //ed.WriteMessage("H= " + H.ToString() + "\n");
            return(H);
        }
Example #4
0
        private void frmWeather_Load(object sender, EventArgs e)
        {
            if (ForceToClose)
            {
                this.Close();
            }
            Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;

            if (Atend.Control.Common.userCode != 0 && Atend.Control.Common.DesignName != "")
            {
                gvWeather.AutoGenerateColumns = false;

                string[] Type = { "فوق سنگین", "سنگین", "متوسط", "سبک" };
                cboweatherType.DisplayMember = "Name";
                cboweatherType.ValueMember   = "Code";
                //DataTable dtWeatherType = Atend.Base.Design.DWeatherType.SelectByDesignCode(Atend.Control.Common.SelectedDesignCode);
                DataTable dtWeatherType = Atend.Base.Design.DWeatherType.AccessSelectAll();

                if (dtWeatherType.Rows.Count != 0)
                {
                    cboweatherType.DataSource = dtWeatherType;
                    foreach (DataRow dr in dtWeatherType.Rows)
                    {
                        if (Convert.ToBoolean(dr["IsSelected"].ToString()) == true)
                        {
                            cboweatherType.SelectedValue = Convert.ToInt32(dr["Code"].ToString());
                        }
                    }
                }
                else
                {
                    //ed.WriteMessage("Build WeatherType\n");
                    Atend.Base.Design.DWeatherType weatherType = new Atend.Base.Design.DWeatherType();
                    for (int i = 0; i < Type.Length; i++)
                    {
                        //***Extra
                        //weatherType.DesignCode = Atend.Control.Common.SelectedDesignCode;
                        if (i == 2)
                        {
                            weatherType.IsSelected = true;//true
                        }
                        else
                        {
                            weatherType.IsSelected = false;//false
                        }
                        weatherType.Name = Type[i];
                        weatherType.Accessinsert();
                    }
                    //DataTable dt = Atend.Base.Design.DWeatherType.AccessSelectAll();

                    //ed.WriteMessage("Rows.count={0},NAme={1},Code={2}\n", dt.Rows.Count, dt.Rows[0]["Name"].ToString(),dt.Rows[0]["Code"].ToString());
                    cboweatherType.DataSource = Atend.Base.Design.DWeatherType.AccessSelectAll();
                }
                //ed.WriteMessage("SelectWeather\n");
                DataTable selectweather = Atend.Base.Design.DWeather.AccessSelectByType(Convert.ToInt32(cboweatherType.SelectedValue));
                //ed.WriteMessage("ASfterSelectWeather\n");

                if (selectweather.Rows.Count == 0)
                {
                    //ed.WriteMessage("A\n");
                    Atend.Base.Design.DWeather dWeather = new Atend.Base.Design.DWeather();
                    //ed.WriteMessage("AA\n");

                    DataTable dtWeatherCondition = Atend.Base.Design.DWeatherConditionType.AccessSelectAll();


                    foreach (DataRow dr in dtWeatherCondition.Rows)
                    {
                        for (int i = 0; i < cboweatherType.Items.Count; i++)
                        {
                            cboweatherType.SelectedIndex = i;
                            #region FogheSangin
                            if (i == 0)
                            {
                                switch (Convert.ToInt32(dr["Code"]))
                                {
                                case 1:
                                {
                                    dWeather.ConditionCode = Convert.ToByte(dr["Code"].ToString());
                                    //ed.WriteMessage("Code1:" + dr["Code"].ToString() + "\n");
                                    dWeather.IceDiagonal = 0;
                                    //ed.WriteMessage("dWeather.IceDiagonal " + "\n");
                                    dWeather.SaftyFactor = 10;
                                    //ed.WriteMessage("dWeather.SaftyFactor " + "\n");

                                    dWeather.Temp = 18;
                                    //ed.WriteMessage("dWeather.Temp " + "\n");
                                    //ed.WriteMessage("CBO:" + cboweatherType.ValueMember[i].ToString() + "\n");
                                    dWeather.TypeCode  = Convert.ToInt32(cboweatherType.SelectedValue.ToString());
                                    dWeather.WindSpeed = 0;
                                    dWeather.AccessInsert();
                                    break;
                                }

                                case 2:
                                {
                                    dWeather.ConditionCode = Convert.ToByte(dr["Code"].ToString());
                                    //ed.WriteMessage("Code2:" + dr["Code"].ToString() + "\n");
                                    dWeather.IceDiagonal = 30;
                                    //ed.WriteMessage("dWeather.IceDiagonal " + "\n");
                                    dWeather.SaftyFactor = 3;
                                    //ed.WriteMessage("dWeather.SaftyFactor " + "\n");

                                    dWeather.Temp = -5;
                                    //ed.WriteMessage("dWeather.Temp " + "\n");
                                    //ed.WriteMessage("CBO:" + cboweatherType.ValueMember[i].ToString() + "\n");
                                    dWeather.TypeCode  = Convert.ToInt32(cboweatherType.SelectedValue.ToString());
                                    dWeather.WindSpeed = 0;
                                    dWeather.AccessInsert();
                                    break;
                                }

                                case 3:
                                {
                                    dWeather.ConditionCode = Convert.ToByte(dr["Code"].ToString());
                                    //ed.WriteMessage("Code:" + dr["Code"].ToString() + "\n");
                                    dWeather.IceDiagonal = 0;
                                    //ed.WriteMessage("dWeather.IceDiagonal " + "\n");
                                    dWeather.SaftyFactor = 3;
                                    //ed.WriteMessage("dWeather.SaftyFactor " + "\n");

                                    dWeather.Temp = 15;
                                    //ed.WriteMessage("dWeather.Temp " + "\n");
                                    //ed.WriteMessage("CBO:" + cboweatherType.ValueMember[i].ToString() + "\n");
                                    dWeather.TypeCode  = Convert.ToInt32(cboweatherType.SelectedValue.ToString());
                                    dWeather.WindSpeed = 40;
                                    dWeather.AccessInsert();
                                    break;
                                }

                                case 4:
                                {
                                    dWeather.ConditionCode = Convert.ToByte(dr["Code"].ToString());
                                    //ed.WriteMessage("Code:" + dr["Code"].ToString() + "\n");
                                    dWeather.IceDiagonal = 0;
                                    //ed.WriteMessage("dWeather.IceDiagonal " + "\n");
                                    dWeather.SaftyFactor = 5;
                                    //ed.WriteMessage("dWeather.SaftyFactor " + "\n");

                                    dWeather.Temp = 35;
                                    //ed.WriteMessage("dWeather.Temp " + "\n");
                                    //ed.WriteMessage("CBO:" + cboweatherType.ValueMember[i].ToString() + "\n");
                                    dWeather.TypeCode  = Convert.ToInt32(cboweatherType.SelectedValue.ToString());
                                    dWeather.WindSpeed = 0;
                                    dWeather.AccessInsert();
                                    break;
                                }

                                case 5:
                                {
                                    dWeather.ConditionCode = Convert.ToByte(dr["Code"].ToString());
                                    //ed.WriteMessage("Code:" + dr["Code"].ToString() + "\n");
                                    dWeather.IceDiagonal = 0;
                                    //ed.WriteMessage("dWeather.IceDiagonal " + "\n");
                                    dWeather.SaftyFactor = 3;
                                    //ed.WriteMessage("dWeather.SaftyFactor " + "\n");

                                    dWeather.Temp = -30;
                                    //ed.WriteMessage("dWeather.Temp " + "\n");
                                    //ed.WriteMessage("CBO:" + cboweatherType.ValueMember[i].ToString() + "\n");
                                    dWeather.TypeCode  = Convert.ToInt32(cboweatherType.SelectedValue.ToString());
                                    dWeather.WindSpeed = 0;
                                    dWeather.AccessInsert();
                                    break;
                                }

                                case 6:
                                {
                                    dWeather.ConditionCode = Convert.ToByte(dr["Code"].ToString());
                                    //ed.WriteMessage("Code:" + dr["Code"].ToString() + "\n");
                                    dWeather.IceDiagonal = 0;
                                    //ed.WriteMessage("dWeather.IceDiagonal " + "\n");
                                    dWeather.SaftyFactor = 3;
                                    //ed.WriteMessage("dWeather.SaftyFactor " + "\n");

                                    dWeather.Temp = 35;
                                    ed.WriteMessage("dWeather.Temp " + "\n");
                                    //ed.WriteMessage("CBO:" + cboweatherType.ValueMember[i].ToString() + "\n");
                                    dWeather.TypeCode  = Convert.ToInt32(cboweatherType.SelectedValue.ToString());
                                    dWeather.WindSpeed = 0;
                                    dWeather.AccessInsert();
                                    break;
                                }
                                }
                            }
                            #endregion
                            #region sangin
                            if (i == 1)
                            {
                                switch (Convert.ToInt32(dr["Code"]))
                                {
                                case 1:
                                {
                                    dWeather.ConditionCode = Convert.ToByte(dr["Code"].ToString());
                                    //ed.WriteMessage("Code:" + dr["Code"].ToString() + "\n");
                                    dWeather.IceDiagonal = 0;
                                    //ed.WriteMessage("dWeather.IceDiagonal " + "\n");
                                    dWeather.SaftyFactor = 10;
                                    //ed.WriteMessage("dWeather.SaftyFactor " + "\n");

                                    dWeather.Temp = 18;
                                    //ed.WriteMessage("dWeather.Temp " + "\n");
                                    //ed.WriteMessage("CBO:" + cboweatherType.ValueMember[i].ToString() + "\n");
                                    dWeather.TypeCode  = Convert.ToInt32(cboweatherType.SelectedValue.ToString());
                                    dWeather.WindSpeed = 0;
                                    dWeather.AccessInsert();
                                    break;
                                }

                                case 2:
                                {
                                    dWeather.ConditionCode = Convert.ToByte(dr["Code"].ToString());
                                    //ed.WriteMessage("Code:" + dr["Code"].ToString() + "\n");
                                    dWeather.IceDiagonal = 20;
                                    //ed.WriteMessage("dWeather.IceDiagonal " + "\n");
                                    dWeather.SaftyFactor = 3;
                                    //ed.WriteMessage("dWeather.SaftyFactor " + "\n");

                                    dWeather.Temp = -5;
                                    //ed.WriteMessage("dWeather.Temp " + "\n");
                                    //ed.WriteMessage("CBO:" + cboweatherType.ValueMember[i].ToString() + "\n");
                                    dWeather.TypeCode  = Convert.ToInt32(cboweatherType.SelectedValue.ToString());
                                    dWeather.WindSpeed = 0;
                                    dWeather.AccessInsert();
                                    break;
                                }

                                case 3:
                                {
                                    dWeather.ConditionCode = Convert.ToByte(dr["Code"].ToString());
                                    //ed.WriteMessage("Code:" + dr["Code"].ToString() + "\n");
                                    dWeather.IceDiagonal = 0;
                                    //ed.WriteMessage("dWeather.IceDiagonal " + "\n");
                                    dWeather.SaftyFactor = 3;
                                    //ed.WriteMessage("dWeather.SaftyFactor " + "\n");

                                    dWeather.Temp = 15;
                                    //ed.WriteMessage("dWeather.Temp " + "\n");
                                    //ed.WriteMessage("CBO:" + cboweatherType.ValueMember[i].ToString() + "\n");
                                    dWeather.TypeCode  = Convert.ToInt32(cboweatherType.SelectedValue.ToString());
                                    dWeather.WindSpeed = 40;
                                    dWeather.AccessInsert();
                                    break;
                                }

                                case 4:
                                {
                                    dWeather.ConditionCode = Convert.ToByte(dr["Code"].ToString());
                                    //ed.WriteMessage("Code:" + dr["Code"].ToString() + "\n");
                                    dWeather.IceDiagonal = 0;
                                    //ed.WriteMessage("dWeather.IceDiagonal " + "\n");
                                    dWeather.SaftyFactor = 5;
                                    //ed.WriteMessage("dWeather.SaftyFactor " + "\n");

                                    dWeather.Temp = 40;
                                    //ed.WriteMessage("dWeather.Temp " + "\n");
                                    //ed.WriteMessage("CBO:" + cboweatherType.ValueMember[i].ToString() + "\n");
                                    dWeather.TypeCode  = Convert.ToInt32(cboweatherType.SelectedValue.ToString());
                                    dWeather.WindSpeed = 0;
                                    dWeather.AccessInsert();
                                    break;
                                }

                                case 5:
                                {
                                    dWeather.ConditionCode = Convert.ToByte(dr["Code"].ToString());
                                    //ed.WriteMessage("Code:" + dr["Code"].ToString() + "\n");
                                    dWeather.IceDiagonal = 0;
                                    //ed.WriteMessage("dWeather.IceDiagonal " + "\n");
                                    dWeather.SaftyFactor = 3;
                                    //ed.WriteMessage("dWeather.SaftyFactor " + "\n");

                                    dWeather.Temp = -25;
                                    //ed.WriteMessage("dWeather.Temp " + "\n");
                                    //ed.WriteMessage("CBO:" + cboweatherType.ValueMember[i].ToString() + "\n");
                                    dWeather.TypeCode  = Convert.ToInt32(cboweatherType.SelectedValue.ToString());
                                    dWeather.WindSpeed = 0;
                                    dWeather.AccessInsert();
                                    break;
                                }

                                case 6:
                                {
                                    dWeather.ConditionCode = Convert.ToByte(dr["Code"].ToString());
                                    //ed.WriteMessage("Code:" + dr["Code"].ToString() + "\n");
                                    dWeather.IceDiagonal = 15;
                                    //ed.WriteMessage("dWeather.IceDiagonal " + "\n");
                                    dWeather.SaftyFactor = 3;
                                    //ed.WriteMessage("dWeather.SaftyFactor " + "\n");

                                    dWeather.Temp = -20;
                                    //ed.WriteMessage("dWeather.Temp " + "\n");
                                    //ed.WriteMessage("CBO:" + cboweatherType.ValueMember[i].ToString() + "\n");
                                    dWeather.TypeCode  = Convert.ToInt32(cboweatherType.SelectedValue.ToString());
                                    dWeather.WindSpeed = 20;
                                    dWeather.AccessInsert();
                                    break;
                                }
                                }
                            }
                            #endregion
                            #region Motevaset
                            if (i == 2)
                            {
                                switch (Convert.ToInt32(dr["Code"]))
                                {
                                case 1:
                                {
                                    dWeather.ConditionCode = Convert.ToByte(dr["Code"].ToString());
                                    //ed.WriteMessage("Code:" + dr["Code"].ToString() + "\n");
                                    dWeather.IceDiagonal = 0;
                                    //ed.WriteMessage("dWeather.IceDiagonal " + "\n");
                                    dWeather.SaftyFactor = 10;
                                    //ed.WriteMessage("dWeather.SaftyFactor " + "\n");

                                    dWeather.Temp = 20;
                                    //ed.WriteMessage("dWeather.Temp " + "\n");
                                    //ed.WriteMessage("CBO:" + cboweatherType.ValueMember[i].ToString() + "\n");
                                    dWeather.TypeCode  = Convert.ToInt32(cboweatherType.SelectedValue.ToString());
                                    dWeather.WindSpeed = 0;
                                    dWeather.AccessInsert();
                                    break;
                                }

                                case 2:
                                {
                                    dWeather.ConditionCode = Convert.ToByte(dr["Code"].ToString());
                                    //ed.WriteMessage("Code:" + dr["Code"].ToString() + "\n");
                                    dWeather.IceDiagonal = 15;
                                    //ed.WriteMessage("dWeather.IceDiagonal " + "\n");
                                    dWeather.SaftyFactor = 3;
                                    //ed.WriteMessage("dWeather.SaftyFactor " + "\n");

                                    dWeather.Temp = -5;
                                    //ed.WriteMessage("dWeather.Temp " + "\n");
                                    //ed.WriteMessage("CBO:" + cboweatherType.ValueMember[i].ToString() + "\n");
                                    dWeather.TypeCode  = Convert.ToInt32(cboweatherType.SelectedValue.ToString());
                                    dWeather.WindSpeed = 0;
                                    dWeather.AccessInsert();
                                    break;
                                }

                                case 3:
                                {
                                    dWeather.ConditionCode = Convert.ToByte(dr["Code"].ToString());
                                    //ed.WriteMessage("Code:" + dr["Code"].ToString() + "\n");
                                    dWeather.IceDiagonal = 0;
                                    //ed.WriteMessage("dWeather.IceDiagonal " + "\n");
                                    dWeather.SaftyFactor = 3;
                                    //ed.WriteMessage("dWeather.SaftyFactor " + "\n");

                                    dWeather.Temp = 15;
                                    //ed.WriteMessage("dWeather.Temp " + "\n");
                                    //ed.WriteMessage("CBO:" + cboweatherType.ValueMember[i].ToString() + "\n");
                                    dWeather.TypeCode  = Convert.ToInt32(cboweatherType.SelectedValue.ToString());
                                    dWeather.WindSpeed = 40;
                                    dWeather.AccessInsert();
                                    break;
                                }

                                case 4:
                                {
                                    dWeather.ConditionCode = Convert.ToByte(dr["Code"].ToString());
                                    //ed.WriteMessage("Code:" + dr["Code"].ToString() + "\n");
                                    dWeather.IceDiagonal = 0;
                                    //ed.WriteMessage("dWeather.IceDiagonal " + "\n");
                                    dWeather.SaftyFactor = 5;
                                    //ed.WriteMessage("dWeather.SaftyFactor " + "\n");

                                    dWeather.Temp = 45;
                                    //ed.WriteMessage("dWeather.Temp " + "\n");
                                    //ed.WriteMessage("CBO:" + cboweatherType.ValueMember[i].ToString() + "\n");
                                    dWeather.TypeCode  = Convert.ToInt32(cboweatherType.SelectedValue.ToString());
                                    dWeather.WindSpeed = 0;
                                    dWeather.AccessInsert();
                                    break;
                                }

                                case 5:
                                {
                                    dWeather.ConditionCode = Convert.ToByte(dr["Code"].ToString());
                                    //ed.WriteMessage("Code:" + dr["Code"].ToString() + "\n");
                                    dWeather.IceDiagonal = 0;
                                    //ed.WriteMessage("dWeather.IceDiagonal " + "\n");
                                    dWeather.SaftyFactor = 3;
                                    //ed.WriteMessage("dWeather.SaftyFactor " + "\n");

                                    dWeather.Temp = -20;
                                    //ed.WriteMessage("dWeather.Temp " + "\n");
                                    //ed.WriteMessage("CBO:" + cboweatherType.ValueMember[i].ToString() + "\n");
                                    dWeather.TypeCode  = Convert.ToInt32(cboweatherType.SelectedValue.ToString());
                                    dWeather.WindSpeed = 0;
                                    dWeather.AccessInsert();
                                    break;
                                }

                                case 6:
                                {
                                    dWeather.ConditionCode = Convert.ToByte(dr["Code"].ToString());
                                    //ed.WriteMessage("Code:" + dr["Code"].ToString() + "\n");
                                    dWeather.IceDiagonal = 7;
                                    //ed.WriteMessage("dWeather.IceDiagonal " + "\n");
                                    dWeather.SaftyFactor = 3;
                                    //ed.WriteMessage("dWeather.SaftyFactor " + "\n");

                                    dWeather.Temp = -10;
                                    //ed.WriteMessage("dWeather.Temp " + "\n");
                                    //ed.WriteMessage("CBO:" + cboweatherType.ValueMember[i].ToString() + "\n");
                                    dWeather.TypeCode  = Convert.ToInt32(cboweatherType.SelectedValue.ToString());
                                    dWeather.WindSpeed = 25;
                                    dWeather.AccessInsert();
                                    break;
                                }
                                }
                            }
                            #endregion
                            #region sabok
                            if (i == 3)
                            {
                                switch (Convert.ToInt32(dr["Code"]))
                                {
                                case 1:
                                {
                                    dWeather.ConditionCode = Convert.ToByte(dr["Code"].ToString());
                                    //ed.WriteMessage("Code:" + dr["Code"].ToString() + "\n");
                                    dWeather.IceDiagonal = 0;
                                    //ed.WriteMessage("dWeather.IceDiagonal " + "\n");
                                    dWeather.SaftyFactor = 10;
                                    //ed.WriteMessage("dWeather.SaftyFactor " + "\n");

                                    dWeather.Temp = 25;
                                    //ed.WriteMessage("dWeather.Temp " + "\n");
                                    //ed.WriteMessage("CBO:" + cboweatherType.ValueMember[i].ToString() + "\n");
                                    dWeather.TypeCode  = Convert.ToInt32(cboweatherType.SelectedValue.ToString());
                                    dWeather.WindSpeed = 0;
                                    dWeather.AccessInsert();
                                    break;
                                }

                                case 2:
                                {
                                    dWeather.ConditionCode = Convert.ToByte(dr["Code"].ToString());
                                    //ed.WriteMessage("Code:" + dr["Code"].ToString() + "\n");
                                    dWeather.IceDiagonal = 6;
                                    //ed.WriteMessage("dWeather.IceDiagonal " + "\n");
                                    dWeather.SaftyFactor = 3;
                                    //ed.WriteMessage("dWeather.SaftyFactor " + "\n");

                                    dWeather.Temp = -5;
                                    //ed.WriteMessage("dWeather.Temp " + "\n");
                                    //ed.WriteMessage("CBO:" + cboweatherType.ValueMember[i].ToString() + "\n");
                                    dWeather.TypeCode  = Convert.ToInt32(cboweatherType.SelectedValue.ToString());
                                    dWeather.WindSpeed = 22;
                                    dWeather.AccessInsert();
                                    break;
                                }

                                case 3:
                                {
                                    dWeather.ConditionCode = Convert.ToByte(dr["Code"].ToString());
                                    //ed.WriteMessage("Code:" + dr["Code"].ToString() + "\n");
                                    dWeather.IceDiagonal = 0;
                                    //ed.WriteMessage("dWeather.IceDiagonal " + "\n");
                                    dWeather.SaftyFactor = 3;
                                    //ed.WriteMessage("dWeather.SaftyFactor " + "\n");

                                    dWeather.Temp = 0;
                                    //ed.WriteMessage("dWeather.Temp " + "\n");
                                    //ed.WriteMessage("CBO:" + cboweatherType.ValueMember[i].ToString() + "\n");
                                    dWeather.TypeCode  = Convert.ToInt32(cboweatherType.SelectedValue.ToString());
                                    dWeather.WindSpeed = 45;
                                    dWeather.AccessInsert();
                                    break;
                                }

                                case 4:
                                {
                                    dWeather.ConditionCode = Convert.ToByte(dr["Code"].ToString());
                                    //ed.WriteMessage("Code:" + dr["Code"].ToString() + "\n");
                                    dWeather.IceDiagonal = 0;
                                    //ed.WriteMessage("dWeather.IceDiagonal " + "\n");
                                    dWeather.SaftyFactor = 5;
                                    //ed.WriteMessage("dWeather.SaftyFactor " + "\n");

                                    dWeather.Temp = 50;
                                    //ed.WriteMessage("dWeather.Temp " + "\n");
                                    //ed.WriteMessage("CBO:" + cboweatherType.ValueMember[i].ToString() + "\n");
                                    dWeather.TypeCode  = Convert.ToInt32(cboweatherType.SelectedValue.ToString());
                                    dWeather.WindSpeed = 0;
                                    dWeather.AccessInsert();
                                    break;
                                }

                                case 5:
                                {
                                    dWeather.ConditionCode = Convert.ToByte(dr["Code"].ToString());
                                    //ed.WriteMessage("Code:" + dr["Code"].ToString() + "\n");
                                    dWeather.IceDiagonal = 0;
                                    //ed.WriteMessage("dWeather.IceDiagonal " + "\n");
                                    dWeather.SaftyFactor = 3;
                                    //ed.WriteMessage("dWeather.SaftyFactor " + "\n");

                                    dWeather.Temp = -5;
                                    //ed.WriteMessage("dWeather.Temp " + "\n");
                                    //ed.WriteMessage("CBO:" + cboweatherType.ValueMember[i].ToString() + "\n");
                                    dWeather.TypeCode  = Convert.ToInt32(cboweatherType.SelectedValue.ToString());
                                    dWeather.WindSpeed = 0;
                                    dWeather.AccessInsert();
                                    break;
                                }

                                case 6:
                                {
                                    dWeather.ConditionCode = Convert.ToByte(dr["Code"].ToString());
                                    //ed.WriteMessage("Code:" + dr["Code"].ToString() + "\n");
                                    dWeather.IceDiagonal = 0;
                                    //ed.WriteMessage("dWeather.IceDiagonal " + "\n");
                                    dWeather.SaftyFactor = 3;
                                    //ed.WriteMessage("dWeather.SaftyFactor " + "\n");

                                    dWeather.Temp = 15;
                                    //ed.WriteMessage("dWeather.Temp " + "\n");
                                    //ed.WriteMessage("CBO:" + cboweatherType.ValueMember[i].ToString() + "\n");
                                    dWeather.TypeCode  = Convert.ToInt32(cboweatherType.SelectedValue.ToString());
                                    dWeather.WindSpeed = 28;
                                    dWeather.AccessInsert();
                                    break;
                                }
                                }
                            }
                            #endregion
                        }
                    }
                    ed.WriteMessage("ENDFOr");
                    cboweatherType.SelectedValue = Atend.Base.Design.DWeatherType.AccessSelectBySelectedStatus(true).Code;
                    gvWeather.DataSource         = Atend.Base.Design.DWeather.AccessSelectByType(Convert.ToInt32(cboweatherType.SelectedValue.ToString()));
                }
                else
                {
                    ed.WriteMessage("Else={0}\n", cboweatherType.SelectedValue.ToString());
                    cboweatherType.SelectedValue = Atend.Base.Design.DWeatherType.AccessSelectBySelectedStatus(true).Code;
                    gvWeather.DataSource         = Atend.Base.Design.DWeather.AccessSelectByType(Convert.ToInt32(cboweatherType.SelectedValue.ToString()));
                }
            }
            else
            {
                MessageBox.Show("لطفا طرح مورد نظر را انتخاب کنید");
                this.Close();
            }
        }