Esempio n. 1
0
        public void InsertStockInfo(StockInfo stockInfo)
        {
            SQLConn sQLConn = new SQLConn();
            string  query   = @"insert into StockInfo(
                           SEngineNo , SChassisNo , SCompany , SModel , SAmount , SRegNo
                           , SFileNo , SDate , CopyRecived , LetterRecived ) 
                           values(@SEngineNo , @SChassisNo , @SCompany , @SModel , @SAmount , @SRegNo 
                           , @SFileNo , @SDate , @CopyRecived , @LetterRecived)";

            SqlCommand sqlCommand = new SqlCommand(query, sQLConn.GetConnToLocalDb());

            SqlParameter sqlParameter = new SqlParameter
            {
                ParameterName = "SEngineNo",
                SqlDbType     = System.Data.SqlDbType.NVarChar,
                Value         = stockInfo.SEngineNo
            };

            sqlCommand.Parameters.Add(sqlParameter);

            sqlParameter = new SqlParameter
            {
                ParameterName = "SChassisNo",
                SqlDbType     = System.Data.SqlDbType.NVarChar,
                Value         = stockInfo.SChassisNo
            };

            sqlCommand.Parameters.Add(sqlParameter);

            sqlParameter = new SqlParameter
            {
                ParameterName = "SCompany",
                SqlDbType     = System.Data.SqlDbType.NVarChar,
                Value         = stockInfo.SCompany
            };

            sqlCommand.Parameters.Add(sqlParameter);

            sqlParameter = new SqlParameter
            {
                ParameterName = "SModel",
                SqlDbType     = System.Data.SqlDbType.NVarChar,
                Value         = stockInfo.SModel
            };

            sqlCommand.Parameters.Add(sqlParameter);

            sqlParameter = new SqlParameter
            {
                ParameterName = "SAmount",
                SqlDbType     = System.Data.SqlDbType.Int,
                Value         = stockInfo.SAmount
            };

            sqlCommand.Parameters.Add(sqlParameter);

            sqlParameter = new SqlParameter
            {
                ParameterName = "SRegNo",
                SqlDbType     = System.Data.SqlDbType.NVarChar,
                Value         = stockInfo.SRegNo
            };

            sqlCommand.Parameters.Add(sqlParameter);

            sqlParameter = new SqlParameter
            {
                ParameterName = "SFileNo",
                SqlDbType     = System.Data.SqlDbType.NVarChar,
                Value         = stockInfo.SFileNo
            };

            sqlCommand.Parameters.Add(sqlParameter);

            sqlParameter = new SqlParameter
            {
                ParameterName = "SDate",
                SqlDbType     = System.Data.SqlDbType.Date,
                Value         = stockInfo.SDate
            };

            sqlCommand.Parameters.Add(sqlParameter);

            sqlParameter = new SqlParameter
            {
                ParameterName = "CopyRecived",
                SqlDbType     = System.Data.SqlDbType.Int,
                Value         = stockInfo.CopyRecived
            };

            sqlCommand.Parameters.Add(sqlParameter);

            sqlParameter = new SqlParameter
            {
                ParameterName = "LetterRecived",
                SqlDbType     = System.Data.SqlDbType.Int,
                Value         = stockInfo.LetterRecived
            };

            sqlCommand.Parameters.Add(sqlParameter);
            sqlCommand.ExecuteNonQuery();
        }
Esempio n. 2
0
        public void UpdateRecord(StockInfo stockInfo, string CSEngineNo)
        {
            SQLConn sQLConn = new SQLConn();
            string  query   = @"update stockinfo set
                            SEngineNo = @SEngineNo , SChassisNo = @SChassisNo , SCompany = @SCompany
                            , SModel = SModel , SAmount = SAmount , SRegNo = SRegNo
                            , SFileNo = @SFileNo , SDate = @SDate , CopyRecived = @CopyRecived
                            , LetterRecived = @LetterRecived  Where SEngineNo = @CSEngineNo";

            SqlCommand sqlCommand = new SqlCommand(query, sQLConn.GetConnToLocalDb());

            SqlParameter sqlParameter = new SqlParameter
            {
                ParameterName = "SEngineNo",
                SqlDbType     = System.Data.SqlDbType.NVarChar,
                Value         = stockInfo.SEngineNo
            };

            sqlCommand.Parameters.Add(sqlParameter);

            sqlParameter = new SqlParameter
            {
                ParameterName = "CSEngineNo",
                SqlDbType     = System.Data.SqlDbType.NVarChar,
                Value         = CSEngineNo
            };

            sqlCommand.Parameters.Add(sqlParameter);

            sqlParameter = new SqlParameter
            {
                ParameterName = "SChassisNo",
                SqlDbType     = System.Data.SqlDbType.NVarChar,
                Value         = stockInfo.SChassisNo
            };

            sqlCommand.Parameters.Add(sqlParameter);

            sqlParameter = new SqlParameter
            {
                ParameterName = "SCompany",
                SqlDbType     = System.Data.SqlDbType.NVarChar,
                Value         = stockInfo.SCompany
            };

            sqlCommand.Parameters.Add(sqlParameter);

            sqlParameter = new SqlParameter
            {
                ParameterName = "SModel",
                SqlDbType     = System.Data.SqlDbType.NVarChar,
                Value         = stockInfo.SModel
            };

            sqlCommand.Parameters.Add(sqlParameter);

            sqlParameter = new SqlParameter
            {
                ParameterName = "SAmount",
                SqlDbType     = System.Data.SqlDbType.Int,
                Value         = stockInfo.SAmount
            };

            sqlCommand.Parameters.Add(sqlParameter);

            sqlParameter = new SqlParameter
            {
                ParameterName = "SRegNo",
                SqlDbType     = System.Data.SqlDbType.NVarChar,
                Value         = stockInfo.SRegNo
            };

            sqlCommand.Parameters.Add(sqlParameter);

            sqlParameter = new SqlParameter
            {
                ParameterName = "SFileNo",
                SqlDbType     = System.Data.SqlDbType.NVarChar,
                Value         = stockInfo.SFileNo
            };

            sqlCommand.Parameters.Add(sqlParameter);

            sqlParameter = new SqlParameter
            {
                ParameterName = "SDate",
                SqlDbType     = System.Data.SqlDbType.Date,
                Value         = stockInfo.SDate
            };

            sqlCommand.Parameters.Add(sqlParameter);

            sqlParameter = new SqlParameter
            {
                ParameterName = "CopyRecived",
                SqlDbType     = System.Data.SqlDbType.Int,
                Value         = stockInfo.CopyRecived
            };

            sqlCommand.Parameters.Add(sqlParameter);

            sqlParameter = new SqlParameter
            {
                ParameterName = "LetterRecived",
                SqlDbType     = System.Data.SqlDbType.Int,
                Value         = stockInfo.LetterRecived
            };

            sqlCommand.Parameters.Add(sqlParameter);

            sqlCommand.ExecuteNonQuery();
        }