コード例 #1
0
ファイル: FAHPDAO.cs プロジェクト: ByakuyaKu/diplom
        public int AddCriteria(CriteriaFAHP criteria, string matrix, int sessionid)
        {
            using (var connection = new SqlConnection(_connectionString))
            {
                var command = connection.CreateCommand();
                command.CommandText = "FAHPAddCriteria";
                command.CommandType = CommandType.StoredProcedure;

                command.Parameters.Add(new SqlParameter
                {
                    ParameterName = "@CriteriaName",
                    Value         = criteria.CriteriaName,
                    SqlDbType     = SqlDbType.NVarChar,
                    Direction     = ParameterDirection.Input
                });

                command.Parameters.Add(new SqlParameter
                {
                    ParameterName = "@MatrixAlt",
                    Value         = matrix,
                    SqlDbType     = SqlDbType.NVarChar,
                    Size          = 500,
                    Direction     = ParameterDirection.Input
                });

                command.Parameters.Add(new SqlParameter
                {
                    ParameterName = "@SessionID",
                    Value         = sessionid,
                    SqlDbType     = SqlDbType.Int,
                    Direction     = ParameterDirection.Input
                });

                var id = new SqlParameter
                {
                    ParameterName = "@CriteriaID",
                    SqlDbType     = SqlDbType.Int,
                    Direction     = ParameterDirection.Output
                };
                command.Parameters.Add(id);

                connection.Open();

                command.ExecuteNonQuery();

                return((int)id.Value);
            }
        }
コード例 #2
0
ファイル: FAHPLogic.cs プロジェクト: ByakuyaKu/diplom
 public int AddCriteria(CriteriaFAHP criteria, string matrix, int sessionid) => _fahpDao.AddCriteria(criteria, matrix, sessionid);