コード例 #1
0
ファイル: ImportItem.cs プロジェクト: leadscloud/lx
        /// <summary>
        ///
        /// </summary>
        /// <param name="row"></param>
        private void WriteDataRow(DataRow row)
        {
            DateTime dt              = Convert.ToDateTime(row["DT"]);
            float    height          = Convert.ToSingle(SafeFloat(row["SluiceHeight"]));
            float    before          = Convert.ToSingle(SafeFloat(row["BeforeDepth"]));
            float    after           = Convert.ToSingle(SafeFloat(row["AfterDepth"]));
            float    discharge       = Convert.ToSingle(SafeFloat(row["Discharge"]));
            double   totalWaterVolum = Convert.ToDouble(SafeFloat(row["TotalWaterVolume"]));
            double   remineWater     = 0 - totalWaterVolum;

            before += Elvation;
            after  += Elvation;


            height = MToCM(height);
            before = MToCM(before);
            after  = MToCM(after);

            /*
             *
             * myConnection.Open();
             *
             * SqlCommand myCommand = new SqlCommand("TT_Gate_Save", myConnection);
             * myCommand.CommandType = CommandType.StoredProcedure;
             *
             * Gate_His gatehis = (Gate_His)gate_his;
             *
             * myCommand.Parameters.AddWithValue("@ComAdr", gatehis.ComAdr);
             * myCommand.Parameters.AddWithValue("@StrTime", gatehis.DateTime);
             * myCommand.Parameters.AddWithValue("@BeforeLevel", gatehis.BeforeLevel);
             * myCommand.Parameters.AddWithValue("@BehindLevel", gatehis.BehindLevel);
             * myCommand.Parameters.AddWithValue("@Height", gatehis.Height);
             * myCommand.Parameters.AddWithValue("@Flux", gatehis.Flux);
             * myCommand.Parameters.AddWithValue("@ReWater", gatehis.ReWater);
             * myCommand.Parameters.AddWithValue("@TuWater", gatehis.TuWater);
             * myCommand.Parameters.AddWithValue("@Power", gatehis.Power);
             * myCommand.Parameters.AddWithValue("@Lock", gatehis.Lock_OC);
             *
             * myCommand.ExecuteNonQuery();
             *
             */

            SqlCommand myCommand = new SqlCommand("TT_Gate_Save");

            myCommand.CommandType = CommandType.StoredProcedure;

            myCommand.Parameters.AddWithValue("@ComAdr", this.ComAdr);
            myCommand.Parameters.AddWithValue("@StrTime", dt);
            myCommand.Parameters.AddWithValue("@BeforeLevel", before);
            myCommand.Parameters.AddWithValue("@BehindLevel", after);
            myCommand.Parameters.AddWithValue("@Height", height);
            myCommand.Parameters.AddWithValue("@Flux", discharge);
            myCommand.Parameters.AddWithValue("@ReWater", remineWater);
            myCommand.Parameters.AddWithValue("@TuWater", totalWaterVolum);
            myCommand.Parameters.AddWithValue("@Power", "");
            myCommand.Parameters.AddWithValue("@Lock", "");

            DBI.ExecuteScalar(myCommand);
        }