private void btnSubmit_Click(object sender, EventArgs e)
 {
     var bigFaultage = InferFaultage.FindAllByProperty("name", tbFaultageName.Text).FirstOrDefault();
     var bigFaultagePoingList = new List<InferFaultagePoint>();
     if (bigFaultage == null)
     {
         bigFaultage = new InferFaultage
         {
             name = tbFaultageName.Text,
             gap = tbGap.Text,
             angle = tbAngle.Text,
             trend = tbTrend.Text,
             type = rbtnFrontFaultage.Checked ? "正断层" : "逆断层",
             bid = IdGenerator.NewBindingId()
         };
         for (var i = 0; i < dgrdvUp.Rows.Count; i++)
         {
             var point = new InferFaultagePoint { up_or_down = "上盘" };
             if (dgrdvUp.Rows[i].Cells[0].Value == null) continue;
             point.coordinate_x = Convert.ToDouble(dgrdvUp.Rows[i].Cells[0].Value);
             point.coordinate_y = Convert.ToDouble(dgrdvUp.Rows[i].Cells[1].Value);
             point.coordinate_z = Convert.ToDouble(dgrdvUp.Rows[i].Cells[2].Value);
             point.bid = IdGenerator.NewBindingId();
             bigFaultagePoingList.Add(point);
         }
         for (var i = 0; i < dgrdvDown.Rows.Count; i++)
         {
             var point = new InferFaultagePoint();
             if (dgrdvDown.Rows[i].Cells[0].Value == null) continue;
             point.up_or_down = "下盘";
             point.coordinate_x = Convert.ToDouble(dgrdvDown.Rows[i].Cells[0].Value);
             point.coordinate_y = Convert.ToDouble(dgrdvDown.Rows[i].Cells[1].Value);
             point.coordinate_z = Convert.ToDouble(dgrdvDown.Rows[i].Cells[2].Value);
             point.bid = IdGenerator.NewBindingId();
             bigFaultagePoingList.Add(point);
         }
         bigFaultage.Save();
         var title = bigFaultage.name + "  " + bigFaultage.angle + "  " +
                     bigFaultage.gap;
         DrawBigFaultageInfo.DrawTddc(title, bigFaultagePoingList, bigFaultage.bid);
     }
     else
     {
         bigFaultage.name = tbFaultageName.Text;
         bigFaultage.gap = tbGap.Text;
         bigFaultage.angle = tbAngle.Text;
         bigFaultage.trend = tbTrend.Text;
         bigFaultage.type = rbtnFrontFaultage.Checked ? "正断层" : "逆断层";
         foreach (var bigFaultagePoint in bigFaultagePoingList)
         {
             bigFaultagePoint.Save();
         }
         bigFaultage.Save();
     }
 }
Ejemplo n.º 2
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            var bigFaultage          = InferFaultage.FindAllByProperty("name", tbFaultageName.Text).FirstOrDefault();
            var bigFaultagePoingList = new List <InferFaultagePoint>();

            if (bigFaultage == null)
            {
                bigFaultage = new InferFaultage
                {
                    name  = tbFaultageName.Text,
                    gap   = tbGap.Text,
                    angle = tbAngle.Text,
                    trend = tbTrend.Text,
                    type  = rbtnFrontFaultage.Checked ? "正断层" : "逆断层",
                    bid   = IdGenerator.NewBindingId()
                };
                for (var i = 0; i < dgrdvUp.Rows.Count; i++)
                {
                    var point = new InferFaultagePoint {
                        up_or_down = "上盘"
                    };
                    if (dgrdvUp.Rows[i].Cells[0].Value == null)
                    {
                        continue;
                    }
                    point.coordinate_x = Convert.ToDouble(dgrdvUp.Rows[i].Cells[0].Value);
                    point.coordinate_y = Convert.ToDouble(dgrdvUp.Rows[i].Cells[1].Value);
                    point.coordinate_z = Convert.ToDouble(dgrdvUp.Rows[i].Cells[2].Value);
                    point.bid          = IdGenerator.NewBindingId();
                    bigFaultagePoingList.Add(point);
                }
                for (var i = 0; i < dgrdvDown.Rows.Count; i++)
                {
                    var point = new InferFaultagePoint();
                    if (dgrdvDown.Rows[i].Cells[0].Value == null)
                    {
                        continue;
                    }
                    point.up_or_down   = "下盘";
                    point.coordinate_x = Convert.ToDouble(dgrdvDown.Rows[i].Cells[0].Value);
                    point.coordinate_y = Convert.ToDouble(dgrdvDown.Rows[i].Cells[1].Value);
                    point.coordinate_z = Convert.ToDouble(dgrdvDown.Rows[i].Cells[2].Value);
                    point.bid          = IdGenerator.NewBindingId();
                    bigFaultagePoingList.Add(point);
                }
                bigFaultage.Save();
                var title = bigFaultage.name + "  " + bigFaultage.angle + "  " +
                            bigFaultage.gap;
                DrawBigFaultageInfo.DrawTddc(title, bigFaultagePoingList, bigFaultage.bid);
            }
            else
            {
                bigFaultage.name  = tbFaultageName.Text;
                bigFaultage.gap   = tbGap.Text;
                bigFaultage.angle = tbAngle.Text;
                bigFaultage.trend = tbTrend.Text;
                bigFaultage.type  = rbtnFrontFaultage.Checked ? "正断层" : "逆断层";
                foreach (var bigFaultagePoint in bigFaultagePoingList)
                {
                    bigFaultagePoint.Save();
                }
                bigFaultage.Save();
            }
        }