Esempio n. 1
0
        private void cboweatherType_SelectedIndexChanged_1(object sender, EventArgs e)
        {
            gvWeather.AutoGenerateColumns = false;
            Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;

            //ed.WriteMessage("SelectedValue" + cboweatherType.SelectedValue.ToString() + "\n");
            //gvWeather.Rows.Clear();
            gvWeather.DataSource = Atend.Base.Design.DWeather.AccessSelectByType(Convert.ToInt32(cboweatherType.SelectedValue.ToString()));
            Atend.Base.Design.DWeatherType weatherType = Atend.Base.Design.DWeatherType.AccessSelectByCode(
                Convert.ToInt32(cboweatherType.SelectedValue));
            chkSelected.Checked = weatherType.IsSelected;
            //ed.WriteMessage("^^^^^****weatherType.IsSelected={0}\n",weatherType.IsSelected);
        }
Esempio n. 2
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();
            }
        }